| java.lang.Object com.google.gwt.dev.shell.mac.LowLevelSaf
LowLevelSaf | public class LowLevelSaf (Code) | | Various low-level helper methods for dealing with Safari.
The basic rule is that any JSValue passed to Java code from native code will
always be GC-protected in the native code and Java will always unprotect it
when the value is finalized. It should always be stored in a JsValue object
immediately to make sure it is cleaned up properly when it is no longer
needed. This approach is required to avoid a race condition where the value
is allocated in JNI code but could be garbage collected before Java takes
ownership of the value. Java values passed into JavaScript store a GlobalRef
of a WebKitDispatchAdapter or MethodDispatch objects, which are freed when
the JS value is finalized.
|
Inner Class :public interface DispatchMethod | |
Inner Class :public interface DispatchObject | |
Field Summary | |
final static boolean | debugObjectCreation Flag to enable tracking of object creation sites. |
Method Summary | |
public static boolean | coerceToBoolean(int execState, int jsval) | public static byte | coerceToByte(int execState, int jsval) | public static char | coerceToChar(int execState, int jsval) | public static double | coerceToDouble(int execState, int jsval) | public static float | coerceToFloat(int execState, int jsval) | public static int | coerceToInt(int execState, int jsval) | public static long | coerceToLong(int execState, int jsval) | public static short | coerceToShort(int execState, int jsval) | public static String | coerceToString(int execState, int jsval) | public static int | convertBoolean(boolean v) | public static int | convertDouble(double v) | public static int | convertString(String v) | public static void | executeScript(int execState, String code) Executes JavaScript code. | public static void | executeScriptWithInfo(int execState, String code, String file, int line) Executes JavaScript code, retaining file and line information. | public static void | gcLock(int jsval) | public static void | gcUnlock(int jsval, Throwable creationStackTrace) | public static int | getExecState() | public static int | getGlobalExecState(int scriptObject) | public static String[] | getProcessArgs() | native public static String | getTypeString(int jsval) | public static synchronized void | init() | public static int | invoke(int execState, int scriptObject, String methodName, int jsthis, int[] jsargs) Invokes a method implemented in JavaScript. | native public static boolean | isBoolean(int jsval) | native public static boolean | isNull(int jsval) | native public static boolean | isNumber(int jsval) | public static boolean | isObject(int jsval) | public static boolean | isString(int jsval) | native public static boolean | isUndefined(int jsval) | public static boolean | isWrappedDispatch(int jsval) | public static void | jsLock() Locks the JavaScript interpreter into this thread; prevents the garbage
collector from running. | native public static int | jsNull() | native public static int | jsUndefined() | public static void | jsUnlock() Unlocks the JavaScript interpreter. | public static void | popExecState(int execState) | public static void | pushExecState(int execState) | public static void | raiseJavaScriptException(int execState, int jsval) Call this to raise an exception in JavaScript before returning control. | protected static void | trace(String s) Called from native code to do tracing. | public static DispatchObject | unwrapDispatch(int jsval) Unwraps a wrapped DispatchObject. | public static int | wrapDispatch(DispatchObject dispObj) | public static int | wrapFunction(String name, DispatchMethod dispMeth) |
debugObjectCreation | final static boolean debugObjectCreation(Code) | | Flag to enable tracking of object creation sites. Package-protected to
allow JsValueSaf to use it as well.
|
coerceToBoolean | public static boolean coerceToBoolean(int execState, int jsval)(Code) | | |
coerceToByte | public static byte coerceToByte(int execState, int jsval)(Code) | | |
coerceToChar | public static char coerceToChar(int execState, int jsval)(Code) | | |
coerceToDouble | public static double coerceToDouble(int execState, int jsval)(Code) | | |
coerceToFloat | public static float coerceToFloat(int execState, int jsval)(Code) | | |
coerceToInt | public static int coerceToInt(int execState, int jsval)(Code) | | |
coerceToLong | public static long coerceToLong(int execState, int jsval)(Code) | | |
coerceToShort | public static short coerceToShort(int execState, int jsval)(Code) | | |
coerceToString | public static String coerceToString(int execState, int jsval)(Code) | | |
convertBoolean | public static int convertBoolean(boolean v)(Code) | | |
convertDouble | public static int convertDouble(double v)(Code) | | |
convertString | public static int convertString(String v)(Code) | | |
executeScript | public static void executeScript(int execState, String code)(Code) | | Executes JavaScript code.
Parameters: execState - An opaque handle to the script frame window Parameters: code - The JavaScript code to execute |
executeScriptWithInfo | public static void executeScriptWithInfo(int execState, String code, String file, int line)(Code) | | Executes JavaScript code, retaining file and line information.
Parameters: execState - An opaque handle to the script frame window Parameters: code - The JavaScript code to execute Parameters: file - A file name associated with the code Parameters: line - A line number associated with the code. |
gcLock | public static void gcLock(int jsval)(Code) | | |
gcUnlock | public static void gcUnlock(int jsval, Throwable creationStackTrace)(Code) | | |
getExecState | public static int getExecState()(Code) | | |
getGlobalExecState | public static int getGlobalExecState(int scriptObject)(Code) | | |
getTypeString | native public static String getTypeString(int jsval)(Code) | | |
init | public static synchronized void init()(Code) | | |
invoke | public static int invoke(int execState, int scriptObject, String methodName, int jsthis, int[] jsargs)(Code) | | Invokes a method implemented in JavaScript.
Parameters: execState - an opaque handle to the script frame window Parameters: methodName - the method name on jsthis to call Parameters: jsthis - a wrapped java object as a jsval Parameters: jsargs - the arguments to pass to the method the result of the invocation |
isBoolean | native public static boolean isBoolean(int jsval)(Code) | | Parameters: jsval - the js value in question true if the value is a boolean value |
isNull | native public static boolean isNull(int jsval)(Code) | | Parameters: jsval - the js value in question true if the value is the null value |
isNumber | native public static boolean isNumber(int jsval)(Code) | | Parameters: jsval - the js value in question true if the value is a boolean value |
isObject | public static boolean isObject(int jsval)(Code) | | Is the jsval a JSObject?
Parameters: jsval - the value true if jsval is a JSObject |
isString | public static boolean isString(int jsval)(Code) | | Is the jsval a string primitive?
Parameters: jsval - the value true if the jsval is a string primitive |
isUndefined | native public static boolean isUndefined(int jsval)(Code) | | Parameters: jsval - the js value in question true if the value is the undefined value |
isWrappedDispatch | public static boolean isWrappedDispatch(int jsval)(Code) | | Is the jsval JSObject a wrapped DispatchObject?
Parameters: jsval - the value true if the JSObject is a wrapped DispatchObject |
jsLock | public static void jsLock()(Code) | | Locks the JavaScript interpreter into this thread; prevents the garbage
collector from running. DON'T CALL THIS THREAD WITHOUT PUTTING A CALL TO
JSUNLOCK INSIDE OF A FINALLY BLOCK OR YOU WILL LOCK THE BROWSER.
|
jsNull | native public static int jsNull()(Code) | | the null value |
jsUndefined | native public static int jsUndefined()(Code) | | the undefined value |
jsUnlock | public static void jsUnlock()(Code) | | Unlocks the JavaScript interpreter. Call this method from a finally block
whenever you call jsLock.
|
popExecState | public static void popExecState(int execState)(Code) | | |
pushExecState | public static void pushExecState(int execState)(Code) | | |
raiseJavaScriptException | public static void raiseJavaScriptException(int execState, int jsval)(Code) | | Call this to raise an exception in JavaScript before returning control.
Parameters: execState - An opaque handle to the script frame window |
trace | protected static void trace(String s)(Code) | | Called from native code to do tracing.
Parameters: s - the string to trace |
unwrapDispatch | public static DispatchObject unwrapDispatch(int jsval)(Code) | | Unwraps a wrapped DispatchObject.
Parameters: jsval - a value previously returned from wrapDispatch the original DispatchObject |
wrapDispatch | public static int wrapDispatch(DispatchObject dispObj)(Code) | | Parameters: dispObj - the DispatchObject to wrap the wrapped object as a jsval JSObject |
wrapFunction | public static int wrapFunction(String name, DispatchMethod dispMeth)(Code) | | Parameters: name - method name. Parameters: dispMeth - the DispatchMethod to wrap the wrapped method as a jsval JSObject |
|
|