Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
4eae7ef8
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看板
提交
4eae7ef8
编写于
5月 31, 2016
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8028486: java/awt/Window/WindowsLeak/WindowsLeak.java fails
Reviewed-by: ant, prr
上级
3b71736c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
47 addition
and
43 deletion
+47
-43
src/share/classes/sun/java2d/pipe/BufferedContext.java
src/share/classes/sun/java2d/pipe/BufferedContext.java
+27
-22
test/java/awt/Window/WindowsLeak/WindowsLeak.java
test/java/awt/Window/WindowsLeak/WindowsLeak.java
+20
-21
未找到文件。
src/share/classes/sun/java2d/pipe/BufferedContext.java
浏览文件 @
4eae7ef8
/*
* Copyright (c) 2005, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
...
...
@@ -38,6 +38,8 @@ import static sun.java2d.pipe.BufferedOpCodes.*;
import
static
sun
.
java2d
.
pipe
.
BufferedRenderPipe
.
BYTES_PER_SPAN
;
import
java.lang.annotation.Native
;
import
java.lang.ref.Reference
;
import
java.lang.ref.WeakReference
;
/**
* Base context class for managing state in a single-threaded rendering
...
...
@@ -87,11 +89,11 @@ public abstract class BufferedContext {
*/
protected
static
BufferedContext
currentContext
;
private
AccelSurface
validatedSrcData
;
private
AccelSurface
validatedDstData
;
private
Re
gion
validatedClip
;
private
Composite
validatedComp
;
private
Paint
validatedPaint
;
private
Reference
<
AccelSurface
>
validSrcDataRef
=
new
WeakReference
<>(
null
)
;
private
Reference
<
AccelSurface
>
validDstDataRef
=
new
WeakReference
<>(
null
)
;
private
Re
ference
<
Region
>
validClipRef
=
new
WeakReference
<>(
null
)
;
private
Reference
<
Composite
>
validCompRef
=
new
WeakReference
<>(
null
)
;
private
Reference
<
Paint
>
validPaintRef
=
new
WeakReference
<>(
null
)
;
// renamed from isValidatedPaintAColor as part of a work around for 6764257
private
boolean
isValidatedPaintJustAColor
;
private
int
validatedRGB
;
...
...
@@ -127,9 +129,9 @@ public abstract class BufferedContext {
int
flags
)
{
// assert rq.lock.isHeldByCurrentThread();
BufferedContext
d3dc
=
dstData
.
getContext
();
d3dc
.
validate
(
srcData
,
dstData
,
clip
,
comp
,
xform
,
paint
,
sg2d
,
flags
);
BufferedContext
context
=
dstData
.
getContext
();
context
.
validate
(
srcData
,
dstData
,
clip
,
comp
,
xform
,
paint
,
sg2d
,
flags
);
}
/**
...
...
@@ -200,13 +202,15 @@ public abstract class BufferedContext {
updatePaint
=
true
;
isValidatedPaintJustAColor
=
true
;
}
}
else
if
(
valid
atedPaint
!=
paint
)
{
}
else
if
(
valid
PaintRef
.
get
()
!=
paint
)
{
updatePaint
=
true
;
// this should be set when we are switching from paint to color
// in which case this condition will be true
isValidatedPaintJustAColor
=
false
;
}
final
AccelSurface
validatedSrcData
=
validSrcDataRef
.
get
();
final
AccelSurface
validatedDstData
=
validDstDataRef
.
get
();
if
((
currentContext
!=
this
)
||
(
srcData
!=
validatedSrcData
)
||
(
dstData
!=
validatedDstData
))
...
...
@@ -228,11 +232,12 @@ public abstract class BufferedContext {
setSurfaces
(
srcData
,
dstData
);
currentContext
=
this
;
valid
atedSrcData
=
srcData
;
valid
atedDstData
=
dstData
;
valid
SrcDataRef
=
new
WeakReference
<>(
srcData
)
;
valid
DstDataRef
=
new
WeakReference
<>(
dstData
)
;
}
// validate clip
final
Region
validatedClip
=
validClipRef
.
get
();
if
((
clip
!=
validatedClip
)
||
updateClip
)
{
if
(
clip
!=
null
)
{
if
(
updateClip
||
...
...
@@ -248,13 +253,13 @@ public abstract class BufferedContext {
}
else
{
resetClip
();
}
valid
atedClip
=
clip
;
valid
ClipRef
=
new
WeakReference
<>(
clip
)
;
}
// validate composite (note that a change in the context flags
// may require us to update the composite state, even if the
// composite has not changed)
if
((
comp
!=
valid
atedComp
)
||
(
flags
!=
validatedFlags
))
{
if
((
comp
!=
valid
CompRef
.
get
()
)
||
(
flags
!=
validatedFlags
))
{
if
(
comp
!=
null
)
{
setComposite
(
comp
,
flags
);
}
else
{
...
...
@@ -263,7 +268,7 @@ public abstract class BufferedContext {
// the paint state is dependent on the composite state, so make
// sure we update the color below
updatePaint
=
true
;
valid
atedComp
=
comp
;
valid
CompRef
=
new
WeakReference
<>(
comp
)
;
validatedFlags
=
flags
;
}
...
...
@@ -297,7 +302,7 @@ public abstract class BufferedContext {
}
else
{
BufferedPaints
.
resetPaint
(
rq
);
}
valid
atedPaint
=
paint
;
valid
PaintRef
=
new
WeakReference
<>(
paint
)
;
}
// mark dstData dirty
...
...
@@ -315,9 +320,9 @@ public abstract class BufferedContext {
* @see RenderQueue#lock
* @see RenderQueue#unlock
*/
p
ublic
void
invalidateSurfaces
()
{
valid
atedSrcData
=
null
;
valid
atedDstData
=
null
;
p
rivate
void
invalidateSurfaces
()
{
valid
SrcDataRef
.
clear
()
;
valid
DstDataRef
.
clear
()
;
}
private
void
setSurfaces
(
AccelSurface
srcData
,
...
...
@@ -434,9 +439,9 @@ public abstract class BufferedContext {
resetClip
();
BufferedPaints
.
resetPaint
(
rq
);
invalidateSurfaces
();
valid
atedComp
=
null
;
valid
atedClip
=
null
;
valid
atedPaint
=
null
;
valid
CompRef
.
clear
()
;
valid
ClipRef
.
clear
()
;
valid
PaintRef
.
clear
()
;
isValidatedPaintJustAColor
=
false
;
xformInUse
=
false
;
}
...
...
test/java/awt/Window/WindowsLeak/WindowsLeak.java
浏览文件 @
4eae7ef8
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013,
2016,
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
...
...
@@ -23,41 +23,40 @@
/*
* @test
* @bug 8013563
* @bug 8013563
8028486
* @summary Tests that windows are removed from windows list
* @library /javax/swing/regtesthelpers
* @build Util
* @run main/othervm -Xms32M -Xmx32M WindowsLeak
*/
import
java.awt.
*
;
import
sun.awt.AppContex
t
;
import
java.awt.
Frame
;
import
java.awt.Robo
t
;
import
java.awt.Window
;
import
java.lang.ref.WeakReference
;
import
java.util.Vector
;
import
sun.awt.AppContext
;
import
sun.java2d.Disposer
;
public
class
WindowsLeak
{
public
static
void
main
(
String
[]
args
)
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
private
static
volatile
boolean
disposerPhantomComplete
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Robot
r
=
new
Robot
();
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
Frame
f
=
new
Frame
();
f
.
pack
();
f
.
dispose
();
}
r
.
waitForIdle
();
Disposer
.
addRecord
(
new
Object
(),
()
->
disposerPhantomComplete
=
true
);
Vector
garbage
=
new
Vector
();
while
(
true
)
{
try
{
garbage
.
add
(
new
byte
[
1000
]);
}
catch
(
OutOfMemoryError
e
)
{
break
;
}
while
(!
disposerPhantomComplete
)
{
Util
.
generateOOME
();
}
garbage
=
null
;
Vector
<
WeakReference
<
Window
>>
windowList
=
(
Vector
<
WeakReference
<
Window
>>)
AppContext
.
getAppContext
().
get
(
Window
.
class
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录