| OLD | NEW |
| (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 |
| OLD | NEW |