author | prr |
Sat, 19 Sep 2015 15:45:59 -0700 | |
changeset 32865 | f9cb6e427f9e |
parent 30918 | ee2374d4aae3 |
child 39850 | 81332a77764d |
permissions | -rw-r--r-- |
2 | 1 |
/* |
5506 | 2 |
* Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
package sun.awt.windows; |
|
26 |
||
27 |
abstract class WObjectPeer { |
|
28 |
||
29 |
static { |
|
30 |
initIDs(); |
|
31 |
} |
|
32 |
||
108
deaaed5cedb7
6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents:
2
diff
changeset
|
33 |
// The Windows handle for the native widget. |
30918
ee2374d4aae3
7155957: closed/java/awt/MenuBar/MenuBarStress1/MenuBarStress1.java hangs on win 64 bit with jdk8
ssadetsky
parents:
25859
diff
changeset
|
34 |
volatile long pData; |
108
deaaed5cedb7
6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents:
2
diff
changeset
|
35 |
// if the native peer has been destroyed |
30918
ee2374d4aae3
7155957: closed/java/awt/MenuBar/MenuBarStress1/MenuBarStress1.java hangs on win 64 bit with jdk8
ssadetsky
parents:
25859
diff
changeset
|
36 |
volatile boolean destroyed = false; |
108
deaaed5cedb7
6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents:
2
diff
changeset
|
37 |
// The associated AWT object. |
deaaed5cedb7
6592751: EmbeddedFrame disposal is fragile and breaks clean AppContext termination
son
parents:
2
diff
changeset
|
38 |
Object target; |
2 | 39 |
|
40 |
private volatile boolean disposed; |
|
41 |
||
42 |
// set from JNI if any errors in creating the peer occur |
|
43 |
protected Error createError = null; |
|
44 |
||
2808
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
108
diff
changeset
|
45 |
// used to synchronize the state of this peer |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
108
diff
changeset
|
46 |
private final Object stateLock = new Object(); |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
108
diff
changeset
|
47 |
|
2 | 48 |
public static WObjectPeer getPeerForTarget(Object t) { |
49 |
WObjectPeer peer = (WObjectPeer) WToolkit.targetToPeer(t); |
|
50 |
return peer; |
|
51 |
} |
|
52 |
||
53 |
public long getData() { |
|
54 |
return pData; |
|
55 |
} |
|
56 |
||
57 |
public Object getTarget() { |
|
58 |
return target; |
|
59 |
} |
|
60 |
||
2808
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
108
diff
changeset
|
61 |
public final Object getStateLock() { |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
108
diff
changeset
|
62 |
return stateLock; |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
108
diff
changeset
|
63 |
} |
a139a919f645
6794764: Translucent windows are completely repainted on every paint event, on Windows
art
parents:
108
diff
changeset
|
64 |
|
2 | 65 |
/* |
66 |
* Subclasses should override disposeImpl() instead of dispose(). Client |
|
67 |
* code should always invoke dispose(), never disposeImpl(). |
|
68 |
*/ |
|
32865
f9cb6e427f9e
8136783: Run blessed-modifier-order script on java.desktop
prr
parents:
30918
diff
changeset
|
69 |
protected abstract void disposeImpl(); |
2 | 70 |
public final void dispose() { |
71 |
boolean call_disposeImpl = false; |
|
72 |
||
73 |
synchronized (this) { |
|
74 |
if (!disposed) { |
|
75 |
disposed = call_disposeImpl = true; |
|
76 |
} |
|
77 |
} |
|
78 |
||
79 |
if (call_disposeImpl) { |
|
80 |
disposeImpl(); |
|
81 |
} |
|
82 |
} |
|
83 |
protected final boolean isDisposed() { |
|
84 |
return disposed; |
|
85 |
} |
|
86 |
||
87 |
/** |
|
88 |
* Initialize JNI field and method IDs |
|
89 |
*/ |
|
90 |
private static native void initIDs(); |
|
91 |
} |