| 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
|
|
|