Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
6fcb4525
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看板
提交
6fcb4525
编写于
5月 17, 2013
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
85ec31a6
e8925c79
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
291 addition
and
28 deletion
+291
-28
make/sun/awt/mapfile-vers
make/sun/awt/mapfile-vers
+1
-0
make/sun/awt/mapfile-vers-bsd
make/sun/awt/mapfile-vers-bsd
+1
-0
make/sun/awt/mapfile-vers-linux
make/sun/awt/mapfile-vers-linux
+1
-0
makefiles/mapfiles/libawt/mapfile-vers
makefiles/mapfiles/libawt/mapfile-vers
+1
-0
makefiles/mapfiles/libawt/mapfile-vers-linux
makefiles/mapfiles/libawt/mapfile-vers-linux
+1
-0
src/macosx/classes/sun/lwawt/LWScrollBarPeer.java
src/macosx/classes/sun/lwawt/LWScrollBarPeer.java
+3
-1
src/macosx/classes/sun/lwawt/LWToolkit.java
src/macosx/classes/sun/lwawt/LWToolkit.java
+39
-1
src/macosx/native/sun/awt/AWTSurfaceLayers.m
src/macosx/native/sun/awt/AWTSurfaceLayers.m
+7
-8
src/macosx/native/sun/java2d/opengl/CGLLayer.m
src/macosx/native/sun/java2d/opengl/CGLLayer.m
+3
-1
src/share/classes/java/awt/Component.java
src/share/classes/java/awt/Component.java
+11
-0
src/share/classes/java/awt/Container.java
src/share/classes/java/awt/Container.java
+35
-4
src/share/classes/sun/swing/JLightweightFrame.java
src/share/classes/sun/swing/JLightweightFrame.java
+62
-10
test/java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java
...awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java
+103
-0
test/java/awt/TrayIcon/DragEventSource/DragEventSource.java
test/java/awt/TrayIcon/DragEventSource/DragEventSource.java
+18
-3
test/java/awt/datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java
.../awt/datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java
+5
-0
未找到文件。
make/sun/awt/mapfile-vers
浏览文件 @
6fcb4525
...
@@ -87,6 +87,7 @@ SUNWprivate_1.1 {
...
@@ -87,6 +87,7 @@ SUNWprivate_1.1 {
Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo;
Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo;
Java_java_awt_Dimension_initIDs;
Java_java_awt_Dimension_initIDs;
Java_java_awt_Choice_initIDs;
Java_java_awt_event_MouseEvent_initIDs;
Java_java_awt_event_MouseEvent_initIDs;
Java_java_awt_image_DataBufferInt_initIDs;
Java_java_awt_image_DataBufferInt_initIDs;
Java_java_awt_image_SinglePixelPackedSampleModel_initIDs;
Java_java_awt_image_SinglePixelPackedSampleModel_initIDs;
...
...
make/sun/awt/mapfile-vers-bsd
浏览文件 @
6fcb4525
...
@@ -87,6 +87,7 @@ SUNWprivate_1.1 {
...
@@ -87,6 +87,7 @@ SUNWprivate_1.1 {
Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo;
Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo;
Java_java_awt_Dimension_initIDs;
Java_java_awt_Dimension_initIDs;
Java_java_awt_Choice_initIDs;
Java_java_awt_event_MouseEvent_initIDs;
Java_java_awt_event_MouseEvent_initIDs;
Java_java_awt_image_DataBufferInt_initIDs;
Java_java_awt_image_DataBufferInt_initIDs;
Java_java_awt_image_SinglePixelPackedSampleModel_initIDs;
Java_java_awt_image_SinglePixelPackedSampleModel_initIDs;
...
...
make/sun/awt/mapfile-vers-linux
浏览文件 @
6fcb4525
...
@@ -87,6 +87,7 @@ SUNWprivate_1.1 {
...
@@ -87,6 +87,7 @@ SUNWprivate_1.1 {
Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo;
Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo;
Java_java_awt_Dimension_initIDs;
Java_java_awt_Dimension_initIDs;
Java_java_awt_Choice_initIDs;
Java_java_awt_event_MouseEvent_initIDs;
Java_java_awt_event_MouseEvent_initIDs;
Java_java_awt_image_DataBufferInt_initIDs;
Java_java_awt_image_DataBufferInt_initIDs;
Java_java_awt_image_SinglePixelPackedSampleModel_initIDs;
Java_java_awt_image_SinglePixelPackedSampleModel_initIDs;
...
...
makefiles/mapfiles/libawt/mapfile-vers
浏览文件 @
6fcb4525
...
@@ -86,6 +86,7 @@ SUNWprivate_1.1 {
...
@@ -86,6 +86,7 @@ SUNWprivate_1.1 {
Java_sun_java2d_pipe_ShapeSpanIterator_setRule;
Java_sun_java2d_pipe_ShapeSpanIterator_setRule;
Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo;
Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo;
Java_java_awt_Choice_initIDs;
Java_java_awt_Dimension_initIDs;
Java_java_awt_Dimension_initIDs;
Java_java_awt_event_MouseEvent_initIDs;
Java_java_awt_event_MouseEvent_initIDs;
Java_java_awt_image_DataBufferInt_initIDs;
Java_java_awt_image_DataBufferInt_initIDs;
...
...
makefiles/mapfiles/libawt/mapfile-vers-linux
浏览文件 @
6fcb4525
...
@@ -86,6 +86,7 @@ SUNWprivate_1.1 {
...
@@ -86,6 +86,7 @@ SUNWprivate_1.1 {
Java_sun_java2d_pipe_ShapeSpanIterator_setRule;
Java_sun_java2d_pipe_ShapeSpanIterator_setRule;
Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo;
Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo;
Java_java_awt_Choice_initIDs;
Java_java_awt_Dimension_initIDs;
Java_java_awt_Dimension_initIDs;
Java_java_awt_event_MouseEvent_initIDs;
Java_java_awt_event_MouseEvent_initIDs;
Java_java_awt_image_DataBufferInt_initIDs;
Java_java_awt_image_DataBufferInt_initIDs;
...
...
src/macosx/classes/sun/lwawt/LWScrollBarPeer.java
浏览文件 @
6fcb4525
/*
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
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
...
@@ -56,6 +56,8 @@ final class LWScrollBarPeer extends LWComponentPeer<Scrollbar, JScrollBar>
...
@@ -56,6 +56,8 @@ final class LWScrollBarPeer extends LWComponentPeer<Scrollbar, JScrollBar>
void
initializeImpl
()
{
void
initializeImpl
()
{
super
.
initializeImpl
();
super
.
initializeImpl
();
final
Scrollbar
target
=
getTarget
();
final
Scrollbar
target
=
getTarget
();
setLineIncrement
(
target
.
getUnitIncrement
());
setPageIncrement
(
target
.
getBlockIncrement
());
setValues
(
target
.
getValue
(),
target
.
getVisibleAmount
(),
setValues
(
target
.
getValue
(),
target
.
getVisibleAmount
(),
target
.
getMinimum
(),
target
.
getMaximum
());
target
.
getMinimum
(),
target
.
getMaximum
());
...
...
src/macosx/classes/sun/lwawt/LWToolkit.java
浏览文件 @
6fcb4525
...
@@ -53,7 +53,12 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
...
@@ -53,7 +53,12 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
private
Clipboard
clipboard
;
private
Clipboard
clipboard
;
private
MouseInfoPeer
mouseInfoPeer
;
private
MouseInfoPeer
mouseInfoPeer
;
public
LWToolkit
()
{
/**
* Dynamic Layout Resize client code setting.
*/
private
volatile
boolean
dynamicLayoutSetting
=
true
;
protected
LWToolkit
()
{
}
}
/*
/*
...
@@ -561,4 +566,37 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
...
@@ -561,4 +566,37 @@ public abstract class LWToolkit extends SunToolkit implements Runnable {
((
LWWindowPeer
)
w
.
getPeer
()).
ungrab
(
false
);
((
LWWindowPeer
)
w
.
getPeer
()).
ungrab
(
false
);
}
}
}
}
@Override
protected
final
Object
lazilyLoadDesktopProperty
(
final
String
name
)
{
if
(
name
.
equals
(
"awt.dynamicLayoutSupported"
))
{
return
isDynamicLayoutSupported
();
}
return
super
.
lazilyLoadDesktopProperty
(
name
);
}
@Override
public
final
void
setDynamicLayout
(
final
boolean
dynamic
)
{
dynamicLayoutSetting
=
dynamic
;
}
@Override
protected
final
boolean
isDynamicLayoutSet
()
{
return
dynamicLayoutSetting
;
}
@Override
public
final
boolean
isDynamicLayoutActive
()
{
// "Live resizing" is active by default and user's data is ignored.
return
isDynamicLayoutSupported
();
}
/**
* Returns true if dynamic layout of Containers on resize is supported by
* the underlying operating system and/or window manager.
*/
protected
final
boolean
isDynamicLayoutSupported
()
{
// "Live resizing" is supported by default.
return
true
;
}
}
}
src/macosx/native/sun/awt/AWTSurfaceLayers.m
浏览文件 @
6fcb4525
/*
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
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
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#import "LWCToolkit.h"
#import "LWCToolkit.h"
#import <JavaNativeFoundation/JavaNativeFoundation.h>
#import <JavaNativeFoundation/JavaNativeFoundation.h>
#import <QuartzCore/CATransaction.h>
@implementation
AWTSurfaceLayers
@implementation
AWTSurfaceLayers
...
@@ -74,14 +75,12 @@
...
@@ -74,14 +75,12 @@
}
}
-
(
void
)
setBounds
:(
CGRect
)
rect
{
-
(
void
)
setBounds
:(
CGRect
)
rect
{
layer
.
anchorPoint
=
CGPointMake
(
0
,
0
);
// translates values to the coordinate system of the "root" layer
// translates values to the coordinate system of the "root" layer
CGFloat
newY
=
windowLayer
.
bounds
.
size
.
height
-
rect
.
origin
.
y
-
rect
.
size
.
height
;
rect
.
origin
.
y
=
windowLayer
.
bounds
.
size
.
height
-
rect
.
origin
.
y
-
rect
.
size
.
height
;
CGRect
newRect
=
CGRectMake
(
rect
.
origin
.
x
,
newY
,
rect
.
size
.
width
,
rect
.
size
.
height
)
;
[
CATransaction
begin
]
;
[
CATransaction
setDisableActions
:
YES
];
layer
.
frame
=
newR
ect
;
layer
.
frame
=
r
ect
;
[
CATransaction
commit
];
[
AWTSurfaceLayers
repaintLayersRecursively
:
layer
];
[
AWTSurfaceLayers
repaintLayersRecursively
:
layer
];
}
}
...
...
src/macosx/native/sun/java2d/opengl/CGLLayer.m
浏览文件 @
6fcb4525
/*
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2013,
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
...
@@ -64,11 +64,13 @@ AWT_ASSERT_APPKIT_THREAD;
...
@@ -64,11 +64,13 @@ AWT_ASSERT_APPKIT_THREAD;
//Disable CALayer's default animation
//Disable CALayer's default animation
NSMutableDictionary
*
actions
=
[[
NSMutableDictionary
alloc
]
initWithObjectsAndKeys
:
NSMutableDictionary
*
actions
=
[[
NSMutableDictionary
alloc
]
initWithObjectsAndKeys
:
[
NSNull
null
],
@"anchorPoint"
,
[
NSNull
null
],
@"bounds"
,
[
NSNull
null
],
@"bounds"
,
[
NSNull
null
],
@"contents"
,
[
NSNull
null
],
@"contents"
,
[
NSNull
null
],
@"contentsScale"
,
[
NSNull
null
],
@"contentsScale"
,
[
NSNull
null
],
@"onOrderIn"
,
[
NSNull
null
],
@"onOrderIn"
,
[
NSNull
null
],
@"onOrderOut"
,
[
NSNull
null
],
@"onOrderOut"
,
[
NSNull
null
],
@"position"
,
[
NSNull
null
],
@"sublayers"
,
[
NSNull
null
],
@"sublayers"
,
nil
];
nil
];
self
.
actions
=
actions
;
self
.
actions
=
actions
;
...
...
src/share/classes/java/awt/Component.java
浏览文件 @
6fcb4525
...
@@ -1671,6 +1671,15 @@ public abstract class Component implements ImageObserver, MenuContainer,
...
@@ -1671,6 +1671,15 @@ public abstract class Component implements ImageObserver, MenuContainer,
/* do nothing */
/* do nothing */
}
}
/*
* Delete references from LightweithDispatcher of a heavyweight parent
*/
void
clearLightweightDispatcherOnRemove
(
Component
removedComponent
)
{
if
(
parent
!=
null
)
{
parent
.
clearLightweightDispatcherOnRemove
(
removedComponent
);
}
}
/**
/**
* @deprecated As of JDK version 1.1,
* @deprecated As of JDK version 1.1,
* replaced by <code>setVisible(boolean)</code>.
* replaced by <code>setVisible(boolean)</code>.
...
@@ -6974,6 +6983,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
...
@@ -6974,6 +6983,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
}
synchronized
(
getTreeLock
())
{
synchronized
(
getTreeLock
())
{
clearLightweightDispatcherOnRemove
(
this
);
if
(
isFocusOwner
()
&&
KeyboardFocusManager
.
isAutoFocusTransferEnabledFor
(
this
))
{
if
(
isFocusOwner
()
&&
KeyboardFocusManager
.
isAutoFocusTransferEnabledFor
(
this
))
{
transferFocus
(
true
);
transferFocus
(
true
);
}
}
...
...
src/share/classes/java/awt/Container.java
浏览文件 @
6fcb4525
...
@@ -3306,6 +3306,16 @@ public class Container extends Component {
...
@@ -3306,6 +3306,16 @@ public class Container extends Component {
}
}
}
}
@Override
void
clearLightweightDispatcherOnRemove
(
Component
removedComponent
)
{
if
(
dispatcher
!=
null
)
{
dispatcher
.
removeReferences
(
removedComponent
);
}
else
{
//It is a Lightweight Container, should clear parent`s Dispatcher
super
.
clearLightweightDispatcherOnRemove
(
removedComponent
);
}
}
final
Container
getTraversalRoot
()
{
final
Container
getTraversalRoot
()
{
if
(
isFocusCycleRoot
())
{
if
(
isFocusCycleRoot
())
{
return
findTraversalRoot
();
return
findTraversalRoot
();
...
@@ -4411,6 +4421,7 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
...
@@ -4411,6 +4421,7 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
//System.out.println("Disposing lw dispatcher");
//System.out.println("Disposing lw dispatcher");
stopListeningForOtherDrags
();
stopListeningForOtherDrags
();
mouseEventTarget
=
null
;
mouseEventTarget
=
null
;
targetLastEntered
=
null
;
}
}
/**
/**
...
@@ -4502,6 +4513,7 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
...
@@ -4502,6 +4513,7 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
// MOUSE_CLICKED.
// MOUSE_CLICKED.
if
(!
isMouseGrab
(
e
)
&&
id
!=
MouseEvent
.
MOUSE_CLICKED
)
{
if
(!
isMouseGrab
(
e
)
&&
id
!=
MouseEvent
.
MOUSE_CLICKED
)
{
mouseEventTarget
=
(
mouseOver
!=
nativeContainer
)
?
mouseOver:
null
;
mouseEventTarget
=
(
mouseOver
!=
nativeContainer
)
?
mouseOver:
null
;
isCleaned
=
false
;
}
}
if
(
mouseEventTarget
!=
null
)
{
if
(
mouseEventTarget
!=
null
)
{
...
@@ -4549,6 +4561,10 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
...
@@ -4549,6 +4561,10 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
if
(
id
!=
MouseEvent
.
MOUSE_WHEEL
)
{
if
(
id
!=
MouseEvent
.
MOUSE_WHEEL
)
{
e
.
consume
();
e
.
consume
();
}
}
}
else
if
(
isCleaned
&&
id
!=
MouseEvent
.
MOUSE_WHEEL
)
{
//After mouseEventTarget was removed and cleaned should consume all events
//until new mouseEventTarget is found
e
.
consume
();
}
}
return
e
.
isConsumed
();
return
e
.
isConsumed
();
}
}
...
@@ -4891,6 +4907,11 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
...
@@ -4891,6 +4907,11 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
*/
*/
private
transient
Component
targetLastEntered
;
private
transient
Component
targetLastEntered
;
/**
* Indicates whether {@code mouseEventTarget} was removed and nulled
*/
private
transient
boolean
isCleaned
;
/**
/**
* Is the mouse over the native container
* Is the mouse over the native container
*/
*/
...
@@ -4925,4 +4946,14 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
...
@@ -4925,4 +4946,14 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
AWTEvent
.
MOUSE_EVENT_MASK
|
AWTEvent
.
MOUSE_EVENT_MASK
|
AWTEvent
.
MOUSE_MOTION_EVENT_MASK
|
AWTEvent
.
MOUSE_MOTION_EVENT_MASK
|
AWTEvent
.
MOUSE_WHEEL_EVENT_MASK
;
AWTEvent
.
MOUSE_WHEEL_EVENT_MASK
;
void
removeReferences
(
Component
removedComponent
)
{
if
(
mouseEventTarget
==
removedComponent
)
{
isCleaned
=
true
;
mouseEventTarget
=
null
;
}
if
(
targetLastEntered
==
removedComponent
)
{
targetLastEntered
=
null
;
}
}
}
}
src/share/classes/sun/swing/JLightweightFrame.java
浏览文件 @
6fcb4525
...
@@ -35,6 +35,7 @@ import java.awt.Graphics2D;
...
@@ -35,6 +35,7 @@ import java.awt.Graphics2D;
import
java.awt.Rectangle
;
import
java.awt.Rectangle
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.DataBufferInt
;
import
java.awt.image.DataBufferInt
;
import
java.security.AccessController
;
import
javax.swing.JLayeredPane
;
import
javax.swing.JLayeredPane
;
import
javax.swing.JPanel
;
import
javax.swing.JPanel
;
...
@@ -43,6 +44,7 @@ import javax.swing.LayoutFocusTraversalPolicy;
...
@@ -43,6 +44,7 @@ import javax.swing.LayoutFocusTraversalPolicy;
import
javax.swing.RootPaneContainer
;
import
javax.swing.RootPaneContainer
;
import
sun.awt.LightweightFrame
;
import
sun.awt.LightweightFrame
;
import
sun.security.action.GetPropertyAction
;
/**
/**
* The frame serves as a lightweight container which paints its content
* The frame serves as a lightweight container which paints its content
...
@@ -65,12 +67,28 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
...
@@ -65,12 +67,28 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
private
BufferedImage
bbImage
;
private
BufferedImage
bbImage
;
/**
* {@code copyBufferEnabled}, true by default, defines the following strategy.
* A duplicating (copy) buffer is created for the original pixel buffer.
* The copy buffer is synchronized with the original buffer every time the
* latter changes. {@code JLightweightFrame} passes the copy buffer array
* to the {@link LightweightContent#imageBufferReset} method. The code spot
* which synchronizes two buffers becomes the only critical section guarded
* by the lock (managed with the {@link LightweightContent#paintLock()},
* {@link LightweightContent#paintUnlock()} methods).
*/
private
boolean
copyBufferEnabled
;
private
int
[]
copyBuffer
;
/**
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
* instance.
*/
*/
public
JLightweightFrame
()
{
public
JLightweightFrame
()
{
super
();
super
();
copyBufferEnabled
=
"true"
.
equals
(
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"jlf.copyBufferEnabled"
,
"true"
)));
add
(
rootPane
,
BorderLayout
.
CENTER
);
add
(
rootPane
,
BorderLayout
.
CENTER
);
setFocusTraversalPolicy
(
new
LayoutFocusTraversalPolicy
());
setFocusTraversalPolicy
(
new
LayoutFocusTraversalPolicy
());
if
(
getGraphicsConfiguration
().
isTranslucencyCapable
())
{
if
(
getGraphicsConfiguration
().
isTranslucencyCapable
())
{
...
@@ -124,16 +142,37 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
...
@@ -124,16 +142,37 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
if
(
content
!=
null
)
content
.
focusUngrabbed
();
if
(
content
!=
null
)
content
.
focusUngrabbed
();
}
}
private
void
syncCopyBuffer
(
boolean
reset
,
int
x
,
int
y
,
int
w
,
int
h
)
{
content
.
paintLock
();
try
{
int
[]
srcBuffer
=
((
DataBufferInt
)
bbImage
.
getRaster
().
getDataBuffer
()).
getData
();
if
(
reset
)
{
copyBuffer
=
new
int
[
srcBuffer
.
length
];
}
int
linestride
=
bbImage
.
getWidth
();
for
(
int
i
=
0
;
i
<
h
;
i
++)
{
int
from
=
(
y
+
i
)
*
linestride
+
x
;
System
.
arraycopy
(
srcBuffer
,
from
,
copyBuffer
,
from
,
w
);
}
}
finally
{
content
.
paintUnlock
();
}
}
private
void
initInterior
()
{
private
void
initInterior
()
{
contentPane
=
new
JPanel
()
{
contentPane
=
new
JPanel
()
{
@Override
@Override
public
void
paint
(
Graphics
g
)
{
public
void
paint
(
Graphics
g
)
{
if
(!
copyBufferEnabled
)
{
content
.
paintLock
();
content
.
paintLock
();
}
try
{
try
{
super
.
paint
(
g
);
super
.
paint
(
g
);
final
Rectangle
clip
=
g
.
getClipBounds
()
!=
null
?
final
Rectangle
clip
=
g
.
getClipBounds
()
!=
null
?
g
.
getClipBounds
()
:
new
Rectangle
(
0
,
0
,
contentPane
.
getWidth
(),
contentPane
.
getHeight
());
g
.
getClipBounds
()
:
new
Rectangle
(
0
,
0
,
contentPane
.
getWidth
(),
contentPane
.
getHeight
());
clip
.
x
=
Math
.
max
(
0
,
clip
.
x
);
clip
.
x
=
Math
.
max
(
0
,
clip
.
x
);
clip
.
y
=
Math
.
max
(
0
,
clip
.
y
);
clip
.
y
=
Math
.
max
(
0
,
clip
.
y
);
...
@@ -143,13 +182,18 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
...
@@ -143,13 +182,18 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
EventQueue
.
invokeLater
(
new
Runnable
()
{
EventQueue
.
invokeLater
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
if
(
copyBufferEnabled
)
{
syncCopyBuffer
(
false
,
clip
.
x
,
clip
.
y
,
clip
.
width
,
clip
.
height
);
}
content
.
imageUpdated
(
clip
.
x
,
clip
.
y
,
clip
.
width
,
clip
.
height
);
content
.
imageUpdated
(
clip
.
x
,
clip
.
y
,
clip
.
width
,
clip
.
height
);
}
}
});
});
}
finally
{
}
finally
{
if
(!
copyBufferEnabled
)
{
content
.
paintUnlock
();
content
.
paintUnlock
();
}
}
}
}
}
@Override
@Override
protected
boolean
isPaintingOrigin
()
{
protected
boolean
isPaintingOrigin
()
{
return
true
;
return
true
;
...
@@ -167,8 +211,9 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
...
@@ -167,8 +211,9 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
if
(
width
==
0
||
height
==
0
)
{
if
(
width
==
0
||
height
==
0
)
{
return
;
return
;
}
}
if
(!
copyBufferEnabled
)
{
content
.
paintLock
();
content
.
paintLock
();
}
try
{
try
{
if
((
bbImage
==
null
)
||
(
width
!=
bbImage
.
getWidth
())
||
(
height
!=
bbImage
.
getHeight
()))
{
if
((
bbImage
==
null
)
||
(
width
!=
bbImage
.
getWidth
())
||
(
height
!=
bbImage
.
getHeight
()))
{
boolean
createBB
=
true
;
boolean
createBB
=
true
;
...
@@ -204,16 +249,23 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
...
@@ -204,16 +249,23 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
oldBB
.
flush
();
oldBB
.
flush
();
}
}
}
}
DataBufferInt
dataBuf
=
(
DataBufferInt
)
bbImage
.
getRaster
().
getDataBuffer
();
int
[]
pixels
=
((
DataBufferInt
)
bbImage
.
getRaster
().
getDataBuffer
()).
getData
();
content
.
imageBufferReset
(
dataBuf
.
getData
(),
0
,
0
,
width
,
height
,
bbImage
.
getWidth
());
if
(
copyBufferEnabled
)
{
}
else
{
syncCopyBuffer
(
true
,
0
,
0
,
width
,
height
);
content
.
imageReshaped
(
0
,
0
,
width
,
height
);
pixels
=
copyBuffer
;
}
content
.
imageBufferReset
(
pixels
,
0
,
0
,
width
,
height
,
bbImage
.
getWidth
());
return
;
}
}
}
}
content
.
imageReshaped
(
0
,
0
,
width
,
height
);
}
finally
{
}
finally
{
if
(!
copyBufferEnabled
)
{
content
.
paintUnlock
();
content
.
paintUnlock
();
}
}
}
}
}
@Override
@Override
public
JRootPane
getRootPane
()
{
public
JRootPane
getRootPane
()
{
...
...
test/java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java
0 → 100644
浏览文件 @
6fcb4525
/*
* Copyright (c) 2013, 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.AWTException
;
import
java.awt.FlowLayout
;
import
java.awt.Robot
;
import
java.lang.ref.Reference
;
import
java.lang.ref.WeakReference
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.swing.JButton
;
import
javax.swing.JFrame
;
import
javax.swing.JPanel
;
import
javax.swing.SwingUtilities
;
import
test.java.awt.regtesthelpers.Util
;
/*
@test
@bug 7079254
@summary Toolkit eventListener leaks memory
@library ../regtesthelpers
@build Util
@compile LWDispatcherMemoryLeakTest.java
@run main/othervm -Xmx10M LWDispatcherMemoryLeakTest
*/
public
class
LWDispatcherMemoryLeakTest
{
private
static
JFrame
frame
;
private
static
WeakReference
<
JButton
>
button
;
private
static
WeakReference
<
JPanel
>
p
;
public
static
void
init
()
throws
Throwable
{
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
frame
=
new
JFrame
();
frame
.
setLayout
(
new
FlowLayout
());
button
=
new
WeakReference
<
JButton
>(
new
JButton
(
"Text"
));
p
=
new
WeakReference
<
JPanel
>(
new
JPanel
(
new
FlowLayout
()));
p
.
get
().
add
(
button
.
get
());
frame
.
add
(
p
.
get
());
frame
.
setBounds
(
500
,
400
,
200
,
200
);
frame
.
setVisible
(
true
);
}
});
Util
.
waitTillShown
(
button
.
get
());
Util
.
clickOnComp
(
button
.
get
(),
new
Robot
());
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
frame
.
remove
(
p
.
get
());
}
});
Util
.
waitForIdle
(
null
);
assertGC
();
}
public
static
void
assertGC
()
throws
Throwable
{
List
<
byte
[]>
alloc
=
new
ArrayList
<
byte
[]>();
int
size
=
10
*
1024
;
while
(
true
)
{
try
{
alloc
.
add
(
new
byte
[
size
]);
}
catch
(
OutOfMemoryError
err
)
{
break
;
}
}
alloc
=
null
;
if
(
button
.
get
()
!=
null
)
{
throw
new
Exception
(
"Test failed: JButton was not collected"
);
}
}
public
static
void
main
(
String
args
[])
throws
Throwable
{
init
();
}
}
test/java/awt/TrayIcon/DragEventSource/DragEventSource.java
浏览文件 @
6fcb4525
/*
/*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007,
2013,
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
...
@@ -64,6 +64,21 @@ public class DragEventSource
...
@@ -64,6 +64,21 @@ public class DragEventSource
}
}
private
static
void
init
()
{
private
static
void
init
()
{
boolean
isSupported
=
SystemTray
.
isSupported
();
System
.
out
.
println
(
"is SysTray Supported: "
+
isSupported
);
if
(!
isSupported
)
{
String
[]
instructions
=
{
"The test cannot be run because SystemTray is not supported."
,
"Simply press PASS button."
};
Sysout
.
createDialog
(
);
Sysout
.
printInstructions
(
instructions
);
return
;
}
String
[]
instructions
=
String
[]
instructions
=
{
{
"Use see a Frame with a button in it."
,
"Use see a Frame with a button in it."
,
...
@@ -79,8 +94,8 @@ public class DragEventSource
...
@@ -79,8 +94,8 @@ public class DragEventSource
frame
.
setLayout
(
new
FlowLayout
());
frame
.
setLayout
(
new
FlowLayout
());
tray
=
SystemTray
.
getSystemTray
();
tray
=
SystemTray
.
getSystemTray
();
boolean
isSupported
=
tray
.
isSupported
();
System
.
out
.
println
(
"is SysTray Supported: "
+
isSupported
);
TrayIcon
icons
[]
=
tray
.
getTrayIcons
();
TrayIcon
icons
[]
=
tray
.
getTrayIcons
();
System
.
out
.
println
(
icons
.
length
);
System
.
out
.
println
(
icons
.
length
);
...
...
test/java/awt/datatransfer/HTMLDataFlavors/HTMLDataFlavorTest.java
浏览文件 @
6fcb4525
...
@@ -43,6 +43,11 @@ public class HTMLDataFlavorTest {
...
@@ -43,6 +43,11 @@ public class HTMLDataFlavorTest {
public
static
void
main
(
String
[]
args
)
throws
IOException
,
UnsupportedFlavorException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
,
UnsupportedFlavorException
{
if
(
sun
.
awt
.
OSInfo
.
getOSType
()
!=
sun
.
awt
.
OSInfo
.
OSType
.
WINDOWS
)
{
System
.
err
.
println
(
"This test is for MS Windows only. Considered passed."
);
return
;
}
dataFlavors
.
put
(
DataFlavor
.
allHtmlFlavor
,
HtmlTransferable
.
ALL_HTML_AS_STRING
);
dataFlavors
.
put
(
DataFlavor
.
allHtmlFlavor
,
HtmlTransferable
.
ALL_HTML_AS_STRING
);
dataFlavors
.
put
(
DataFlavor
.
fragmentHtmlFlavor
,
HtmlTransferable
.
FRAGMENT_HTML_AS_STRING
);
dataFlavors
.
put
(
DataFlavor
.
fragmentHtmlFlavor
,
HtmlTransferable
.
FRAGMENT_HTML_AS_STRING
);
dataFlavors
.
put
(
DataFlavor
.
selectionHtmlFlavor
,
HtmlTransferable
.
SELECTION_HTML_AS_STRING
);
dataFlavors
.
put
(
DataFlavor
.
selectionHtmlFlavor
,
HtmlTransferable
.
SELECTION_HTML_AS_STRING
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录