src/share/classes/sun/java2d/loops/GraphicsPrimitive.java
Print this page
*** 314,323 ****
--- 314,324 ----
CompositeType comptype,
SurfaceType dsttype);
public abstract GraphicsPrimitive traceWrap();
+ @SuppressWarnings("rawtypes")
static HashMap traceMap;
public static int traceflags;
public static String tracefile;
public static PrintStream traceout;
*** 326,336 ****
public static final int TRACETIMESTAMP = 2;
public static final int TRACECOUNTS = 4;
static {
GetPropertyAction gpa = new GetPropertyAction("sun.java2d.trace");
! String trace = (String)AccessController.doPrivileged(gpa);
if (trace != null) {
boolean verbose = false;
int traceflags = 0;
StringTokenizer st = new StringTokenizer(trace, ",");
while (st.hasMoreTokens()) {
--- 327,337 ----
public static final int TRACETIMESTAMP = 2;
public static final int TRACECOUNTS = 4;
static {
GetPropertyAction gpa = new GetPropertyAction("sun.java2d.trace");
! String trace = AccessController.doPrivileged(gpa);
if (trace != null) {
boolean verbose = false;
int traceflags = 0;
StringTokenizer st = new StringTokenizer(trace, ",");
while (st.hasMoreTokens()) {
*** 389,410 ****
}
private static PrintStream getTraceOutputFile() {
if (traceout == null) {
if (tracefile != null) {
! Object o =
! AccessController.doPrivileged(new PrivilegedAction() {
! public Object run() {
try {
return new FileOutputStream(tracefile);
} catch (FileNotFoundException e) {
return null;
}
}
});
if (o != null) {
! traceout = new PrintStream((OutputStream) o);
} else {
traceout = System.err;
}
} else {
traceout = System.err;
--- 390,411 ----
}
private static PrintStream getTraceOutputFile() {
if (traceout == null) {
if (tracefile != null) {
! FileOutputStream o = AccessController.doPrivileged(
! new PrivilegedAction<FileOutputStream>() {
! public FileOutputStream run() {
try {
return new FileOutputStream(tracefile);
} catch (FileNotFoundException e) {
return null;
}
}
});
if (o != null) {
! traceout = new PrintStream(o);
} else {
traceout = System.err;
}
} else {
traceout = System.err;
*** 413,438 ****
return traceout;
}
public static class TraceReporter extends Thread {
public static void setShutdownHook() {
! AccessController.doPrivileged(new PrivilegedAction() {
! public Object run() {
TraceReporter t = new TraceReporter();
t.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(t);
return null;
}
});
}
public void run() {
PrintStream ps = getTraceOutputFile();
Iterator iterator = traceMap.entrySet().iterator();
long total = 0;
int numprims = 0;
while (iterator.hasNext()) {
Map.Entry me = (Map.Entry) iterator.next();
Object prim = me.getKey();
int[] count = (int[]) me.getValue();
if (count[0] == 1) {
ps.print("1 call to ");
--- 414,441 ----
return traceout;
}
public static class TraceReporter extends Thread {
public static void setShutdownHook() {
! AccessController.doPrivileged(new PrivilegedAction<Void>() {
! public Void run() {
TraceReporter t = new TraceReporter();
t.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(t);
return null;
}
});
}
public void run() {
PrintStream ps = getTraceOutputFile();
+ @SuppressWarnings("rawtypes")
Iterator iterator = traceMap.entrySet().iterator();
long total = 0;
int numprims = 0;
while (iterator.hasNext()) {
+ @SuppressWarnings("rawtypes")
Map.Entry me = (Map.Entry) iterator.next();
Object prim = me.getKey();
int[] count = (int[]) me.getValue();
if (count[0] == 1) {
ps.print("1 call to ");
*** 450,459 ****
--- 453,463 ----
numprims+" different primitives");
}
}
}
+ @SuppressWarnings({ "rawtypes", "unchecked" })
public synchronized static void tracePrimitive(Object prim) {
if ((traceflags & TRACECOUNTS) != 0) {
if (traceMap == null) {
traceMap = new HashMap();
TraceReporter.setShutdownHook();