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

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

Issue 2688113002: Make ViewRoot the top of the ViewAndroid tree (Closed)
Patch Set: comments Created 3 years, 10 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 <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 18 matching lines...) Expand all
29 29
30 namespace content { 30 namespace content {
31 31
32 // static 32 // static
33 bool ContentViewRenderView::RegisterContentViewRenderView(JNIEnv* env) { 33 bool ContentViewRenderView::RegisterContentViewRenderView(JNIEnv* env) {
34 return RegisterNativesImpl(env); 34 return RegisterNativesImpl(env);
35 } 35 }
36 36
37 ContentViewRenderView::ContentViewRenderView(JNIEnv* env, 37 ContentViewRenderView::ContentViewRenderView(JNIEnv* env,
38 jobject obj, 38 jobject obj,
39 gfx::NativeWindow root_window) 39 ui::ViewRoot* view_root)
40 : root_window_(root_window), current_surface_format_(0) { 40 : view_root_(view_root), current_surface_format_(0) {
41 java_obj_.Reset(env, obj); 41 java_obj_.Reset(env, obj);
42 } 42 }
43 43
44 ContentViewRenderView::~ContentViewRenderView() { 44 ContentViewRenderView::~ContentViewRenderView() {
45 } 45 }
46 46
47 // static 47 // static
48 static jlong Init(JNIEnv* env, 48 static jlong Init(JNIEnv* env,
49 const JavaParamRef<jobject>& obj, 49 const JavaParamRef<jobject>& obj,
50 jlong native_root_window) { 50 jlong native_view_root) {
51 gfx::NativeWindow root_window = 51 ui::ViewRoot* view_root = reinterpret_cast<ui::ViewRoot*>(native_view_root);
52 reinterpret_cast<gfx::NativeWindow>(native_root_window);
53 ContentViewRenderView* content_view_render_view = 52 ContentViewRenderView* content_view_render_view =
54 new ContentViewRenderView(env, obj, root_window); 53 new ContentViewRenderView(env, obj, view_root);
55 return reinterpret_cast<intptr_t>(content_view_render_view); 54 return reinterpret_cast<intptr_t>(content_view_render_view);
56 } 55 }
57 56
58 void ContentViewRenderView::Destroy(JNIEnv* env, 57 void ContentViewRenderView::Destroy(JNIEnv* env,
59 const JavaParamRef<jobject>& obj) { 58 const JavaParamRef<jobject>& obj) {
60 delete this; 59 delete this;
61 } 60 }
62 61
63 void ContentViewRenderView::SetCurrentWebContents( 62 void ContentViewRenderView::SetCurrentWebContents(
64 JNIEnv* env, 63 JNIEnv* env,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Compositor related classes. 109 // Compositor related classes.
111 } 110 }
112 111
113 void ContentViewRenderView::OnSwapBuffersCompleted(int pending_swap_buffers) { 112 void ContentViewRenderView::OnSwapBuffersCompleted(int pending_swap_buffers) {
114 JNIEnv* env = base::android::AttachCurrentThread(); 113 JNIEnv* env = base::android::AttachCurrentThread();
115 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_); 114 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_);
116 } 115 }
117 116
118 void ContentViewRenderView::InitCompositor() { 117 void ContentViewRenderView::InitCompositor() {
119 if (!compositor_) 118 if (!compositor_)
120 compositor_.reset(Compositor::Create(this, root_window_)); 119 compositor_.reset(Compositor::Create(this, view_root_));
121 } 120 }
122 121
123 } // namespace content 122 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698