ordercheck passes.
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@23 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/mac/src/com/google/gwt/dev/shell/mac/BrowserWidgetSaf.java b/dev/mac/src/com/google/gwt/dev/shell/mac/BrowserWidgetSaf.java
index 4f511c4..ff732c0 100644
--- a/dev/mac/src/com/google/gwt/dev/shell/mac/BrowserWidgetSaf.java
+++ b/dev/mac/src/com/google/gwt/dev/shell/mac/BrowserWidgetSaf.java
@@ -31,7 +31,6 @@
* Represents an individual browser window and all of its controls.
*/
public class BrowserWidgetSaf extends BrowserWidget {
- private static final int REDRAW_PERIOD = 250;
private class ExternalObject implements DispatchObject {
public int getField(String name) {
@@ -75,7 +74,6 @@
public void setField(String name, int value) {
}
}
-
private static final class GwtOnLoad implements DispatchMethod {
public int invoke(int execState, int jsthis, int[] jsargs) {
@@ -114,6 +112,12 @@
}
}
+ private static final int REDRAW_PERIOD = 250;
+
+ static {
+ LowLevelSaf.init();
+ }
+
public BrowserWidgetSaf(Shell shell, BrowserWidgetHost host) {
super(shell, host);
@@ -138,11 +142,11 @@
}
});
-
+
/*
- * HACK (knorton) - SWT wrapper on WebKit seems to cause unreliable
- * repaints when the DOM changes inside of WebView. To compensate for this,
- * every quarter second, we tell WebView to repaint itself fully.
+ * HACK (knorton) - SWT wrapper on WebKit seems to cause unreliable repaints
+ * when the DOM changes inside of WebView. To compensate for this, every
+ * quarter second, we tell WebView to repaint itself fully.
*/
getDisplay().timerExec(REDRAW_PERIOD, new Runnable() {
public void run() {
@@ -155,11 +159,7 @@
// Reschedule this object to run again
getDisplay().timerExec(REDRAW_PERIOD, this);
}
- });
- }
-
- static {
- LowLevelSaf.init();
+ });
}
}
diff --git a/dev/mac/src/com/google/gwt/dev/shell/mac/HandleSaf.java b/dev/mac/src/com/google/gwt/dev/shell/mac/HandleSaf.java
index 7303025..47b647a 100644
--- a/dev/mac/src/com/google/gwt/dev/shell/mac/HandleSaf.java
+++ b/dev/mac/src/com/google/gwt/dev/shell/mac/HandleSaf.java
@@ -24,16 +24,20 @@
new HandleSaf();
}
+ public static Object createHandle(Class type, int ptr) {
+ return Handle.createHandle(type, ptr);
+ }
+
+ public static int getJSObjectFromHandle(Object o) {
+ return getPtrFromHandle(o);
+ }
+
/**
* Not instantiable.
*/
private HandleSaf() {
}
- public static Object createHandle(Class type, int ptr) {
- return Handle.createHandle(type, ptr);
- }
-
protected void lockPtr(int ptr) {
LowLevelSaf.gcLock(ptr);
}
@@ -42,8 +46,4 @@
LowLevelSaf.gcUnlock(ptr);
}
- public static int getJSObjectFromHandle(Object o) {
- return getPtrFromHandle(o);
- }
-
}
diff --git a/dev/mac/src/com/google/gwt/dev/shell/mac/LowLevelSaf.java b/dev/mac/src/com/google/gwt/dev/shell/mac/LowLevelSaf.java
index c27af65..12be03b 100644
--- a/dev/mac/src/com/google/gwt/dev/shell/mac/LowLevelSaf.java
+++ b/dev/mac/src/com/google/gwt/dev/shell/mac/LowLevelSaf.java
@@ -28,16 +28,14 @@
public class LowLevelSaf {
/**
- * Provides interface for methods to be exposed
- * on javascript side.
+ * Provides interface for methods to be exposed on javascript side.
*/
public interface DispatchMethod {
int invoke(int execState, int jsthis, int[] jsargs);
}
/**
- * Provides interface for objects to be exposed
- * on javascript side.
+ * Provides interface for objects to be exposed on javascript side.
*/
public interface DispatchObject {
int getField(String name);
@@ -49,6 +47,8 @@
private static boolean sInitialized = false;
+ private static ThreadLocal stateStack = new ThreadLocal();
+
public static boolean coerceToBoolean(int execState, int jsval) {
boolean[] rval = new boolean[1];
if (!_coerceToBoolean(execState, jsval, rval)) {
@@ -184,6 +184,15 @@
_gcUnlock(jsval);
}
+ public static int getExecState() {
+ Stack stack = (Stack) stateStack.get();
+ if (stack == null) {
+ throw new RuntimeException("No thread local execState stack!");
+ }
+ Integer top = (Integer) stack.peek();
+ return top.intValue();
+ }
+
public static int getGlobalExecState(int scriptObject) {
int[] rval = new int[1];
if (!_getGlobalExecState(scriptObject, rval)) {
@@ -192,6 +201,15 @@
return rval[0];
}
+ public static String[] getProcessArgs() {
+ int argc = _getArgc();
+ String[] result = new String[argc];
+ for (int i = 0; i < argc; ++i) {
+ result[i] = _getArgv(i);
+ }
+ return result;
+ }
+
public static synchronized void init() {
// Force LowLevel initialization to load gwt-ll
LowLevel.init();
@@ -205,7 +223,7 @@
} catch (IOException e) {
// ignore problems, failures will occur when the libs try to load
}
-
+
System.load(installPath + '/' + System.mapLibraryName(libName));
if (!_initNative(DispatchObject.class, DispatchMethod.class)) {
throw new RuntimeException("Unable to initialize " + libName);
@@ -313,6 +331,26 @@
_jsUnlock();
}
+ public static void popExecState(int execState) {
+ Stack stack = (Stack) stateStack.get();
+ if (stack == null) {
+ throw new RuntimeException("No thread local execState stack!");
+ }
+ Integer old = (Integer) stack.pop();
+ if (old.intValue() != execState) {
+ throw new RuntimeException("The wrong execState was popped.");
+ }
+ }
+
+ public static void pushExecState(int execState) {
+ Stack stack = (Stack) stateStack.get();
+ if (stack == null) {
+ stack = new Stack();
+ stateStack.set(stack);
+ }
+ stack.push(new Integer(execState));
+ }
+
/**
* Call this to raise an exception in JavaScript before returning control.
*
@@ -399,7 +437,7 @@
private static native void _gcUnlock(int jsval);
private static native int _getArgc();
-
+
private static native String _getArgv(int i);
private static native boolean _getGlobalExecState(int scriptObject, int[] rval);
@@ -436,44 +474,4 @@
private LowLevelSaf() {
}
- public static void pushExecState(int execState) {
- Stack stack = (Stack) stateStack.get();
- if (stack == null) {
- stack = new Stack();
- stateStack.set(stack);
- }
- stack.push(new Integer(execState));
- }
-
- public static void popExecState(int execState) {
- Stack stack = (Stack) stateStack.get();
- if (stack == null) {
- throw new RuntimeException("No thread local execState stack!");
- }
- Integer old = (Integer) stack.pop();
- if (old.intValue() != execState) {
- throw new RuntimeException("The wrong execState was popped.");
- }
- }
-
- public static String[] getProcessArgs() {
- int argc = _getArgc();
- String[] result = new String[argc];
- for (int i = 0; i < argc; ++i) {
- result[i] = _getArgv(i);
- }
- return result;
- }
-
- public static int getExecState() {
- Stack stack = (Stack) stateStack.get();
- if (stack == null) {
- throw new RuntimeException("No thread local execState stack!");
- }
- Integer top = (Integer) stack.peek();
- return top.intValue();
- }
-
- private static ThreadLocal stateStack = new ThreadLocal();
-
}
diff --git a/dev/mac/src/com/google/gwt/dev/shell/mac/MethodDispatch.java b/dev/mac/src/com/google/gwt/dev/shell/mac/MethodDispatch.java
index e133225..968d958 100644
--- a/dev/mac/src/com/google/gwt/dev/shell/mac/MethodDispatch.java
+++ b/dev/mac/src/com/google/gwt/dev/shell/mac/MethodDispatch.java
@@ -28,6 +28,12 @@
*/
class MethodDispatch implements DispatchMethod {
+ private final CompilingClassLoader classLoader;
+
+ private final Method method;
+
+ private final int scriptObject;
+
public MethodDispatch(CompilingClassLoader classLoader, Method method,
int scriptObject) {
this.scriptObject = scriptObject;
@@ -82,8 +88,4 @@
LowLevelSaf.popExecState(execState);
}
}
-
- private final CompilingClassLoader classLoader;
- private final Method method;
- private final int scriptObject;
}
\ No newline at end of file
diff --git a/dev/mac/src/com/google/gwt/dev/shell/mac/ModuleSpaceSaf.java b/dev/mac/src/com/google/gwt/dev/shell/mac/ModuleSpaceSaf.java
index a740b74..cee0000 100644
--- a/dev/mac/src/com/google/gwt/dev/shell/mac/ModuleSpaceSaf.java
+++ b/dev/mac/src/com/google/gwt/dev/shell/mac/ModuleSpaceSaf.java
@@ -24,6 +24,10 @@
*/
public class ModuleSpaceSaf extends ModuleSpace {
+ private DispatchObject staticDispatch;
+
+ private final int window;
+
/**
* Constructs a browser interface for use with a Mozilla global window object.
*/
@@ -32,7 +36,7 @@
// Hang on to the global execution state.
//
- this.fWindow = scriptGlobalObject;
+ this.window = scriptGlobalObject;
LowLevelSaf.gcLock(scriptGlobalObject);
}
@@ -42,12 +46,12 @@
// a new top-level function.
//
String newScript = createNativeMethodInjector(jsniSignature, paramNames, js);
- LowLevelSaf.executeScriptWithInfo(LowLevelSaf.getGlobalExecState(fWindow),
+ LowLevelSaf.executeScriptWithInfo(LowLevelSaf.getGlobalExecState(window),
newScript, file, line);
}
public void dispose() {
- LowLevelSaf.gcUnlock(fWindow);
+ LowLevelSaf.gcUnlock(window);
super.dispose();
}
@@ -172,20 +176,19 @@
}
protected void initializeStaticDispatcher() {
- fStaticDispatch = new WebKitDispatchAdapter(getIsolatedClassLoader(),
- fWindow);
+ staticDispatch = new WebKitDispatchAdapter(getIsolatedClassLoader(), window);
// Define the static dispatcher for use by JavaScript.
//
createNative("initializeStaticDispatcher", 0, "__defineStatic",
new String[] {"__arg0"}, "window.__static = __arg0;");
invokeNativeVoid("__defineStatic", null, new Class[] {Object.class},
- new Object[] {fStaticDispatch});
+ new Object[] {staticDispatch});
}
int wrapObjectAsJSObject(Object o) {
- return SwtWebKitGlue.wrapObjectAsJSObject(getIsolatedClassLoader(),
- fWindow, o);
+ return SwtWebKitGlue.wrapObjectAsJSObject(getIsolatedClassLoader(), window,
+ o);
}
/**
@@ -212,7 +215,7 @@
getIsolatedClassLoader(), types[i], args[i]);
}
- int result = LowLevelSaf.invoke(curExecState, fWindow, name, jsthis, argv);
+ int result = LowLevelSaf.invoke(curExecState, window, name, jsthis, argv);
if (!isExceptionActive()) {
return result;
}
@@ -227,8 +230,4 @@
throw thrown;
}
- private DispatchObject fStaticDispatch;
-
- private final int fWindow;
-
}
diff --git a/dev/mac/src/com/google/gwt/dev/shell/mac/WebKitDispatchAdapter.java b/dev/mac/src/com/google/gwt/dev/shell/mac/WebKitDispatchAdapter.java
index 9cbe2ce..7420ee7 100644
--- a/dev/mac/src/com/google/gwt/dev/shell/mac/WebKitDispatchAdapter.java
+++ b/dev/mac/src/com/google/gwt/dev/shell/mac/WebKitDispatchAdapter.java
@@ -33,18 +33,11 @@
*/
class WebKitDispatchAdapter implements DispatchObject {
- /**
- * This constructor initializes a dispatcher, around a particular instance.
- *
- * @param cl this class's classLoader
- * @param aScriptObject the execution iframe's window
- * @param target the object being wrapped as an IDispatch
- */
- WebKitDispatchAdapter(CompilingClassLoader cl, int scriptObject, Object target) {
- javaDispatch = new JavaDispatchImpl(cl, target);
- this.classLoader = cl;
- this.scriptObject = scriptObject;
- }
+ private final CompilingClassLoader classLoader;
+
+ private final JavaDispatch javaDispatch;
+
+ private final int scriptObject;
/**
* This constructor initializes as the static dispatcher, which handles only
@@ -59,6 +52,19 @@
this.scriptObject = scriptObject;
}
+ /**
+ * This constructor initializes a dispatcher, around a particular instance.
+ *
+ * @param cl this class's classLoader
+ * @param aScriptObject the execution iframe's window
+ * @param target the object being wrapped as an IDispatch
+ */
+ WebKitDispatchAdapter(CompilingClassLoader cl, int scriptObject, Object target) {
+ javaDispatch = new JavaDispatchImpl(cl, target);
+ this.classLoader = cl;
+ this.scriptObject = scriptObject;
+ }
+
public int getField(String name) {
int dispId = classLoader.getDispId(name);
if (dispId < 0) {
@@ -97,8 +103,4 @@
Object val = SwtWebKitGlue.convertJSValToObject(field.getType(), value);
javaDispatch.setFieldValue(dispId, val);
}
-
- private final CompilingClassLoader classLoader;
- private final JavaDispatch javaDispatch;
- private final int scriptObject;
}