Index: content/browser/android/content_view_render_view.cc |
diff --git a/content/browser/android/content_view_render_view.cc b/content/browser/android/content_view_render_view.cc |
index db42223b18ae88eeb2374d18bcb9818cfb76be2b..48a0ced469f7b7e1fd88d2733ffd8c1c0eaee317 100644 |
--- a/content/browser/android/content_view_render_view.cc |
+++ b/content/browser/android/content_view_render_view.cc |
@@ -38,18 +38,23 @@ ContentViewRenderView::ContentViewRenderView(JNIEnv* env, |
root_window_(root_window), |
current_surface_format_(0) { |
java_obj_.Reset(env, obj); |
+ Java_ContentViewRenderView_setNativePtr( |
+ env, obj, reinterpret_cast<intptr_t>(this)); |
} |
ContentViewRenderView::~ContentViewRenderView() { |
+ JNIEnv* env = base::android::AttachCurrentThread(); |
+ if (java_obj_.is_null()) |
+ return; |
+ |
+ Java_ContentViewRenderView_clearNativePtr(env, java_obj_.obj()); |
} |
// static |
-static jlong Init(JNIEnv* env, jobject obj, jlong native_root_window) { |
+static void Init(JNIEnv* env, jobject obj, jlong native_root_window) { |
gfx::NativeWindow root_window = |
reinterpret_cast<gfx::NativeWindow>(native_root_window); |
- ContentViewRenderView* content_view_render_view = |
- new ContentViewRenderView(env, obj, root_window); |
- return reinterpret_cast<intptr_t>(content_view_render_view); |
+ new ContentViewRenderView(env, obj, root_window); |
Yaron
2014/03/19 19:00:12
Hmm, this mirrors TabAndroid but it's a dangerous
|
} |
void ContentViewRenderView::Destroy(JNIEnv* env, jobject obj) { |