This commit is contained in:
Lana Steuck 2012-04-18 10:16:23 -07:00
commit cc3d72b55f
12 changed files with 262 additions and 33 deletions

View File

@ -62,7 +62,7 @@ FILES_export = \
java/text/Bidi.java \ java/text/Bidi.java \
sun/font/FileFont.java \ sun/font/FileFont.java \
sun/font/FileFontStrike.java \ sun/font/FileFontStrike.java \
sun/font/FontManager.java \ sun/font/SunFontManager.java \
sun/font/GlyphList.java \ sun/font/GlyphList.java \
sun/font/NativeFont.java \ sun/font/NativeFont.java \
sun/font/StrikeCache.java \ sun/font/StrikeCache.java \

View File

@ -52,7 +52,6 @@ include FILES_c.gmk
FILES_export = \ FILES_export = \
java/awt/Font.java \ java/awt/Font.java \
sun/font/FileFont.java \ sun/font/FileFont.java \
sun/font/FontManager.java \
sun/font/GlyphList.java \ sun/font/GlyphList.java \
sun/font/NativeFont.java \ sun/font/NativeFont.java \
sun/font/StrikeCache.java \ sun/font/StrikeCache.java \

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2012, 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
@ -143,6 +143,7 @@ public abstract class ImageWatched {
if (iw != null && !isWatcher(iw)) { if (iw != null && !isWatcher(iw)) {
watcherList = new WeakLink(iw, watcherList); watcherList = new WeakLink(iw, watcherList);
} }
watcherList = watcherList.removeWatcher(null);
} }
public synchronized boolean isWatcher(ImageObserver iw) { public synchronized boolean isWatcher(ImageObserver iw) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2012, 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.
*com.sun.tools.attach.AttachNotSupportedException *com.sun.tools.attach.AttachNotSupportedException
@ -142,17 +142,20 @@ public class JCmd {
// Cast to HotSpotVirtualMachine as this is an // Cast to HotSpotVirtualMachine as this is an
// implementation specific method. // implementation specific method.
HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm; HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm;
try (InputStream in = hvm.executeJCmd(command);) { String lines[] = command .split("\\n");
// read to EOF and just print output for (String line : lines) {
byte b[] = new byte[256]; try (InputStream in = hvm.executeJCmd(line);) {
int n; // read to EOF and just print output
do { byte b[] = new byte[256];
n = in.read(b); int n;
if (n > 0) { do {
String s = new String(b, 0, n, "UTF-8"); n = in.read(b);
System.out.print(s); if (n > 0) {
} String s = new String(b, 0, n, "UTF-8");
} while (n > 0); System.out.print(s);
}
} while (n > 0);
}
} }
vm.detach(); vm.detach();
} }

View File

@ -29,7 +29,7 @@
#include "jlong.h" #include "jlong.h"
#include "sunfontids.h" #include "sunfontids.h"
#include "fontscalerdefs.h" #include "fontscalerdefs.h"
#include "sun_font_FontManager.h" #include "sun_font_SunFontManager.h"
#include "sun_font_NullFontScaler.h" #include "sun_font_NullFontScaler.h"
#include "sun_font_StrikeCache.h" #include "sun_font_StrikeCache.h"

View File

@ -69,20 +69,26 @@ public class XRRenderer implements PixelDrawPipe, PixelFillPipe, ShapeDrawPipe {
} }
public void drawLine(SunGraphics2D sg2d, int x1, int y1, int x2, int y2) { public void drawLine(SunGraphics2D sg2d, int x1, int y1, int x2, int y2) {
try { Region compClip = sg2d.getCompClip();
SunToolkit.awtLock(); int transX1 = x1 + sg2d.transX;
int transY1 = y1 + sg2d.transY;
int transX2 = x2 + sg2d.transX;
int transY2 = y2 + sg2d.transY;
validateSurface(sg2d); // Non clipped fast path
int transx = sg2d.transX; if (compClip.contains(transX1, transY1)
int transy = sg2d.transY; && compClip.contains(transX2, transY2)) {
try {
SunToolkit.awtLock();
XRSurfaceData xrsd = (XRSurfaceData) sg2d.surfaceData; validateSurface(sg2d);
tileManager.addLine(transX1, transY1, transX2, transY2);
tileManager.addLine(x1 + transx, y1 + transy, tileManager.fillMask((XRSurfaceData) sg2d.surfaceData);
x2 + transx, y2 + transy); } finally {
tileManager.fillMask(xrsd); SunToolkit.awtUnlock();
} finally { }
SunToolkit.awtUnlock(); } else {
draw(sg2d, new Line2D.Float(x1, y1, x2, y2));
} }
} }

View File

@ -583,9 +583,6 @@ JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPathNative
} }
#include <dlfcn.h> #include <dlfcn.h>
#if !(defined(__linux__) || defined(MACOSX))
#include <link.h>
#endif
#include "fontconfig.h" #include "fontconfig.h"

View File

@ -28,7 +28,7 @@
#include <stdlib.h> #include <stdlib.h>
#ifndef MACOSX #ifndef MACOSX
#include <link.h> #include <dlfcn.h>
#endif #endif
#include "jvm_md.h" #include "jvm_md.h"
#include "J2D_GL/glx.h" #include "J2D_GL/glx.h"

View File

@ -70,7 +70,6 @@ typedef struct _XRadialGradient {
#ifdef __solaris__ #ifdef __solaris__
/* Solaris 10 will not have these symbols at runtime */ /* Solaris 10 will not have these symbols at runtime */
#include <link.h>
typedef Picture (*XRenderCreateLinearGradientFuncType) typedef Picture (*XRenderCreateLinearGradientFuncType)
(Display *dpy, (Display *dpy,

View File

@ -0,0 +1,59 @@
/*
* Copyright (c) 2012, 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.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.image.ImageConsumer;
import java.awt.Image;
import java.awt.Container;
/* @test 1.0 12/01/17
@bug 7104151
@summary Make sure that we don't leak image observers (or related objects)
@run main/othervm AddNoLeak
@author David Buck
*/
public class AddNoLeak {
public static void main(String[] args) {
System.setProperty("java.awt.headless", "true");
Container cont = new Container();
Image img = cont.createImage(new DummyImageSource());
for(int i=0;i < 15000;i++) {
img.getWidth(new ImageObserver() {
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {return false;}
});
if (i % 100 == 0) {
System.gc();
}
}
}
private static class DummyImageSource implements ImageProducer {
public void addConsumer(ImageConsumer ic){}
public boolean isConsumer(ImageConsumer ic){return false;}
public void removeConsumer(ImageConsumer ic){}
public void startProduction(ImageConsumer ic){}
public void requestTopDownLeftRightResend(ImageConsumer ic){}
}
}

View File

@ -0,0 +1,95 @@
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version
VM.version

View File

@ -0,0 +1,70 @@
#!/bin/sh
#
# Copyright (c) 2012, 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.
#
# @test
# @bug 7154822
# @summary test if we can send a file over 1024 bytes large via jcmd -f
# @author David Buck
#
# @library ../common
# @build SimpleApplication ShutdownSimpleApplication
# @run shell jcmd-big-script.sh
. ${TESTSRC}/../common/CommonSetup.sh
. ${TESTSRC}/../common/ApplicationSetup.sh
# Start application and use PORTFILE for coordination
PORTFILE="${TESTCLASSES}"/shutdown.port
startApplication SimpleApplication "${PORTFILE}"
failed=0;
# -f <script>
rm -f jcmd.out 2>/dev/null
set +e # even if jcmd fails, we do not want abort the script yet.
${JCMD} -J-XX:+UsePerfData $appJavaPid -f ${TESTSRC}/dcmd-big-script.txt > jcmd.out 2>&1
status="$?"
set -e
if [ "$status" != 0 ]; then
echo "jcmd command returned non-zero exit code (status=$status). Failed."
failed=1;
fi
cat jcmd.out
set +e # if the test passes, grep will "fail" with an exit code of 1
grep Exception jcmd.out > /dev/null 2>&1
status="$?"
set -e
if [ "$status" = 0 ]; then
echo "Output of \"jcmd [pid] -f dcmd-big-script.txt\" contains string \"Exception\". Failed."
failed=1;
fi
# clean up
rm -f jcmd.out 2>/dev/null
stopApplication "${PORTFILE}"
waitForApplication
exit $failed