Make the C++ PlatformViewportAndroid's dtor call the Java PVA's detach() method.
In particular, after destruction of the C++ PVA, the Java PVA will no
longer try to call into it.
(Rename the previously-unused destroy() to detach(), and make it not
call into native code.)
BUG=Fixes #95
R=qsr@chromium.org
Review URL: https://codereview.chromium.org/1081443005
diff --git a/services/native_viewport/platform_viewport_android.h b/services/native_viewport/platform_viewport_android.h
index 75ed038..6592903 100644
--- a/services/native_viewport/platform_viewport_android.h
+++ b/services/native_viewport/platform_viewport_android.h
@@ -6,7 +6,6 @@
#define SERVICES_NATIVE_VIEWPORT_PLATFORM_VIEWPORT_ANDROID_H_
#include "base/android/jni_weak_ref.h"
-#include "base/android/scoped_java_ref.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "services/native_viewport/platform_viewport.h"
@@ -68,7 +67,8 @@
void ReleaseWindow();
- Delegate* delegate_;
+ Delegate* const delegate_;
+ JavaObjectWeakGlobalRef java_platform_viewport_android_;
ANativeWindow* window_;
mojo::ViewportMetricsPtr metrics_;
ui::SequentialIDGenerator id_generator_;