summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedchoc@chromium.org <tedchoc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-12 13:09:51 +0000
committertedchoc@chromium.org <tedchoc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-12 13:09:51 +0000
commit2c051b8e4a1c9f94d7914d7b9e66f317233cd48d (patch)
treedb2ae10f411bec5803768630e465104404f4fbd1
parent7bcb6ecde0254a97a297c9781158fd14c209920d (diff)
downloadchromium_src-2c051b8e4a1c9f94d7914d7b9e66f317233cd48d.zip
chromium_src-2c051b8e4a1c9f94d7914d7b9e66f317233cd48d.tar.gz
chromium_src-2c051b8e4a1c9f94d7914d7b9e66f317233cd48d.tar.bz2
Expose the ability to destroy native webcontents created in ContentViewUtil.
BUG=236521 Review URL: https://chromiumcodereview.appspot.com/15650027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205740 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/ContentViewUtil.java8
-rw-r--r--chrome/browser/android/content_view_util.cc7
2 files changed, 15 insertions, 0 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ContentViewUtil.java b/chrome/android/java/src/org/chromium/chrome/browser/ContentViewUtil.java
index b8dc0b0..a241dca 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ContentViewUtil.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ContentViewUtil.java
@@ -21,5 +21,13 @@ public abstract class ContentViewUtil {
return nativeCreateNativeWebContents(incognito);
}
+ /**
+ * @param webContentsPtr The WebContents reference to be deleted.
+ */
+ public static void destroyNativeWebContents(int webContentsPtr) {
+ nativeDestroyNativeWebContents(webContentsPtr);
+ }
+
private static native int nativeCreateNativeWebContents(boolean incognito);
+ private static native void nativeDestroyNativeWebContents(int webContentsPtr);
}
diff --git a/chrome/browser/android/content_view_util.cc b/chrome/browser/android/content_view_util.cc
index ad99146..2acdb1e 100644
--- a/chrome/browser/android/content_view_util.cc
+++ b/chrome/browser/android/content_view_util.cc
@@ -22,6 +22,13 @@ static jint CreateNativeWebContents(
return reinterpret_cast<jint>(web_contents);
}
+static void DestroyNativeWebContents(
+ JNIEnv* env, jclass clazz, jint web_contents_ptr) {
+ content::WebContents* web_contents =
+ reinterpret_cast<content::WebContents*>(web_contents_ptr);
+ delete web_contents;
+}
+
bool RegisterContentViewUtil(JNIEnv* env) {
return RegisterNativesImpl(env);
}