# HG changeset patch
# User serb
# Date 1445441576 -10800
# Node ID 1895624f29837511b4a96548a0794e716d6f6d97
# Parent fad099f1505eaa337b1fcd1d7309cfc81cc35627
8138764: In some cases the usage of TreeLock can be replaced by other synchronization
Reviewed-by: alexp, alexsch
diff -r fad099f1505e -r 1895624f2983 jdk/src/java.desktop/share/classes/java/awt/Component.java
--- a/jdk/src/java.desktop/share/classes/java/awt/Component.java Tue Oct 20 22:46:29 2015 +0300
+++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java Wed Oct 21 18:32:56 2015 +0300
@@ -312,7 +312,7 @@
* @see GraphicsConfiguration
* @see #getGraphicsConfiguration
*/
- private transient GraphicsConfiguration graphicsConfig = null;
+ private transient volatile GraphicsConfiguration graphicsConfig;
/**
* A reference to a BufferStrategy
object
@@ -1143,9 +1143,7 @@
* @since 1.3
*/
public GraphicsConfiguration getGraphicsConfiguration() {
- synchronized(getTreeLock()) {
- return getGraphicsConfiguration_NoClientCode();
- }
+ return getGraphicsConfiguration_NoClientCode();
}
final GraphicsConfiguration getGraphicsConfiguration_NoClientCode() {
diff -r fad099f1505e -r 1895624f2983 jdk/src/java.desktop/share/classes/java/awt/Window.java
--- a/jdk/src/java.desktop/share/classes/java/awt/Window.java Tue Oct 20 22:46:29 2015 +0300
+++ b/jdk/src/java.desktop/share/classes/java/awt/Window.java Wed Oct 21 18:32:56 2015 +0300
@@ -347,7 +347,7 @@
* @see #getOpacity()
* @since 1.7
*/
- private float opacity = 1.0f;
+ private volatile float opacity = 1.0f;
/**
* The shape assigned to this window. This field is set to {@code null} if
@@ -1040,9 +1040,7 @@
closeSplashScreen();
Dialog.checkShouldBeBlocked(this);
super.show();
- synchronized (getTreeLock()) {
- this.locationByPlatform = false;
- }
+ locationByPlatform = false;
for (int i = 0; i < ownedWindowList.size(); i++) {
Window child = ownedWindowList.elementAt(i).get();
if ((child != null) && child.showWithParent) {
@@ -1115,9 +1113,7 @@
modalBlocker.unblockWindow(this);
}
super.hide();
- synchronized (getTreeLock()) {
- this.locationByPlatform = false;
- }
+ locationByPlatform = false;
}
final void clearMostRecentFocusOwnerOnHide() {
@@ -3411,7 +3407,7 @@
return super.canContainFocusOwner(focusOwnerCandidate) && isFocusableWindow();
}
- private boolean locationByPlatform = locationByPlatformProp;
+ private volatile boolean locationByPlatform = locationByPlatformProp;
/**
@@ -3482,9 +3478,7 @@
* @since 1.5
*/
public boolean isLocationByPlatform() {
- synchronized (getTreeLock()) {
- return locationByPlatform;
- }
+ return locationByPlatform;
}
/**
@@ -3573,9 +3567,7 @@
* @since 1.7
*/
public float getOpacity() {
- synchronized (getTreeLock()) {
- return opacity;
- }
+ return opacity;
}
/**
diff -r fad099f1505e -r 1895624f2983 jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java
--- a/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java Tue Oct 20 22:46:29 2015 +0300
+++ b/jdk/src/java.desktop/share/classes/sun/swing/CachedPainter.java Wed Oct 21 18:32:56 2015 +0300
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -53,9 +53,7 @@
*/
public abstract class CachedPainter {
// CacheMap maps from class to ImageCache.
- private static final Map