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

Unified Diff: android_webview/native/shared_renderer_state_proxy.cc

Issue 1844343005: WIP - Control the lifetime of RenderThreadManager from Java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rework; BVR still needs to be informed of the SRS pointer. Created 4 years, 9 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
Index: android_webview/native/shared_renderer_state_proxy.cc
diff --git a/android_webview/native/shared_renderer_state_proxy.cc b/android_webview/native/shared_renderer_state_proxy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d788ea8c4afd87013374e8746dc7cc5245b8c8f6
--- /dev/null
+++ b/android_webview/native/shared_renderer_state_proxy.cc
@@ -0,0 +1,62 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "android_webview/native/shared_renderer_state_proxy.h"
+
+#include "content/public/browser/browser_thread.h"
+#include "jni/SharedRendererStateProxy_jni.h"
+
+using content::BrowserThread;
+
+namespace android_webview {
+
+SharedRendererStateProxy::SharedRendererStateProxy()
+ : shared_renderer_state_(this, BrowserThread::GetMessageLoopProxyForThread(
+ BrowserThread::UI)) {}
+
+SharedRendererStateProxy::~SharedRendererStateProxy() {}
+
+void SharedRendererStateProxy::OnParentDrawConstraintsUpdated() {
+ if (client_) client_->OnParentDrawConstraintsUpdated();
+}
+
+bool SharedRendererStateProxy::RequestDrawGL(bool wait_for_completion) {
+ if (client_) return client_->RequestDrawGL(wait_for_completion);
+ return false;
+}
+
+void SharedRendererStateProxy::DetachFunctorFromView() {
+ if (client_) client_->DetachFunctorFromView();
+}
+
+void SharedRendererStateProxy::SetClient(
+ JNIEnv* env, const base::android::JavaParamRef<jobject>& obj,
+ jlong client) {
+ client_ = reinterpret_cast<SharedRendererStateClient*>(client);
+}
+
+void SharedRendererStateProxy::Destroy(
+ JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) {
+ delete this;
+}
+
+void SharedRendererStateProxy::DeleteHardwareRenderer(
+ JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) {
+ shared_renderer_state_.DeleteHardwareRendererOnUI();
+}
+
+jlong SharedRendererStateProxy::GetAwDrawGLViewContext(
+ JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) {
+ return reinterpret_cast<intptr_t>(&shared_renderer_state_);
+}
+
+static jlong Create(JNIEnv* env, const JavaParamRef<jclass>&) {
+ return reinterpret_cast<intptr_t>(new SharedRendererStateProxy());
+}
+
+bool RegisterSharedRendererStateProxy(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698