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

Side by Side Diff: content/browser/android/content_view_render_view.cc

Issue 26753005: Adding compositor callbacks to RenderWidgetHostViewAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change RWHVA to add itself to the compositor as per sievers@ comment Created 7 years, 2 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "content/browser/android/content_view_render_view.h" 5 #include "content/browser/android/content_view_render_view.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 void ContentViewRenderView::Destroy(JNIEnv* env, jobject obj) { 47 void ContentViewRenderView::Destroy(JNIEnv* env, jobject obj) {
48 delete this; 48 delete this;
49 } 49 }
50 50
51 void ContentViewRenderView::SetCurrentContentView( 51 void ContentViewRenderView::SetCurrentContentView(
52 JNIEnv* env, jobject obj, int native_content_view) { 52 JNIEnv* env, jobject obj, int native_content_view) {
53 InitCompositor(); 53 InitCompositor();
54 ContentViewCoreImpl* content_view = 54 ContentViewCoreImpl* content_view =
55 reinterpret_cast<ContentViewCoreImpl*>(native_content_view); 55 reinterpret_cast<ContentViewCoreImpl*>(native_content_view);
56 if (content_view) 56 if (content_view) {
57 compositor_->SetRootLayer(content_view->GetLayer()); 57 compositor_->SetRootLayer(content_view->GetLayer());
58 else 58 content_view->SetCompositor(compositor_.get());
59 } else
59 compositor_->SetRootLayer(cc::Layer::Create()); 60 compositor_->SetRootLayer(cc::Layer::Create());
60 } 61 }
61 62
63 void ContentViewRenderView::RemovePreviousContentView(JNIEnv* env,
64 jobject obj,
no sievers 2013/10/16 23:34:23 I don't think we need this here, see my comment in
powei 2013/10/19 00:05:18 Done. Removed.
65 int native_content_view) {
66 DCHECK(compositor_);
67 ContentViewCoreImpl* content_view =
68 reinterpret_cast<ContentViewCoreImpl*>(native_content_view);
69 if (content_view) {
70 content_view->SetCompositor(NULL);
71 }
72 }
73
62 void ContentViewRenderView::SurfaceCreated( 74 void ContentViewRenderView::SurfaceCreated(
63 JNIEnv* env, jobject obj, jobject jsurface) { 75 JNIEnv* env, jobject obj, jobject jsurface) {
64 InitCompositor(); 76 InitCompositor();
65 compositor_->SetSurface(jsurface); 77 compositor_->SetSurface(jsurface);
66 } 78 }
67 79
68 void ContentViewRenderView::SurfaceDestroyed(JNIEnv* env, jobject obj) { 80 void ContentViewRenderView::SurfaceDestroyed(JNIEnv* env, jobject obj) {
69 compositor_->SetSurface(NULL); 81 compositor_->SetSurface(NULL);
70 } 82 }
71 83
(...skipping 24 matching lines...) Expand all
96 JNIEnv* env = base::android::AttachCurrentThread(); 108 JNIEnv* env = base::android::AttachCurrentThread();
97 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); 109 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj());
98 } 110 }
99 111
100 void ContentViewRenderView::InitCompositor() { 112 void ContentViewRenderView::InitCompositor() {
101 if (!compositor_) 113 if (!compositor_)
102 compositor_.reset(Compositor::Create(this)); 114 compositor_.reset(Compositor::Create(this));
103 } 115 }
104 116
105 } // namespace content 117 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698