Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 package org.mozilla.gecko.util;
8 import org.mozilla.gecko.mozglue.JNITarget;
10 /**
11 * NativeJSContainer is a wrapper around the SpiderMonkey JSAPI to make it possible to
12 * access Javascript objects in Java.
13 *
14 * A container must only be used on the thread it is attached to. To use it on another
15 * thread, call {@link #clone()} to make a copy, and use the copy on the other thread.
16 * When a copy is first used, it becomes attached to the thread using it.
17 */
18 @JNITarget
19 public final class NativeJSContainer extends NativeJSObject
20 {
21 private long mNativeObject;
23 private NativeJSContainer(long nativeObject) {
24 mNativeObject = nativeObject;
25 }
27 /**
28 * Make a copy of this container for use by another thread. When the copy is first used,
29 * it becomes attached to the thread using it.
30 */
31 @Override
32 public native NativeJSContainer clone();
34 /**
35 * Dispose all associated native objects. Subsequent use of any objects derived from
36 * this container will throw a NullPointerException.
37 */
38 public native void dispose();
39 }