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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "android_webview/native/shared_renderer_state_proxy.h"
6
7 #include "content/public/browser/browser_thread.h"
8 #include "jni/SharedRendererStateProxy_jni.h"
9
10 using content::BrowserThread;
11
12 namespace android_webview {
13
14 SharedRendererStateProxy::SharedRendererStateProxy()
15 : shared_renderer_state_(this, BrowserThread::GetMessageLoopProxyForThread(
16 BrowserThread::UI)) {}
17
18 SharedRendererStateProxy::~SharedRendererStateProxy() {}
19
20 void SharedRendererStateProxy::OnParentDrawConstraintsUpdated() {
21 if (client_) client_->OnParentDrawConstraintsUpdated();
22 }
23
24 bool SharedRendererStateProxy::RequestDrawGL(bool wait_for_completion) {
25 if (client_) return client_->RequestDrawGL(wait_for_completion);
26 return false;
27 }
28
29 void SharedRendererStateProxy::DetachFunctorFromView() {
30 if (client_) client_->DetachFunctorFromView();
31 }
32
33 void SharedRendererStateProxy::SetClient(
34 JNIEnv* env, const base::android::JavaParamRef<jobject>& obj,
35 jlong client) {
36 client_ = reinterpret_cast<SharedRendererStateClient*>(client);
37 }
38
39 void SharedRendererStateProxy::Destroy(
40 JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) {
41 delete this;
42 }
43
44 void SharedRendererStateProxy::DeleteHardwareRenderer(
45 JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) {
46 shared_renderer_state_.DeleteHardwareRendererOnUI();
47 }
48
49 jlong SharedRendererStateProxy::GetAwDrawGLViewContext(
50 JNIEnv* env, const base::android::JavaParamRef<jobject>& obj) {
51 return reinterpret_cast<intptr_t>(&shared_renderer_state_);
52 }
53
54 static jlong Create(JNIEnv* env, const JavaParamRef<jclass>&) {
55 return reinterpret_cast<intptr_t>(new SharedRendererStateProxy());
56 }
57
58 bool RegisterSharedRendererStateProxy(JNIEnv* env) {
59 return RegisterNativesImpl(env);
60 }
61
62 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698