Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f5942d67
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看板
提交
f5942d67
编写于
5月 27, 2016
作者:
A
ant
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8145984: [macosx] sun.lwawt.macosx.CAccessible leaks
Reviewed-by: serb, ptbrunet
上级
0d184d68
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
306 addition
and
95 deletion
+306
-95
src/macosx/classes/sun/lwawt/macosx/CAccessibility.java
src/macosx/classes/sun/lwawt/macosx/CAccessibility.java
+29
-1
src/macosx/classes/sun/lwawt/macosx/CAccessibleText.java
src/macosx/classes/sun/lwawt/macosx/CAccessibleText.java
+3
-1
src/macosx/native/sun/awt/AWTView.h
src/macosx/native/sun/awt/AWTView.h
+3
-1
src/macosx/native/sun/awt/AWTView.m
src/macosx/native/sun/awt/AWTView.m
+52
-10
src/macosx/native/sun/awt/JavaAccessibilityAction.m
src/macosx/native/sun/awt/JavaAccessibilityAction.m
+25
-14
src/macosx/native/sun/awt/JavaAccessibilityUtilities.m
src/macosx/native/sun/awt/JavaAccessibilityUtilities.m
+13
-5
src/macosx/native/sun/awt/JavaComponentAccessibility.m
src/macosx/native/sun/awt/JavaComponentAccessibility.m
+139
-40
src/macosx/native/sun/awt/JavaTextAccessibility.m
src/macosx/native/sun/awt/JavaTextAccessibility.m
+26
-11
src/macosx/native/sun/java2d/opengl/CGLLayer.h
src/macosx/native/sun/java2d/opengl/CGLLayer.h
+4
-4
src/macosx/native/sun/java2d/opengl/CGLLayer.m
src/macosx/native/sun/java2d/opengl/CGLLayer.m
+12
-8
未找到文件。
src/macosx/classes/sun/lwawt/macosx/CAccessibility.java
浏览文件 @
f5942d67
/*
* Copyright (c) 2011, 201
5
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
6
, 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
...
...
@@ -25,6 +25,8 @@
package
sun.lwawt.macosx
;
import
sun.lwawt.LWWindowPeer
;
import
java.awt.*
;
import
java.beans.*
;
import
java.lang.reflect.Field
;
...
...
@@ -421,6 +423,8 @@ class CAccessibility implements PropertyChangeListener {
}
public
static
AccessibleAction
getAccessibleAction
(
final
Accessible
a
,
final
Component
c
)
{
if
(
a
==
null
)
return
null
;
return
invokeAndWait
(
new
Callable
<
AccessibleAction
>()
{
public
AccessibleAction
call
()
throws
Exception
{
final
AccessibleContext
ac
=
a
.
getAccessibleContext
();
...
...
@@ -667,4 +671,28 @@ class CAccessibility implements PropertyChangeListener {
}
},
c
);
}
/**
* @return AWTView ptr, a peer of the CPlatformView associated with the toplevel container of the Accessible, if any
*/
private
static
long
getAWTView
(
Accessible
a
)
{
Accessible
ax
=
CAccessible
.
getSwingAccessible
(
a
);
if
(!(
ax
instanceof
Component
))
return
0
;
return
invokeAndWait
(
new
Callable
<
Long
>()
{
public
Long
call
()
throws
Exception
{
Component
cont
=
(
Component
)
ax
;
while
(
cont
!=
null
&&
!(
cont
instanceof
Window
))
{
cont
=
cont
.
getParent
();
}
if
(
cont
!=
null
)
{
LWWindowPeer
peer
=
(
LWWindowPeer
)
cont
.
getPeer
();
if
(
peer
!=
null
)
{
return
((
CPlatformWindow
)
peer
.
getPlatformWindow
()).
getContentView
().
getAWTView
();
}
}
return
0L
;
}
},
(
Component
)
ax
);
}
}
src/macosx/classes/sun/lwawt/macosx/CAccessibleText.java
浏览文件 @
f5942d67
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
6
, 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
...
...
@@ -264,6 +264,8 @@ class CAccessibleText {
final
double
localY
=
boundsUnion
.
getY
();
final
Point
componentLocation
=
ac
.
getAccessibleComponent
().
getLocationOnScreen
();
if
(
componentLocation
==
null
)
return
ret
;
final
double
screenX
=
componentLocation
.
getX
()
+
localX
;
final
double
screenY
=
componentLocation
.
getY
()
+
localY
;
...
...
src/macosx/native/sun/awt/AWTView.h
浏览文件 @
f5942d67
/*
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
6
, 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
...
...
@@ -63,6 +63,8 @@
-
(
void
)
deliverJavaMouseEvent
:
(
NSEvent
*
)
event
;
-
(
jobject
)
awtComponent
:(
JNIEnv
*
)
env
;
+
(
AWTView
*
)
awtView
:(
JNIEnv
*
)
env
ofAccessible
:(
jobject
)
jaccessible
;
// Input method-related events
-
(
void
)
setInputMethod
:(
jobject
)
inputMethod
;
-
(
void
)
abandonInput
;
...
...
src/macosx/native/sun/awt/AWTView.m
浏览文件 @
f5942d67
/*
* Copyright (c) 2011, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
6
, 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
...
...
@@ -35,6 +35,7 @@
#import "LWCToolkit.h"
#import "JavaComponentAccessibility.h"
#import "JavaTextAccessibility.h"
#import "JavaAccessibilityUtilities.h"
#import "GeomUtilities.h"
#import "OSVersion.h"
#import "CGLLayer.h"
...
...
@@ -132,7 +133,7 @@ AWT_ASSERT_APPKIT_THREAD;
self
.
cglLayer
=
nil
;
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnvUncached
];
(
*
env
)
->
DeleteGlobalRef
(
env
,
m_cPlatformView
);
(
*
env
)
->
Delete
Weak
GlobalRef
(
env
,
m_cPlatformView
);
m_cPlatformView
=
NULL
;
if
(
fInputMethodLOCKABLE
!=
NULL
)
...
...
@@ -402,7 +403,12 @@ AWT_ASSERT_APPKIT_THREAD;
static
JNF_CLASS_CACHE
(
jc_PlatformView
,
"sun/lwawt/macosx/CPlatformView"
);
static
JNF_MEMBER_CACHE
(
jm_deliverMouseEvent
,
jc_PlatformView
,
"deliverMouseEvent"
,
"(Lsun/lwawt/macosx/NSEvent;)V"
);
JNFCallVoidMethod
(
env
,
m_cPlatformView
,
jm_deliverMouseEvent
,
jEvent
);
jobject
jlocal
=
(
*
env
)
->
NewLocalRef
(
env
,
m_cPlatformView
);
if
(
!
(
*
env
)
->
IsSameObject
(
env
,
jlocal
,
NULL
))
{
JNFCallVoidMethod
(
env
,
jlocal
,
jm_deliverMouseEvent
,
jEvent
);
(
*
env
)
->
DeleteLocalRef
(
env
,
jlocal
);
}
}
-
(
void
)
resetTrackingArea
{
...
...
@@ -463,7 +469,12 @@ AWT_ASSERT_APPKIT_THREAD;
static
JNF_CLASS_CACHE
(
jc_PlatformView
,
"sun/lwawt/macosx/CPlatformView"
);
static
JNF_MEMBER_CACHE
(
jm_deliverKeyEvent
,
jc_PlatformView
,
"deliverKeyEvent"
,
"(Lsun/lwawt/macosx/NSEvent;)V"
);
JNFCallVoidMethod
(
env
,
m_cPlatformView
,
jm_deliverKeyEvent
,
jevent
);
jobject
jlocal
=
(
*
env
)
->
NewLocalRef
(
env
,
m_cPlatformView
);
if
(
!
(
*
env
)
->
IsSameObject
(
env
,
jlocal
,
NULL
))
{
JNFCallVoidMethod
(
env
,
jlocal
,
jm_deliverKeyEvent
,
jevent
);
(
*
env
)
->
DeleteLocalRef
(
env
,
jlocal
);
}
if
(
characters
!=
NULL
)
{
(
*
env
)
->
DeleteLocalRef
(
env
,
characters
);
...
...
@@ -478,7 +489,12 @@ AWT_ASSERT_APPKIT_THREAD;
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
static
JNF_CLASS_CACHE
(
jc_PlatformView
,
"sun/lwawt/macosx/CPlatformView"
);
static
JNF_MEMBER_CACHE
(
jm_deliverResize
,
jc_PlatformView
,
"deliverResize"
,
"(IIII)V"
);
JNFCallVoidMethod
(
env
,
m_cPlatformView
,
jm_deliverResize
,
x
,
y
,
w
,
h
);
jobject
jlocal
=
(
*
env
)
->
NewLocalRef
(
env
,
m_cPlatformView
);
if
(
!
(
*
env
)
->
IsSameObject
(
env
,
jlocal
,
NULL
))
{
JNFCallVoidMethod
(
env
,
jlocal
,
jm_deliverResize
,
x
,
y
,
w
,
h
);
(
*
env
)
->
DeleteLocalRef
(
env
,
jlocal
);
}
}
...
...
@@ -507,7 +523,12 @@ AWT_ASSERT_APPKIT_THREAD;
*/
static
JNF_CLASS_CACHE
(
jc_CPlatformView
,
"sun/lwawt/macosx/CPlatformView"
);
static
JNF_MEMBER_CACHE
(
jm_deliverWindowDidExposeEvent
,
jc_CPlatformView
,
"deliverWindowDidExposeEvent"
,
"()V"
);
JNFCallVoidMethod
(
env
,
m_cPlatformView
,
jm_deliverWindowDidExposeEvent
);
jobject
jlocal
=
(
*
env
)
->
NewLocalRef
(
env
,
m_cPlatformView
);
if
(
!
(
*
env
)
->
IsSameObject
(
env
,
jlocal
,
NULL
))
{
JNFCallVoidMethod
(
env
,
jlocal
,
jm_deliverWindowDidExposeEvent
);
(
*
env
)
->
DeleteLocalRef
(
env
,
jlocal
);
}
/*
}
*/
...
...
@@ -535,7 +556,13 @@ AWT_ASSERT_APPKIT_THREAD;
}
return
NULL
;
}
jobject
peer
=
JNFGetObjectField
(
env
,
m_cPlatformView
,
jf_Peer
);
jobject
peer
=
NULL
;
jobject
jlocal
=
(
*
env
)
->
NewLocalRef
(
env
,
m_cPlatformView
);
if
(
!
(
*
env
)
->
IsSameObject
(
env
,
jlocal
,
NULL
))
{
peer
=
JNFGetObjectField
(
env
,
jlocal
,
jf_Peer
);
(
*
env
)
->
DeleteLocalRef
(
env
,
jlocal
);
}
static
JNF_CLASS_CACHE
(
jc_LWWindowPeer
,
"sun/lwawt/LWWindowPeer"
);
static
JNF_MEMBER_CACHE
(
jf_Target
,
jc_LWWindowPeer
,
"target"
,
"Ljava/awt/Component;"
);
if
(
peer
==
NULL
)
{
...
...
@@ -543,12 +570,27 @@ AWT_ASSERT_APPKIT_THREAD;
JNFDumpJavaStack
(
env
);
return
NULL
;
}
return
JNFGetObjectField
(
env
,
peer
,
jf_Target
);
jobject
comp
=
JNFGetObjectField
(
env
,
peer
,
jf_Target
);
(
*
env
)
->
DeleteLocalRef
(
env
,
peer
);
return
comp
;
}
+
(
AWTView
*
)
awtView
:(
JNIEnv
*
)
env
ofAccessible
:(
jobject
)
jaccessible
{
static
JNF_STATIC_MEMBER_CACHE
(
jm_getAWTView
,
sjc_CAccessibility
,
"getAWTView"
,
"(Ljavax/accessibility/Accessible;)J"
);
jlong
jptr
=
JNFCallStaticLongMethod
(
env
,
jm_getAWTView
,
jaccessible
);
if
(
jptr
==
0
)
return
nil
;
return
(
AWTView
*
)
jlong_to_ptr
(
jptr
);
}
-
(
id
)
getAxData
:(
JNIEnv
*
)
env
{
return
[[[
JavaComponentAccessibility
alloc
]
initWithParent
:
self
withEnv
:
env
withAccessible
:[
self
awtComponent
:
env
]
withIndex
:
-
1
withView
:
self
withJavaRole
:
nil
]
autorelease
];
jobject
jcomponent
=
[
self
awtComponent
:
env
];
id
ax
=
[[[
JavaComponentAccessibility
alloc
]
initWithParent
:
self
withEnv
:
env
withAccessible
:
jcomponent
withIndex
:
-
1
withView
:
self
withJavaRole
:
nil
]
autorelease
];
(
*
env
)
->
DeleteLocalRef
(
env
,
jcomponent
);
return
ax
;
}
-
(
NSArray
*
)
accessibilityAttributeNames
...
...
@@ -1291,7 +1333,7 @@ Java_sun_lwawt_macosx_CPlatformView_nativeCreateView
JNF_COCOA_ENTER
(
env
);
NSRect
rect
=
NSMakeRect
(
originX
,
originY
,
width
,
height
);
jobject
cPlatformView
=
(
*
env
)
->
NewGlobalRef
(
env
,
obj
);
jobject
cPlatformView
=
(
*
env
)
->
New
Weak
GlobalRef
(
env
,
obj
);
[
ThreadUtilities
performOnMainThreadWaiting
:
YES
block
:
^
(){
...
...
src/macosx/native/sun/awt/JavaAccessibilityAction.m
浏览文件 @
f5942d67
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
6
, 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
...
...
@@ -35,9 +35,9 @@
{
self
=
[
super
init
];
if
(
self
)
{
fAccessibleAction
=
JNFNewGlobalRef
(
env
,
accessibleAction
);
fAccessibleAction
=
JNFNew
Weak
GlobalRef
(
env
,
accessibleAction
);
fIndex
=
index
;
fComponent
=
JNFNewGlobalRef
(
env
,
component
);
fComponent
=
JNFNew
Weak
GlobalRef
(
env
,
component
);
}
return
self
;
}
...
...
@@ -46,10 +46,10 @@
{
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnvUncached
];
JNFDeleteGlobalRef
(
env
,
fAccessibleAction
);
JNFDelete
Weak
GlobalRef
(
env
,
fAccessibleAction
);
fAccessibleAction
=
NULL
;
JNFDeleteGlobalRef
(
env
,
fComponent
);
JNFDelete
Weak
GlobalRef
(
env
,
fComponent
);
fComponent
=
NULL
;
[
super
dealloc
];
...
...
@@ -59,10 +59,10 @@
{
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnvUncached
];
JNFDeleteGlobalRef
(
env
,
fAccessibleAction
);
JNFDelete
Weak
GlobalRef
(
env
,
fAccessibleAction
);
fAccessibleAction
=
NULL
;
JNFDeleteGlobalRef
(
env
,
fComponent
);
JNFDelete
Weak
GlobalRef
(
env
,
fComponent
);
fComponent
=
NULL
;
[
super
finalize
];
...
...
@@ -75,7 +75,18 @@
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
return
JNFJavaToNSString
(
env
,
JNFCallStaticObjectMethod
(
env
,
jm_getAccessibleActionDescription
,
fAccessibleAction
,
fIndex
,
fComponent
));
// AWT_THREADING Safe (AWTRunLoopMode)
jobject
fCompLocal
=
(
*
env
)
->
NewLocalRef
(
env
,
fComponent
);
if
((
*
env
)
->
IsSameObject
(
env
,
fCompLocal
,
NULL
))
{
return
@"unknown"
;
}
NSString
*
str
=
nil
;
jobject
jstr
=
JNFCallStaticObjectMethod
(
env
,
jm_getAccessibleActionDescription
,
fAccessibleAction
,
fIndex
,
fCompLocal
);
if
(
jstr
!=
NULL
)
{
NSString
*
str
=
JNFJavaToNSString
(
env
,
jstr
);
// AWT_THREADING Safe (AWTRunLoopMode)
(
*
env
)
->
DeleteLocalRef
(
env
,
jstr
);
}
(
*
env
)
->
DeleteLocalRef
(
env
,
fCompLocal
);
return
str
==
nil
?
@"unknown"
:
str
;
}
-
(
void
)
perform
...
...
@@ -96,9 +107,9 @@
{
self
=
[
super
init
];
if
(
self
)
{
fTabGroup
=
JNFNewGlobalRef
(
env
,
tabGroup
);
fTabGroup
=
JNFNew
Weak
GlobalRef
(
env
,
tabGroup
);
fIndex
=
index
;
fComponent
=
JNFNewGlobalRef
(
env
,
component
);
fComponent
=
JNFNew
Weak
GlobalRef
(
env
,
component
);
}
return
self
;
}
...
...
@@ -107,10 +118,10 @@
{
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnvUncached
];
JNFDeleteGlobalRef
(
env
,
fTabGroup
);
JNFDelete
Weak
GlobalRef
(
env
,
fTabGroup
);
fTabGroup
=
NULL
;
JNFDeleteGlobalRef
(
env
,
fComponent
);
JNFDelete
Weak
GlobalRef
(
env
,
fComponent
);
fComponent
=
NULL
;
[
super
dealloc
];
...
...
@@ -120,10 +131,10 @@
{
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnvUncached
];
JNFDeleteGlobalRef
(
env
,
fTabGroup
);
JNFDelete
Weak
GlobalRef
(
env
,
fTabGroup
);
fTabGroup
=
NULL
;
JNFDeleteGlobalRef
(
env
,
fComponent
);
JNFDelete
Weak
GlobalRef
(
env
,
fComponent
);
fComponent
=
NULL
;
[
super
finalize
];
...
...
src/macosx/native/sun/awt/JavaAccessibilityUtilities.m
浏览文件 @
f5942d67
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
6
, 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
...
...
@@ -77,7 +77,9 @@ NSString *getJavaRole(JNIEnv *env, jobject axComponent, jobject component)
jobject
axRole
=
JNFCallStaticObjectMethod
(
env
,
sjm_getAccessibleRole
,
axComponent
,
component
);
// AWT_THREADING Safe (AWTRunLoopMode)
if
(
axRole
==
NULL
)
return
@"unknown"
;
return
JNFJavaToNSString
(
env
,
axRole
);
NSString
*
str
=
JNFJavaToNSString
(
env
,
axRole
);
(
*
env
)
->
DeleteLocalRef
(
env
,
axRole
);
return
str
;
}
jobject
getAxSelection
(
JNIEnv
*
env
,
jobject
axContext
,
jobject
component
)
...
...
@@ -126,21 +128,27 @@ BOOL isVertical(JNIEnv *env, jobject axContext, jobject component)
{
static
JNF_STATIC_MEMBER_CACHE
(
jm_VERTICAL
,
sjc_AccessibleState
,
"VERTICAL"
,
"Ljavax/accessibility/AccessibleState;"
);
jobject
axVertState
=
JNFGetStaticObjectField
(
env
,
jm_VERTICAL
);
return
containsAxState
(
env
,
axContext
,
axVertState
,
component
);
BOOL
vertical
=
containsAxState
(
env
,
axContext
,
axVertState
,
component
);
(
*
env
)
->
DeleteLocalRef
(
env
,
axVertState
);
return
vertical
;
}
BOOL
isHorizontal
(
JNIEnv
*
env
,
jobject
axContext
,
jobject
component
)
{
static
JNF_STATIC_MEMBER_CACHE
(
jm_HORIZONTAL
,
sjc_AccessibleState
,
"HORIZONTAL"
,
"Ljavax/accessibility/AccessibleState;"
);
jobject
axHorizState
=
JNFGetStaticObjectField
(
env
,
jm_HORIZONTAL
);
return
containsAxState
(
env
,
axContext
,
axHorizState
,
component
);
BOOL
horizontal
=
containsAxState
(
env
,
axContext
,
axHorizState
,
component
);
(
*
env
)
->
DeleteLocalRef
(
env
,
axHorizState
);
return
horizontal
;
}
BOOL
isShowing
(
JNIEnv
*
env
,
jobject
axContext
,
jobject
component
)
{
static
JNF_STATIC_MEMBER_CACHE
(
jm_SHOWING
,
sjc_AccessibleState
,
"SHOWING"
,
"Ljavax/accessibility/AccessibleState;"
);
jobject
axVisibleState
=
JNFGetStaticObjectField
(
env
,
jm_SHOWING
);
return
containsAxState
(
env
,
axContext
,
axVisibleState
,
component
);
BOOL
showing
=
containsAxState
(
env
,
axContext
,
axVisibleState
,
component
);
(
*
env
)
->
DeleteLocalRef
(
env
,
axVisibleState
);
return
showing
;
}
NSPoint
getAxComponentLocationOnScreen
(
JNIEnv
*
env
,
jobject
axComponent
,
jobject
component
)
...
...
src/macosx/native/sun/awt/JavaComponentAccessibility.m
浏览文件 @
f5942d67
此差异已折叠。
点击以展开。
src/macosx/native/sun/awt/JavaTextAccessibility.m
浏览文件 @
f5942d67
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
6
, 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
...
...
@@ -112,7 +112,9 @@ NSValue *javaIntArrayToNSRangeValue(JNIEnv* env, jintArray array) {
// if it's static text, the AppKit AXValue is the java accessibleName
jobject
axName
=
JNFCallStaticObjectMethod
(
env
,
sjm_getAccessibleName
,
fAccessible
,
fComponent
);
// AWT_THREADING Safe (AWTRunLoop)
if
(
axName
!=
NULL
)
{
return
JNFJavaToNSString
(
env
,
axName
);
NSString
*
str
=
JNFJavaToNSString
(
env
,
axName
);
(
*
env
)
->
DeleteLocalRef
(
env
,
axName
);
return
str
;
}
// value is still nil if no accessibleName for static text. Below, try to get the accessibleText.
}
...
...
@@ -120,12 +122,18 @@ NSValue *javaIntArrayToNSRangeValue(JNIEnv* env, jintArray array) {
// cmcnote: inefficient to make three distinct JNI calls. Coalesce. radr://3951923
jobject
axText
=
JNFCallStaticObjectMethod
(
env
,
sjm_getAccessibleText
,
fAccessible
,
fComponent
);
// AWT_THREADING Safe (AWTRunLoop)
if
(
axText
==
NULL
)
return
nil
;
(
*
env
)
->
DeleteLocalRef
(
env
,
axText
);
jobject
axEditableText
=
JNFCallStaticObjectMethod
(
env
,
sjm_getAccessibleEditableText
,
fAccessible
,
fComponent
);
// AWT_THREADING Safe (AWTRunLoop)
if
(
axEditableText
==
NULL
)
return
nil
;
static
JNF_STATIC_MEMBER_CACHE
(
jm_getTextRange
,
sjc_CAccessibleText
,
"getTextRange"
,
"(Ljavax/accessibility/AccessibleEditableText;IILjava/awt/Component;)Ljava/lang/String;"
);
NSString
*
string
=
JNFJavaToNSString
(
env
,
JNFCallStaticObjectMethod
(
env
,
jm_getTextRange
,
axEditableText
,
0
,
getAxTextCharCount
(
env
,
axEditableText
,
fComponent
),
fComponent
));
// AWT_THREADING Safe (AWTRunLoop)
jobject
jrange
=
JNFCallStaticObjectMethod
(
env
,
jm_getTextRange
,
axEditableText
,
0
,
getAxTextCharCount
(
env
,
axEditableText
,
fComponent
),
fComponent
);
NSString
*
string
=
JNFJavaToNSString
(
env
,
jrange
);
// AWT_THREADING Safe (AWTRunLoop)
(
*
env
)
->
DeleteLocalRef
(
env
,
jrange
);
(
*
env
)
->
DeleteLocalRef
(
env
,
axEditableText
);
if
(
string
==
nil
)
string
=
@""
;
return
string
;
}
...
...
@@ -139,6 +147,7 @@ NSValue *javaIntArrayToNSRangeValue(JNIEnv* env, jintArray array) {
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
jobject
axEditableText
=
JNFCallStaticObjectMethod
(
env
,
sjm_getAccessibleEditableText
,
fAccessible
,
fComponent
);
// AWT_THREADING Safe (AWTRunLoop)
if
(
axEditableText
==
NULL
)
return
NO
;
(
*
env
)
->
DeleteLocalRef
(
env
,
axEditableText
);
return
YES
;
}
...
...
@@ -157,7 +166,9 @@ NSValue *javaIntArrayToNSRangeValue(JNIEnv* env, jintArray array) {
static
JNF_STATIC_MEMBER_CACHE
(
jm_getSelectedText
,
sjc_CAccessibleText
,
"getSelectedText"
,
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;)Ljava/lang/String;"
);
jobject
axText
=
JNFCallStaticObjectMethod
(
env
,
jm_getSelectedText
,
fAccessible
,
fComponent
);
// AWT_THREADING Safe (AWTRunLoop)
if
(
axText
==
NULL
)
return
@""
;
return
JNFJavaToNSString
(
env
,
axText
);
NSString
*
str
=
JNFJavaToNSString
(
env
,
axText
);
(
*
env
)
->
DeleteLocalRef
(
env
,
axText
);
return
str
;
}
-
(
BOOL
)
accessibilityIsSelectedTextAttributeSettable
...
...
@@ -220,7 +231,9 @@ NSValue *javaIntArrayToNSRangeValue(JNIEnv* env, jintArray array) {
// also, static text doesn't always have accessibleText. if axText is null, should get the charcount of the accessibleName instead
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
jobject
axText
=
JNFCallStaticObjectMethod
(
env
,
sjm_getAccessibleText
,
fAccessible
,
fComponent
);
// AWT_THREADING Safe (AWTRunLoop)
return
[
NSNumber
numberWithInt
:
getAxTextCharCount
(
env
,
axText
,
fComponent
)];
NSNumber
*
num
=
[
NSNumber
numberWithInt
:
getAxTextCharCount
(
env
,
axText
,
fComponent
)];
(
*
env
)
->
DeleteLocalRef
(
env
,
axText
);
return
num
;
}
-
(
BOOL
)
accessibilityIsNumberOfCharactersAttributeSettable
...
...
@@ -285,7 +298,7 @@ NSValue *javaIntArrayToNSRangeValue(JNIEnv* env, jintArray array) {
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
static
JNF_STATIC_MEMBER_CACHE
(
jm_getBoundsForRange
,
sjc_CAccessibleText
,
"getBoundsForRange"
,
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;II)[D"
);
jdoubleArray
axBounds
=
JNFCallStaticObjectMethod
(
env
,
jm_getBoundsForRange
,
fAccessible
,
fComponent
,
range
.
location
,
range
.
length
);
// AWT_THREADING Safe (AWTRunLoop)
jdoubleArray
axBounds
=
(
jdoubleArray
)
JNFCallStaticObjectMethod
(
env
,
jm_getBoundsForRange
,
fAccessible
,
fComponent
,
range
.
location
,
range
.
length
);
// AWT_THREADING Safe (AWTRunLoop)
if
(
axBounds
==
NULL
)
return
nil
;
// We cheat because we know that the array is 4 elements long (x, y, width, height)
...
...
@@ -324,7 +337,7 @@ NSValue *javaIntArrayToNSRangeValue(JNIEnv* env, jintArray array) {
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
static
JNF_STATIC_MEMBER_CACHE
(
jm_getRangeForLine
,
sjc_CAccessibleText
,
"getRangeForLine"
,
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;I)[I"
);
jintArray
axTextRange
=
JNFCallStaticObjectMethod
(
env
,
jm_getRangeForLine
,
fAccessible
,
fComponent
,
[
line
intValue
]);
// AWT_THREADING Safe (AWTRunLoop)
jintArray
axTextRange
=
(
jintArray
)
JNFCallStaticObjectMethod
(
env
,
jm_getRangeForLine
,
fAccessible
,
fComponent
,
[
line
intValue
]);
// AWT_THREADING Safe (AWTRunLoop)
if
(
axTextRange
==
NULL
)
return
nil
;
return
javaIntArrayToNSRangeValue
(
env
,
axTextRange
);
...
...
@@ -350,10 +363,12 @@ NSValue *javaIntArrayToNSRangeValue(JNIEnv* env, jintArray array) {
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
static
JNF_STATIC_MEMBER_CACHE
(
jm_getStringForRange
,
sjc_CAccessibleText
,
"getStringForRange"
,
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;II)Ljava/lang/String;"
);
jstring
jstringForRange
=
JNFCallStaticObjectMethod
(
env
,
jm_getStringForRange
,
fAccessible
,
fComponent
,
range
.
location
,
range
.
length
);
// AWT_THREADING Safe (AWTRunLoop)
jstring
jstringForRange
=
(
jstring
)
JNFCallStaticObjectMethod
(
env
,
jm_getStringForRange
,
fAccessible
,
fComponent
,
range
.
location
,
range
.
length
);
// AWT_THREADING Safe (AWTRunLoop)
if
(
jstringForRange
==
NULL
)
return
@""
;
return
JNFJavaToNSString
(
env
,
jstringForRange
);
NSString
*
str
=
JNFJavaToNSString
(
env
,
jstringForRange
);
(
*
env
)
->
DeleteLocalRef
(
env
,
jstringForRange
);
return
str
;
}
//
...
...
@@ -406,7 +421,7 @@ NSValue *javaIntArrayToNSRangeValue(JNIEnv* env, jintArray array) {
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
static
JNF_STATIC_MEMBER_CACHE
(
jm_getRangeForIndex
,
sjc_CAccessibleText
,
"getRangeForIndex"
,
"(Ljavax/accessibility/Accessible;Ljava/awt/Component;I)[I"
);
jintArray
axTextRange
=
JNFCallStaticObjectMethod
(
env
,
jm_getRangeForIndex
,
fAccessible
,
fComponent
,
index
);
// AWT_THREADING Safe (AWTRunLoop)
jintArray
axTextRange
=
(
jintArray
)
JNFCallStaticObjectMethod
(
env
,
jm_getRangeForIndex
,
fAccessible
,
fComponent
,
index
);
// AWT_THREADING Safe (AWTRunLoop)
if
(
axTextRange
==
NULL
)
return
nil
;
return
javaIntArrayToNSRangeValue
(
env
,
axTextRange
);
...
...
src/macosx/native/sun/java2d/opengl/CGLLayer.h
浏览文件 @
f5942d67
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
6
, 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
...
...
@@ -31,7 +31,7 @@
@interface
CGLLayer
:
CAOpenGLLayer
{
@private
JNFJObjectWrapper
*
javaLayer
;
JNF
Weak
JObjectWrapper
*
javaLayer
;
// intermediate buffer, used the RQ lock to synchronize
GLuint
textureID
;
...
...
@@ -45,7 +45,7 @@
#endif
/* REMOTELAYER */
}
@property
(
nonatomic
,
retain
)
JNFJObjectWrapper
*
javaLayer
;
@property
(
nonatomic
,
retain
)
JNF
Weak
JObjectWrapper
*
javaLayer
;
@property
(
readwrite
,
assign
)
GLuint
textureID
;
@property
(
readwrite
,
assign
)
GLenum
target
;
@property
(
readwrite
,
assign
)
float
textureWidth
;
...
...
@@ -57,7 +57,7 @@
@property
(
nonatomic
,
retain
)
NSObject
<
JRSRemoteLayer
>
*
jrsRemoteLayer
;
#endif
-
(
id
)
initWithJavaLayer
:(
JNFJObjectWrapper
*
)
javaLayer
;
-
(
id
)
initWithJavaLayer
:(
JNF
Weak
JObjectWrapper
*
)
javaLayer
;
-
(
void
)
blitTexture
;
@end
...
...
src/macosx/native/sun/java2d/opengl/CGLLayer.m
浏览文件 @
f5942d67
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
6
, 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
...
...
@@ -46,7 +46,7 @@ extern NSOpenGLContext *sharedContext;
@synthesize
jrsRemoteLayer
;
#endif
-
(
id
)
initWithJavaLayer
:(
JNFJObjectWrapper
*
)
layer
;
-
(
id
)
initWithJavaLayer
:(
JNF
Weak
JObjectWrapper
*
)
layer
;
{
AWT_ASSERT_APPKIT_THREAD
;
// Initialize ourselves
...
...
@@ -133,6 +133,15 @@ AWT_ASSERT_APPKIT_THREAD;
{
AWT_ASSERT_APPKIT_THREAD
;
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
static
JNF_CLASS_CACHE
(
jc_JavaLayer
,
"sun/java2d/opengl/CGLLayer"
);
static
JNF_MEMBER_CACHE
(
jm_drawInCGLContext
,
jc_JavaLayer
,
"drawInCGLContext"
,
"()V"
);
jobject
javaLayerLocalRef
=
[
self
.
javaLayer
jObjectWithEnv
:
env
];
if
((
*
env
)
->
IsSameObject
(
env
,
javaLayerLocalRef
,
NULL
))
{
return
;
}
// Set the current context to the one given to us.
CGLSetCurrentContext
(
glContext
);
...
...
@@ -141,12 +150,7 @@ AWT_ASSERT_APPKIT_THREAD;
glClear
(
GL_COLOR_BUFFER_BIT
);
glViewport
(
0
,
0
,
textureWidth
,
textureHeight
);
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
static
JNF_CLASS_CACHE
(
jc_JavaLayer
,
"sun/java2d/opengl/CGLLayer"
);
static
JNF_MEMBER_CACHE
(
jm_drawInCGLContext
,
jc_JavaLayer
,
"drawInCGLContext"
,
"()V"
);
jobject
javaLayerLocalRef
=
[
self
.
javaLayer
jObjectWithEnv
:
env
];
JNFCallVoidMethod
(
env
,
javaLayerLocalRef
,
jm_drawInCGLContext
);
(
*
env
)
->
DeleteLocalRef
(
env
,
javaLayerLocalRef
);
...
...
@@ -171,7 +175,7 @@ Java_sun_java2d_opengl_CGLLayer_nativeCreateLayer
JNF_COCOA_ENTER
(
env
);
JNF
JObjectWrapper
*
javaLayer
=
[
JNF
JObjectWrapper
wrapperWithJObject
:
obj
withEnv
:
env
];
JNF
WeakJObjectWrapper
*
javaLayer
=
[
JNFWeak
JObjectWrapper
wrapperWithJObject
:
obj
withEnv
:
env
];
[
ThreadUtilities
performOnMainThreadWaiting
:
YES
block
:
^
(){
AWT_ASSERT_APPKIT_THREAD
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录