Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
655050a6
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看板
提交
655050a6
编写于
2月 13, 2017
作者:
P
prr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8174098: Better image fetching
Reviewed-by: serb, vadim, skoivu
上级
e311e59a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
3 deletion
+30
-3
src/share/classes/sun/awt/image/ImageWatched.java
src/share/classes/sun/awt/image/ImageWatched.java
+30
-3
未找到文件。
src/share/classes/sun/awt/image/ImageWatched.java
浏览文件 @
655050a6
...
...
@@ -29,6 +29,10 @@ import java.lang.ref.WeakReference;
import
java.awt.Image
;
import
java.awt.image.ImageObserver
;
import
java.security.AccessControlContext
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
public
abstract
class
ImageWatched
{
public
static
Link
endlink
=
new
Link
();
...
...
@@ -85,16 +89,26 @@ public abstract class ImageWatched {
}
}
static
class
AccWeakReference
<
T
>
extends
WeakReference
<
T
>
{
private
final
AccessControlContext
acc
;
AccWeakReference
(
T
ref
)
{
super
(
ref
);
acc
=
AccessController
.
getContext
();
}
}
/*
* Standard Link implementation to manage a Weak Reference
* to an ImageObserver.
*/
public
static
class
WeakLink
extends
Link
{
private
WeakReference
<
ImageObserver
>
myref
;
private
final
Acc
WeakReference
<
ImageObserver
>
myref
;
private
Link
next
;
public
WeakLink
(
ImageObserver
obs
,
Link
next
)
{
myref
=
new
WeakReference
<
ImageObserver
>(
obs
);
myref
=
new
Acc
WeakReference
<
ImageObserver
>(
obs
);
this
.
next
=
next
;
}
...
...
@@ -120,6 +134,19 @@ public abstract class ImageWatched {
return
this
;
}
private
static
boolean
update
(
ImageObserver
iw
,
AccessControlContext
acc
,
Image
img
,
int
info
,
int
x
,
int
y
,
int
w
,
int
h
)
{
if
(
acc
!=
null
||
System
.
getSecurityManager
()
!=
null
)
{
return
AccessController
.
doPrivileged
(
(
PrivilegedAction
<
Boolean
>)
()
->
{
return
iw
.
imageUpdate
(
img
,
info
,
x
,
y
,
w
,
h
);
},
acc
);
}
return
false
;
}
public
boolean
newInfo
(
Image
img
,
int
info
,
int
x
,
int
y
,
int
w
,
int
h
)
{
...
...
@@ -129,7 +156,7 @@ public abstract class ImageWatched {
if
(
myiw
==
null
)
{
// My referent is null so we must prune in a second pass.
ret
=
true
;
}
else
if
(
myiw
.
imageUpdate
(
img
,
info
,
x
,
y
,
w
,
h
)
==
false
)
{
}
else
if
(
update
(
myiw
,
myref
.
acc
,
img
,
info
,
x
,
y
,
w
,
h
)
==
false
)
{
// My referent has lost interest so clear it and ask
// for a pruning pass to remove it later.
myref
.
clear
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录