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

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: addressed comments Created 7 years, 1 month 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 13 matching lines...) Expand all
24 24
25 using base::android::ScopedJavaLocalRef; 25 using base::android::ScopedJavaLocalRef;
26 26
27 namespace content { 27 namespace content {
28 28
29 // static 29 // static
30 bool ContentViewRenderView::RegisterContentViewRenderView(JNIEnv* env) { 30 bool ContentViewRenderView::RegisterContentViewRenderView(JNIEnv* env) {
31 return RegisterNativesImpl(env); 31 return RegisterNativesImpl(env);
32 } 32 }
33 33
34 ContentViewRenderView::ContentViewRenderView(JNIEnv* env, jobject obj) 34 ContentViewRenderView::ContentViewRenderView(JNIEnv* env,
35 : buffers_swapped_during_composite_(false) { 35 jobject obj,
36 gfx::NativeWindow root_window)
37 : buffers_swapped_during_composite_(false),
38 root_window_(root_window) {
36 java_obj_.Reset(env, obj); 39 java_obj_.Reset(env, obj);
37 } 40 }
38 41
39 ContentViewRenderView::~ContentViewRenderView() { 42 ContentViewRenderView::~ContentViewRenderView() {
40 } 43 }
41 44
42 // static 45 // static
43 static jint Init(JNIEnv* env, jobject obj) { 46 static jint Init(JNIEnv* env, jobject obj, jlong native_root_window) {
no sievers 2013/11/15 22:56:19 nit: we already have |root_window|
powei 2013/11/18 19:29:59 can you elaborate? is this about the name |native
47 gfx::NativeWindow root_window =
48 reinterpret_cast<gfx::NativeWindow>(native_root_window);
44 ContentViewRenderView* content_view_render_view = 49 ContentViewRenderView* content_view_render_view =
45 new ContentViewRenderView(env, obj); 50 new ContentViewRenderView(env, obj, root_window);
46 return reinterpret_cast<jint>(content_view_render_view); 51 return reinterpret_cast<jint>(content_view_render_view);
47 } 52 }
48 53
49 void ContentViewRenderView::Destroy(JNIEnv* env, jobject obj) { 54 void ContentViewRenderView::Destroy(JNIEnv* env, jobject obj) {
50 delete this; 55 delete this;
51 } 56 }
52 57
53 void ContentViewRenderView::SetCurrentContentView( 58 void ContentViewRenderView::SetCurrentContentView(
54 JNIEnv* env, jobject obj, int native_content_view) { 59 JNIEnv* env, jobject obj, int native_content_view) {
55 InitCompositor(); 60 InitCompositor();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 buffers_swapped_during_composite_ = true; 108 buffers_swapped_during_composite_ = true;
104 } 109 }
105 110
106 void ContentViewRenderView::OnSwapBuffersCompleted() { 111 void ContentViewRenderView::OnSwapBuffersCompleted() {
107 JNIEnv* env = base::android::AttachCurrentThread(); 112 JNIEnv* env = base::android::AttachCurrentThread();
108 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); 113 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj());
109 } 114 }
110 115
111 void ContentViewRenderView::InitCompositor() { 116 void ContentViewRenderView::InitCompositor() {
112 if (!compositor_) 117 if (!compositor_)
113 compositor_.reset(Compositor::Create(this)); 118 compositor_.reset(Compositor::Create(this, root_window_));
114 } 119 }
115 120
116 } // namespace content 121 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698