Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
3bb4c47b
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看板
提交
3bb4c47b
编写于
6月 12, 2018
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8202768: [macos] Appkit thread slows when any Window Manager active
Reviewed-by: ant
上级
c9f62569
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
117 addition
and
7 deletion
+117
-7
src/macosx/native/sun/awt/JavaComponentAccessibility.m
src/macosx/native/sun/awt/JavaComponentAccessibility.m
+10
-7
test/javax/accessibility/SlowPanelIteration/SlowPanelIteration.java
.../accessibility/SlowPanelIteration/SlowPanelIteration.java
+107
-0
未找到文件。
src/macosx/native/sun/awt/JavaComponentAccessibility.m
浏览文件 @
3bb4c47b
/*
/*
* Copyright (c) 2011, 201
6
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
8
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -325,15 +325,15 @@ static NSObject *sAttributeNamesLOCK = nil;
...
@@ -325,15 +325,15 @@ static NSObject *sAttributeNamesLOCK = nil;
}
}
JavaComponentAccessibility
*
child
=
[
self
createWithParent
:
parent
accessible
:
jchild
role
:
childJavaRole
index
:
childIndex
withEnv
:
env
withView
:
parent
->
fView
];
JavaComponentAccessibility
*
child
=
[
self
createWithParent
:
parent
accessible
:
jchild
role
:
childJavaRole
index
:
childIndex
withEnv
:
env
withView
:
parent
->
fView
];
(
*
env
)
->
DeleteLocalRef
(
env
,
jchild
);
(
*
env
)
->
DeleteLocalRef
(
env
,
jchild
);
(
*
env
)
->
DeleteLocalRef
(
env
,
jchildJavaRole
);
(
*
env
)
->
DeleteLocalRef
(
env
,
jchildJavaRole
);
[
children
addObject
:
child
];
[
children
addObject
:
child
];
childIndex
++
;
childIndex
++
;
}
}
(
*
env
)
->
DeleteLocalRef
(
env
,
jchildrenAndRoles
);
(
*
env
)
->
DeleteLocalRef
(
env
,
jchildrenAndRoles
);
return
children
;
return
children
;
}
}
...
@@ -646,6 +646,9 @@ static NSObject *sAttributeNamesLOCK = nil;
...
@@ -646,6 +646,9 @@ static NSObject *sAttributeNamesLOCK = nil;
}
}
// The above set of attributes is immutable per role, but some objects, if
// The above set of attributes is immutable per role, but some objects, if
// they are the child of a list, need to add the selected and index attributes.
// they are the child of a list, need to add the selected and index attributes.
if
([
self
accessibilityIsIgnored
])
{
return
names
;
}
id
myParent
=
[
self
accessibilityParentAttribute
];
id
myParent
=
[
self
accessibilityParentAttribute
];
if
([
myParent
isKindOfClass
:[
JavaComponentAccessibility
class
]])
{
if
([
myParent
isKindOfClass
:[
JavaComponentAccessibility
class
]])
{
NSString
*
parentRole
=
[(
JavaComponentAccessibility
*
)
myParent
javaRole
];
NSString
*
parentRole
=
[(
JavaComponentAccessibility
*
)
myParent
javaRole
];
...
@@ -1060,7 +1063,7 @@ static NSObject *sAttributeNamesLOCK = nil;
...
@@ -1060,7 +1063,7 @@ static NSObject *sAttributeNamesLOCK = nil;
sjc_CAccessibility
,
sjc_CAccessibility
,
"requestSelection"
,
"requestSelection"
,
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)V"
);
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)V"
);
if
([(
NSNumber
*
)
value
boolValue
])
{
if
([(
NSNumber
*
)
value
boolValue
])
{
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
JNFCallStaticVoidMethod
(
env
,
jm_requestSelection
,
fAccessible
,
fComponent
);
// AWT_THREADING Safe (AWTRunLoop)
JNFCallStaticVoidMethod
(
env
,
jm_requestSelection
,
fAccessible
,
fComponent
);
// AWT_THREADING Safe (AWTRunLoop)
...
@@ -1167,7 +1170,7 @@ static NSObject *sAttributeNamesLOCK = nil;
...
@@ -1167,7 +1170,7 @@ static NSObject *sAttributeNamesLOCK = nil;
// Need to handle popupmenus differently.
// Need to handle popupmenus differently.
//
//
// At least for now don't handle combo box menus.
// At least for now don't handle combo box menus.
// This may change when later fixing issues which currently
// This may change when later fixing issues which currently
// exist for combo boxes, but for now the following is only
// exist for combo boxes, but for now the following is only
// for JPopupMenus, not for combobox menus.
// for JPopupMenus, not for combobox menus.
id
parent
=
[
self
parent
];
id
parent
=
[
self
parent
];
...
@@ -1349,7 +1352,7 @@ static NSObject *sAttributeNamesLOCK = nil;
...
@@ -1349,7 +1352,7 @@ static NSObject *sAttributeNamesLOCK = nil;
NSWindow
*
hostWindow
=
[[
self
->
fView
window
]
retain
];
NSWindow
*
hostWindow
=
[[
self
->
fView
window
]
retain
];
jobject
focused
=
JNFCallStaticObjectMethod
(
env
,
jm_getFocusOwner
,
fComponent
);
// AWT_THREADING Safe (AWTRunLoop)
jobject
focused
=
JNFCallStaticObjectMethod
(
env
,
jm_getFocusOwner
,
fComponent
);
// AWT_THREADING Safe (AWTRunLoop)
[
hostWindow
release
];
[
hostWindow
release
];
if
(
focused
!=
NULL
)
{
if
(
focused
!=
NULL
)
{
if
(
JNFIsInstanceOf
(
env
,
focused
,
&
sjc_Accessible
))
{
if
(
JNFIsInstanceOf
(
env
,
focused
,
&
sjc_Accessible
))
{
value
=
[
JavaComponentAccessibility
createWithAccessible
:
focused
withEnv
:
env
withView
:
fView
];
value
=
[
JavaComponentAccessibility
createWithAccessible
:
focused
withEnv
:
env
withView
:
fView
];
...
...
test/javax/accessibility/SlowPanelIteration/SlowPanelIteration.java
0 → 100644
浏览文件 @
3bb4c47b
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.awt.BorderLayout
;
import
java.awt.Color
;
import
java.awt.Container
;
import
java.awt.Dimension
;
import
java.awt.EventQueue
;
import
java.awt.Point
;
import
java.awt.Robot
;
import
java.awt.event.InputEvent
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
import
java.util.concurrent.CountDownLatch
;
import
java.util.concurrent.TimeUnit
;
import
javax.swing.JFrame
;
import
javax.swing.JPanel
;
/**
* @test
* @key headful
* @bug 8202768
* @summary we should not hang when lots of panels are used
*/
public
final
class
SlowPanelIteration
{
private
static
JFrame
frame
;
private
static
Point
center
=
new
Point
();
private
static
volatile
CountDownLatch
go
;
public
static
void
main
(
final
String
[]
args
)
throws
Exception
{
Robot
r
=
new
Robot
();
// accessibility tool will need time to react to our clicks
r
.
setAutoDelay
(
200
);
try
{
EventQueue
.
invokeAndWait
(
SlowPanelIteration:
:
showUI
);
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
go
=
new
CountDownLatch
(
1
);
r
.
mouseMove
(
center
.
x
,
center
.
y
);
r
.
mousePress
(
InputEvent
.
BUTTON1_DOWN_MASK
);
r
.
mouseRelease
(
InputEvent
.
BUTTON1_DOWN_MASK
);
if
(!
go
.
await
(
10
,
TimeUnit
.
SECONDS
))
{
throw
new
RuntimeException
(
"Too slow operation"
);
}
}
}
finally
{
EventQueue
.
invokeAndWait
(
SlowPanelIteration:
:
dispose
);
}
}
private
static
void
showUI
()
{
frame
=
new
JFrame
();
frame
.
setSize
(
new
Dimension
(
400
,
400
));
frame
.
setLocationRelativeTo
(
null
);
final
Container
content
=
frame
.
getContentPane
();
content
.
setLayout
(
new
BorderLayout
(
0
,
0
));
Container
lastPanel
=
content
;
for
(
int
i
=
0
;
i
<
500
;
i
++)
{
final
JPanel
p
=
new
JPanel
();
p
.
setLayout
(
new
BorderLayout
(
0
,
0
));
lastPanel
.
add
(
p
);
lastPanel
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseClicked
(
MouseEvent
e
)
{
System
.
out
.
println
(
"click"
);
go
.
countDown
();
}
});
lastPanel
=
p
;
}
lastPanel
.
setBackground
(
Color
.
GREEN
);
frame
.
setVisible
(
true
);
Point
loc
=
frame
.
getLocationOnScreen
();
center
.
x
=
loc
.
x
+
frame
.
getWidth
()
/
2
;
center
.
y
=
loc
.
y
+
frame
.
getHeight
()
/
2
;
}
private
static
void
dispose
()
{
if
(
frame
!=
null
)
{
frame
.
dispose
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录