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

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

Issue 493853005: Add API to get the UIResourceProvider from ContentViewRenderView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased again Created 6 years, 3 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"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "cc/layers/layer.h" 14 #include "cc/layers/layer.h"
15 #include "content/browser/android/content_view_core_impl.h" 15 #include "content/browser/android/content_view_core_impl.h"
16 #include "content/public/browser/android/compositor.h" 16 #include "content/public/browser/android/compositor.h"
17 #include "content/public/browser/android/content_view_layer_renderer.h" 17 #include "content/public/browser/android/content_view_layer_renderer.h"
18 #include "content/public/browser/android/layer_tree_build_helper.h" 18 #include "content/public/browser/android/layer_tree_build_helper.h"
19 #include "content/public/browser/android/ui_resource_provider.h"
19 #include "jni/ContentViewRenderView_jni.h" 20 #include "jni/ContentViewRenderView_jni.h"
20 #include "ui/gfx/android/java_bitmap.h" 21 #include "ui/gfx/android/java_bitmap.h"
21 #include "ui/gfx/size.h" 22 #include "ui/gfx/size.h"
22 23
23 #include <android/bitmap.h> 24 #include <android/bitmap.h>
24 #include <android/native_window_jni.h> 25 #include <android/native_window_jni.h>
25 26
26 using base::android::ScopedJavaLocalRef; 27 using base::android::ScopedJavaLocalRef;
27 28
28 namespace content { 29 namespace content {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 64 }
64 65
65 void ContentViewRenderView::SetLayerTreeBuildHelper(JNIEnv* env, 66 void ContentViewRenderView::SetLayerTreeBuildHelper(JNIEnv* env,
66 jobject obj, 67 jobject obj,
67 jlong native_build_helper) { 68 jlong native_build_helper) {
68 CHECK(native_build_helper); 69 CHECK(native_build_helper);
69 70
70 LayerTreeBuildHelper* build_helper = 71 LayerTreeBuildHelper* build_helper =
71 reinterpret_cast<LayerTreeBuildHelper*>(native_build_helper); 72 reinterpret_cast<LayerTreeBuildHelper*>(native_build_helper);
72 layer_tree_build_helper_.reset(build_helper); 73 layer_tree_build_helper_.reset(build_helper);
74 InitCompositor();
73 } 75 }
74 // static 76 // static
75 static jlong Init(JNIEnv* env, 77 static jlong Init(JNIEnv* env,
76 jobject obj, 78 jobject obj,
77 jlong native_root_window) { 79 jlong native_root_window) {
78 gfx::NativeWindow root_window = 80 gfx::NativeWindow root_window =
79 reinterpret_cast<gfx::NativeWindow>(native_root_window); 81 reinterpret_cast<gfx::NativeWindow>(native_root_window);
80 ContentViewRenderView* content_view_render_view = 82 ContentViewRenderView* content_view_render_view =
81 new ContentViewRenderView(env, obj, root_window); 83 new ContentViewRenderView(env, obj, root_window);
82 return reinterpret_cast<intptr_t>(content_view_render_view); 84 return reinterpret_cast<intptr_t>(content_view_render_view);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 137
136 void ContentViewRenderView::OnSwapBuffersCompleted(int pending_swap_buffers) { 138 void ContentViewRenderView::OnSwapBuffersCompleted(int pending_swap_buffers) {
137 JNIEnv* env = base::android::AttachCurrentThread(); 139 JNIEnv* env = base::android::AttachCurrentThread();
138 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); 140 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj());
139 } 141 }
140 142
141 void ContentViewRenderView::InitCompositor() { 143 void ContentViewRenderView::InitCompositor() {
142 if (!compositor_) 144 if (!compositor_)
143 compositor_.reset(Compositor::Create(this, root_window_)); 145 compositor_.reset(Compositor::Create(this, root_window_));
144 } 146 }
147
148 jlong ContentViewRenderView::GetUIResourceProvider(JNIEnv* env,
149 jobject obj) {
150 if (!compositor_)
151 return 0;
152 return reinterpret_cast<intptr_t>(&compositor_->GetUIResourceProvider());
153 }
145 } // namespace content 154 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698