OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "android_webview/native/aw_contents.h" | 5 #include "android_webview/native/aw_contents.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "android_webview/browser/aw_browser_context.h" | 10 #include "android_webview/browser/aw_browser_context.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 if (!web_contents_) | 303 if (!web_contents_) |
304 return base::android::ScopedJavaLocalRef<jobject>(); | 304 return base::android::ScopedJavaLocalRef<jobject>(); |
305 | 305 |
306 return web_contents_->GetJavaWebContents(); | 306 return web_contents_->GetJavaWebContents(); |
307 } | 307 } |
308 | 308 |
309 void AwContents::SetAwGLFunctor(AwGLFunctor* functor) { | 309 void AwContents::SetAwGLFunctor(AwGLFunctor* functor) { |
310 if (functor == functor_) { | 310 if (functor == functor_) { |
311 return; | 311 return; |
312 } | 312 } |
313 if (functor_) { | |
314 functor_->SetBrowserViewRenderer(nullptr); | |
315 } | |
316 functor_ = functor; | 313 functor_ = functor; |
317 if (functor_) { | 314 if (functor_) { |
318 browser_view_renderer_.SetRenderThreadManager( | 315 browser_view_renderer_.SetCompositorFrameConsumer( |
319 functor_->GetRenderThreadManager()); | 316 functor_->GetCompositorFrameConsumer()); |
320 functor_->SetBrowserViewRenderer(&browser_view_renderer_); | |
321 } else { | 317 } else { |
322 browser_view_renderer_.SetRenderThreadManager(nullptr); | 318 browser_view_renderer_.SetCompositorFrameConsumer(nullptr); |
323 } | 319 } |
324 } | 320 } |
325 | 321 |
326 void AwContents::SetAwGLFunctor(JNIEnv* env, | 322 void AwContents::SetAwGLFunctor(JNIEnv* env, |
327 const base::android::JavaParamRef<jobject>& obj, | 323 const base::android::JavaParamRef<jobject>& obj, |
328 jlong gl_functor) { | 324 jlong gl_functor) { |
329 SetAwGLFunctor(reinterpret_cast<AwGLFunctor*>(gl_functor)); | 325 SetAwGLFunctor(reinterpret_cast<AwGLFunctor*>(gl_functor)); |
330 } | 326 } |
331 | 327 |
332 void AwContents::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 328 void AwContents::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 737 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
742 JNIEnv* env = AttachCurrentThread(); | 738 JNIEnv* env = AttachCurrentThread(); |
743 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 739 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
744 if (obj.is_null()) | 740 if (obj.is_null()) |
745 return; | 741 return; |
746 | 742 |
747 Java_AwContents_onReceivedTouchIconUrl( | 743 Java_AwContents_onReceivedTouchIconUrl( |
748 env, obj.obj(), ConvertUTF8ToJavaString(env, url).obj(), precomposed); | 744 env, obj.obj(), ConvertUTF8ToJavaString(env, url).obj(), precomposed); |
749 } | 745 } |
750 | 746 |
751 void AwContents::OnParentDrawConstraintsUpdated() { | |
752 browser_view_renderer_.OnParentDrawConstraintsUpdated(); | |
753 } | |
754 | |
755 void AwContents::PostInvalidate() { | 747 void AwContents::PostInvalidate() { |
756 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 748 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
757 JNIEnv* env = AttachCurrentThread(); | 749 JNIEnv* env = AttachCurrentThread(); |
758 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 750 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
759 if (!obj.is_null()) | 751 if (!obj.is_null()) |
760 Java_AwContents_postInvalidateOnAnimation(env, obj.obj()); | 752 Java_AwContents_postInvalidateOnAnimation(env, obj.obj()); |
761 } | 753 } |
762 | 754 |
763 void AwContents::OnNewPicture() { | 755 void AwContents::OnNewPicture() { |
764 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 756 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 const JavaParamRef<jobject>& obj) { | 1285 const JavaParamRef<jobject>& obj) { |
1294 web_contents_->ResumeLoadingCreatedWebContents(); | 1286 web_contents_->ResumeLoadingCreatedWebContents(); |
1295 } | 1287 } |
1296 | 1288 |
1297 void SetShouldDownloadFavicons(JNIEnv* env, | 1289 void SetShouldDownloadFavicons(JNIEnv* env, |
1298 const JavaParamRef<jclass>& jclazz) { | 1290 const JavaParamRef<jclass>& jclazz) { |
1299 g_should_download_favicons = true; | 1291 g_should_download_favicons = true; |
1300 } | 1292 } |
1301 | 1293 |
1302 } // namespace android_webview | 1294 } // namespace android_webview |
OLD | NEW |