Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1111)

Unified Diff: mojo/services/native_viewport/platform_viewport_android.cc

Issue 1092033003: Pulls display related changes from mojo to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/native_viewport/platform_viewport_android.h ('k') | mojo/services/view_manager/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/native_viewport/platform_viewport_android.cc
diff --git a/mojo/services/native_viewport/platform_viewport_android.cc b/mojo/services/native_viewport/platform_viewport_android.cc
index ee5d7dd72f1d78136d56f3e1e154fee826e47a8e..124919a4b5258560cdc8049d9802ee2072c94a75 100644
--- a/mojo/services/native_viewport/platform_viewport_android.cc
+++ b/mojo/services/native_viewport/platform_viewport_android.cc
@@ -61,6 +61,11 @@ PlatformViewportAndroid::PlatformViewportAndroid(Delegate* delegate)
PlatformViewportAndroid::~PlatformViewportAndroid() {
if (window_)
ReleaseWindow();
+ if (!java_platform_viewport_android_.is_empty()) {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ Java_PlatformViewportAndroid_detach(
+ env, java_platform_viewport_android_.get(env).obj());
+ }
}
void PlatformViewportAndroid::Destroy(JNIEnv* env, jobject obj) {
@@ -161,10 +166,10 @@ bool PlatformViewportAndroid::KeyEvent(JNIEnv* env,
void PlatformViewportAndroid::Init(const gfx::Rect& bounds) {
JNIEnv* env = base::android::AttachCurrentThread();
- Java_PlatformViewportAndroid_createForActivity(
- env,
- base::android::GetApplicationContext(),
- reinterpret_cast<jlong>(this));
+ java_platform_viewport_android_ = JavaObjectWeakGlobalRef(
+ env, Java_PlatformViewportAndroid_createForActivity(
+ env, base::android::GetApplicationContext(),
+ reinterpret_cast<jlong>(this)).obj());
}
void PlatformViewportAndroid::Show() {
« no previous file with comments | « mojo/services/native_viewport/platform_viewport_android.h ('k') | mojo/services/view_manager/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698