mobile/android/base/util/NativeJSContainer.java

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial