Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
4b9f4677
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4b9f4677
编写于
2月 12, 2009
作者:
D
dcherepanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6724890: Deadlock between AWT-EventQueue-1 and AWT-XAWT threads during IDE start
Reviewed-by: art, ant
上级
9350bc6e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
138 addition
and
30 deletion
+138
-30
src/share/classes/java/awt/Frame.java
src/share/classes/java/awt/Frame.java
+28
-8
src/share/classes/sun/awt/AWTAccessor.java
src/share/classes/sun/awt/AWTAccessor.java
+36
-0
src/solaris/classes/sun/awt/X11/XFramePeer.java
src/solaris/classes/sun/awt/X11/XFramePeer.java
+15
-5
src/windows/classes/sun/awt/windows/WFramePeer.java
src/windows/classes/sun/awt/windows/WFramePeer.java
+24
-5
src/windows/native/sun/windows/awt_Frame.cpp
src/windows/native/sun/windows/awt_Frame.cpp
+29
-6
src/windows/native/sun/windows/awt_Frame.h
src/windows/native/sun/windows/awt_Frame.h
+6
-6
未找到文件。
src/share/classes/java/awt/Frame.java
浏览文件 @
4b9f4677
...
...
@@ -36,6 +36,7 @@ import java.io.ObjectInputStream;
import
java.io.IOException
;
import
sun.awt.AppContext
;
import
sun.awt.SunToolkit
;
import
sun.awt.AWTAccessor
;
import
java.lang.ref.WeakReference
;
import
javax.accessibility.*
;
...
...
@@ -738,11 +739,15 @@ public class Frame extends Window implements MenuContainer {
* @since 1.4
* @see java.awt.Window#addWindowStateListener
*/
public
synchronized
void
setExtendedState
(
int
state
)
{
public
void
setExtendedState
(
int
state
)
{
if
(
!
isFrameStateSupported
(
state
)
)
{
return
;
}
this
.
state
=
state
;
synchronized
(
getObjectLock
())
{
this
.
state
=
state
;
}
// peer.setState must be called outside of object lock
// synchronization block to avoid possible deadlock
FramePeer
peer
=
(
FramePeer
)
this
.
peer
;
if
(
peer
!=
null
)
{
peer
.
setState
(
state
);
...
...
@@ -804,12 +809,27 @@ public class Frame extends Window implements MenuContainer {
* @see #setExtendedState(int)
* @since 1.4
*/
public
synchronized
int
getExtendedState
()
{
FramePeer
peer
=
(
FramePeer
)
this
.
peer
;
if
(
peer
!=
null
)
{
state
=
peer
.
getState
();
public
int
getExtendedState
()
{
synchronized
(
getObjectLock
())
{
return
state
;
}
return
state
;
}
static
{
AWTAccessor
.
setFrameAccessor
(
new
AWTAccessor
.
FrameAccessor
()
{
public
void
setExtendedState
(
Frame
frame
,
int
state
)
{
synchronized
(
frame
.
getObjectLock
())
{
frame
.
state
=
state
;
}
}
public
int
getExtendedState
(
Frame
frame
)
{
synchronized
(
frame
.
getObjectLock
())
{
return
frame
.
state
;
}
}
}
);
}
/**
...
...
@@ -967,7 +987,7 @@ public class Frame extends Window implements MenuContainer {
if
(
resizable
)
{
str
+=
",resizable"
;
}
getExtendedState
();
// sync with peer
int
state
=
getExtendedState
();
if
(
state
==
NORMAL
)
{
str
+=
",normal"
;
}
...
...
src/share/classes/sun/awt/AWTAccessor.java
浏览文件 @
4b9f4677
...
...
@@ -132,6 +132,20 @@ public final class AWTAccessor {
boolean
isSystemGenerated
(
AWTEvent
ev
);
}
/*
* An accessor for the java.awt.Frame class.
*/
public
interface
FrameAccessor
{
/*
* Sets the state of this frame.
*/
void
setExtendedState
(
Frame
frame
,
int
state
);
/*
* Gets the state of this frame.
*/
int
getExtendedState
(
Frame
frame
);
}
/*
* The java.awt.Component class accessor object.
*/
...
...
@@ -147,6 +161,11 @@ public final class AWTAccessor {
*/
private
static
AWTEventAccessor
awtEventAccessor
;
/*
* The java.awt.Frame class accessor object.
*/
private
static
FrameAccessor
frameAccessor
;
/*
* Set an accessor object for the java.awt.Component class.
*/
...
...
@@ -195,4 +214,21 @@ public final class AWTAccessor {
public
static
AWTEventAccessor
getAWTEventAccessor
()
{
return
awtEventAccessor
;
}
/*
* Set an accessor object for the java.awt.Frame class.
*/
public
static
void
setFrameAccessor
(
FrameAccessor
fa
)
{
frameAccessor
=
fa
;
}
/*
* Retrieve the accessor object for the java.awt.Frame class.
*/
public
static
FrameAccessor
getFrameAccessor
()
{
if
(
frameAccessor
==
null
)
{
unsafe
.
ensureClassInitialized
(
Frame
.
class
);
}
return
frameAccessor
;
}
}
src/solaris/classes/sun/awt/X11/XFramePeer.java
浏览文件 @
4b9f4677
...
...
@@ -36,6 +36,7 @@ import java.awt.Rectangle;
import
java.awt.peer.FramePeer
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
sun.awt.AWTAccessor
;
class
XFramePeer
extends
XDecoratedPeer
implements
FramePeer
{
private
static
Logger
log
=
Logger
.
getLogger
(
"sun.awt.X11.XFramePeer"
);
...
...
@@ -231,13 +232,19 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
}
}
public
int
getState
()
{
return
state
;
}
public
int
getState
()
{
synchronized
(
getStateLock
())
{
return
state
;
}
}
public
void
setState
(
int
newState
)
{
if
(!
isShowing
())
{
stateLog
.
finer
(
"Frame is not showing"
);
state
=
newState
;
return
;
synchronized
(
getStateLock
())
{
if
(!
isShowing
())
{
stateLog
.
finer
(
"Frame is not showing"
);
state
=
newState
;
return
;
}
}
changeState
(
newState
);
}
...
...
@@ -296,6 +303,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
int
old_state
=
state
;
state
=
newState
;
// sync target with peer
AWTAccessor
.
getFrameAccessor
().
setExtendedState
((
Frame
)
target
,
state
);
if
((
changed
&
Frame
.
ICONIFIED
)
!=
0
)
{
if
((
state
&
Frame
.
ICONIFIED
)
!=
0
)
{
stateLog
.
finer
(
"Iconified"
);
...
...
src/windows/classes/sun/awt/windows/WFramePeer.java
浏览文件 @
4b9f4677
...
...
@@ -25,27 +25,46 @@
package
sun.awt.windows
;
import
java.util.Vector
;
import
java.awt.*
;
import
java.awt.peer.*
;
import
java.awt.image.ImageObserver
;
import
sun.awt.image.ImageRepresentation
;
import
sun.awt.image.IntegerComponentRaster
;
import
sun.awt.image.ToolkitImage
;
import
java.awt.image.Raster
;
import
java.awt.image.DataBuffer
;
import
java.awt.image.DataBufferInt
;
import
java.awt.image.BufferedImage
;
import
sun.awt.im.*
;
import
sun.awt.Win32GraphicsDevice
;
import
java.awt.image.ColorModel
;
import
sun.awt.image.ImageRepresentation
;
import
sun.awt.image.IntegerComponentRaster
;
import
sun.awt.image.ToolkitImage
;
import
sun.awt.im.*
;
import
sun.awt.Win32GraphicsDevice
;
import
sun.awt.AWTAccessor
;
class
WFramePeer
extends
WWindowPeer
implements
FramePeer
{
static
{
initIDs
();
}
// initialize JNI field and method IDs
private
static
native
void
initIDs
();
// FramePeer implementation
public
native
void
setState
(
int
state
);
public
native
int
getState
();
// sync target and peer
public
void
setExtendedState
(
int
state
)
{
AWTAccessor
.
getFrameAccessor
().
setExtendedState
((
Frame
)
target
,
state
);
}
public
int
getExtendedState
()
{
return
AWTAccessor
.
getFrameAccessor
().
getExtendedState
((
Frame
)
target
);
}
// Convenience methods to save us from trouble of extracting
// Rectangle fields in native code.
private
native
void
setMaximizedBounds
(
int
x
,
int
y
,
int
w
,
int
h
);
...
...
src/windows/native/sun/windows/awt_Frame.cpp
浏览文件 @
4b9f4677
...
...
@@ -90,8 +90,10 @@ struct BlockedThreadStruct {
*/
jfieldID
AwtFrame
::
handleID
;
jfieldID
AwtFrame
::
stateID
;
jfieldID
AwtFrame
::
undecoratedID
;
jmethodID
AwtFrame
::
getExtendedStateMID
;
jmethodID
AwtFrame
::
setExtendedStateMID
;
jmethodID
AwtFrame
::
activateEmbeddingTopLevelMID
;
...
...
@@ -232,7 +234,7 @@ AwtFrame* AwtFrame::Create(jobject self, jobject parent)
frame
->
InitPeerGraphicsConfig
(
env
,
self
);
AwtToolkit
::
GetInstance
().
RegisterEmbedderProcessId
(
hwndParent
);
}
else
{
jint
state
=
env
->
GetIntField
(
target
,
AwtFrame
::
state
ID
);
jint
state
=
env
->
CallIntMethod
(
self
,
AwtFrame
::
getExtendedStateM
ID
);
DWORD
exStyle
;
DWORD
style
;
...
...
@@ -883,6 +885,11 @@ MsgRouting AwtFrame::WmSize(UINT type, int w, int h)
if
(
changed
!=
0
)
{
DTRACE_PRINTLN2
(
"AwtFrame::WmSize: reporting state change %x -> %x"
,
oldState
,
newState
);
// sync target with peer
JNIEnv
*
env
=
(
JNIEnv
*
)
JNU_GetEnv
(
jvm
,
JNI_VERSION_1_2
);
env
->
CallVoidMethod
(
GetPeer
(
env
),
AwtFrame
::
setExtendedStateMID
,
newState
);
// report (de)iconification to old clients
if
(
changed
&
java_awt_Frame_ICONIFIED
)
{
if
(
newState
&
java_awt_Frame_ICONIFIED
)
{
...
...
@@ -1594,7 +1601,7 @@ void AwtFrame::_NotifyModalBlocked(void *param)
extern
"C"
{
/*
* Class:
sun_awt_windows_WFramePeer
* Class:
java_awt_Frame
* Method: initIDs
* Signature: ()V
*/
...
...
@@ -1603,15 +1610,31 @@ Java_java_awt_Frame_initIDs(JNIEnv *env, jclass cls)
{
TRY
;
AwtFrame
::
stateID
=
env
->
GetFieldID
(
cls
,
"state"
,
"I"
);
DASSERT
(
AwtFrame
::
stateID
!=
NULL
);
AwtFrame
::
undecoratedID
=
env
->
GetFieldID
(
cls
,
"undecorated"
,
"Z"
);
DASSERT
(
AwtFrame
::
undecoratedID
!=
NULL
);
CATCH_BAD_ALLOC
;
}
/*
* Class: sun_awt_windows_WFramePeer
* Method: initIDs
* Signature: ()V
*/
JNIEXPORT
void
JNICALL
Java_sun_awt_windows_WFramePeer_initIDs
(
JNIEnv
*
env
,
jclass
cls
)
{
TRY
;
AwtFrame
::
setExtendedStateMID
=
env
->
GetMethodID
(
cls
,
"setExtendedState"
,
"(I)V"
);
AwtFrame
::
getExtendedStateMID
=
env
->
GetMethodID
(
cls
,
"getExtendedState"
,
"()I"
);
DASSERT
(
AwtFrame
::
setExtendedStateMID
);
DASSERT
(
AwtFrame
::
getExtendedStateMID
);
CATCH_BAD_ALLOC
;
}
/*
* Class: sun_awt_windows_WFramePeer
* Method: setState
...
...
src/windows/native/sun/windows/awt_Frame.h
浏览文件 @
4b9f4677
...
...
@@ -48,14 +48,14 @@ public:
FRAME_SETMENUBAR
};
/*
int handle field for sun.awt.windows.WEmbeddedFrame
*/
static
jfieldID
handle
ID
;
/*
java.awt.Frame fields and method IDs
*/
static
jfieldID
undecorated
ID
;
/*
int state field for java.awt.Frame
*/
static
jfieldID
stat
eID
;
/*
sun.awt.windows.WEmbeddedFrame fields and method IDs
*/
static
jfieldID
handl
eID
;
/* boolean undecorated field for java.awt.Frame */
static
j
fieldID
undecorated
ID
;
static
jmethodID
setExtendedStateMID
;
static
j
methodID
getExtendedStateM
ID
;
/* method id for WEmbeddedFrame.requestActivate() method */
static
jmethodID
activateEmbeddingTopLevelMID
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录