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

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 1145273003: aw: Force auxiliary bitmap on android emulators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 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 8
9 #include "android_webview/browser/aw_browser_context.h" 9 #include "android_webview/browser/aw_browser_context.h"
10 #include "android_webview/browser/aw_browser_main_parts.h" 10 #include "android_webview/browser/aw_browser_main_parts.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 ->DrawGL(draw_info); 101 ->DrawGL(draw_info);
102 } 102 }
103 } 103 }
104 104
105 namespace android_webview { 105 namespace android_webview {
106 106
107 namespace { 107 namespace {
108 108
109 bool g_should_download_favicons = false; 109 bool g_should_download_favicons = false;
110 110
111 bool g_force_auxiliary_bitmap_rendering = false;
112
111 const void* kAwContentsUserDataKey = &kAwContentsUserDataKey; 113 const void* kAwContentsUserDataKey = &kAwContentsUserDataKey;
112 114
113 class AwContentsUserData : public base::SupportsUserData::Data { 115 class AwContentsUserData : public base::SupportsUserData::Data {
114 public: 116 public:
115 AwContentsUserData(AwContents* ptr) : contents_(ptr) {} 117 AwContentsUserData(AwContents* ptr) : contents_(ptr) {}
116 118
117 static AwContents* GetContents(WebContents* web_contents) { 119 static AwContents* GetContents(WebContents* web_contents) {
118 if (!web_contents) 120 if (!web_contents)
119 return NULL; 121 return NULL;
120 AwContentsUserData* data = static_cast<AwContentsUserData*>( 122 AwContentsUserData* data = static_cast<AwContentsUserData*>(
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 static jlong Init(JNIEnv* env, jclass, jobject browser_context) { 305 static jlong Init(JNIEnv* env, jclass, jobject browser_context) {
304 // TODO(joth): Use |browser_context| to get the native BrowserContext, rather 306 // TODO(joth): Use |browser_context| to get the native BrowserContext, rather
305 // than hard-code the default instance lookup here. 307 // than hard-code the default instance lookup here.
306 scoped_ptr<WebContents> web_contents(content::WebContents::Create( 308 scoped_ptr<WebContents> web_contents(content::WebContents::Create(
307 content::WebContents::CreateParams(AwBrowserContext::GetDefault()))); 309 content::WebContents::CreateParams(AwBrowserContext::GetDefault())));
308 // Return an 'uninitialized' instance; most work is deferred until the 310 // Return an 'uninitialized' instance; most work is deferred until the
309 // subsequent SetJavaPeers() call. 311 // subsequent SetJavaPeers() call.
310 return reinterpret_cast<intptr_t>(new AwContents(web_contents.Pass())); 312 return reinterpret_cast<intptr_t>(new AwContents(web_contents.Pass()));
311 } 313 }
312 314
315 static void SetForceAuxiliaryBitmapRendering(
316 JNIEnv* env,
317 jclass,
318 jboolean force_auxiliary_bitmap_rendering) {
319 g_force_auxiliary_bitmap_rendering = force_auxiliary_bitmap_rendering;
320 }
321
313 static void SetAwDrawSWFunctionTable(JNIEnv* env, jclass, 322 static void SetAwDrawSWFunctionTable(JNIEnv* env, jclass,
314 jlong function_table) { 323 jlong function_table) {
315 RasterHelperSetAwDrawSWFunctionTable( 324 RasterHelperSetAwDrawSWFunctionTable(
316 reinterpret_cast<AwDrawSWFunctionTable*>(function_table)); 325 reinterpret_cast<AwDrawSWFunctionTable*>(function_table));
317 } 326 }
318 327
319 static void SetAwDrawGLFunctionTable(JNIEnv* env, jclass, 328 static void SetAwDrawGLFunctionTable(JNIEnv* env, jclass,
320 jlong function_table) { 329 jlong function_table) {
321 } 330 }
322 331
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 jint scroll_y, 878 jint scroll_y,
870 jint visible_left, 879 jint visible_left,
871 jint visible_top, 880 jint visible_top,
872 jint visible_right, 881 jint visible_right,
873 jint visible_bottom) { 882 jint visible_bottom) {
874 DCHECK_CURRENTLY_ON(BrowserThread::UI); 883 DCHECK_CURRENTLY_ON(BrowserThread::UI);
875 gfx::Vector2d scroll(scroll_x, scroll_y); 884 gfx::Vector2d scroll(scroll_x, scroll_y);
876 browser_view_renderer_.PrepareToDraw( 885 browser_view_renderer_.PrepareToDraw(
877 scroll, gfx::Rect(visible_left, visible_top, visible_right - visible_left, 886 scroll, gfx::Rect(visible_left, visible_top, visible_right - visible_left,
878 visible_bottom - visible_top)); 887 visible_bottom - visible_top));
879 if (is_hardware_accelerated && browser_view_renderer_.attached_to_window()) { 888 if (is_hardware_accelerated && browser_view_renderer_.attached_to_window() &&
889 !g_force_auxiliary_bitmap_rendering) {
880 return browser_view_renderer_.OnDrawHardware(); 890 return browser_view_renderer_.OnDrawHardware();
881 } 891 }
882 892
883 gfx::Size view_size = browser_view_renderer_.size(); 893 gfx::Size view_size = browser_view_renderer_.size();
884 if (view_size.IsEmpty()) { 894 if (view_size.IsEmpty()) {
885 TRACE_EVENT_INSTANT0("android_webview", "EarlyOut_EmptySize", 895 TRACE_EVENT_INSTANT0("android_webview", "EarlyOut_EmptySize",
886 TRACE_EVENT_SCOPE_THREAD); 896 TRACE_EVENT_SCOPE_THREAD);
887 return false; 897 return false;
888 } 898 }
889 899
890 // TODO(hush): Right now webview size is passed in as the auxiliary bitmap 900 // TODO(hush): Right now webview size is passed in as the auxiliary bitmap
891 // size, which might hurt performace (only for software draws with auxiliary 901 // size, which might hurt performace (only for software draws with auxiliary
892 // bitmap). For better performance, get global visible rect, transform it 902 // bitmap). For better performance, get global visible rect, transform it
893 // from screen space to view space, then intersect with the webview in 903 // from screen space to view space, then intersect with the webview in
894 // viewspace. Use the resulting rect as the auxiliary bitmap. 904 // viewspace. Use the resulting rect as the auxiliary bitmap.
895 scoped_ptr<SoftwareCanvasHolder> canvas_holder = 905 scoped_ptr<SoftwareCanvasHolder> canvas_holder = SoftwareCanvasHolder::Create(
896 SoftwareCanvasHolder::Create(canvas, scroll, view_size); 906 canvas, scroll, view_size, g_force_auxiliary_bitmap_rendering);
897 if (!canvas_holder || !canvas_holder->GetCanvas()) { 907 if (!canvas_holder || !canvas_holder->GetCanvas()) {
898 TRACE_EVENT_INSTANT0("android_webview", "EarlyOut_EmptySize", 908 TRACE_EVENT_INSTANT0("android_webview", "EarlyOut_EmptySize",
899 TRACE_EVENT_SCOPE_THREAD); 909 TRACE_EVENT_SCOPE_THREAD);
900 return false; 910 return false;
901 } 911 }
902 return browser_view_renderer_.OnDrawSoftware(canvas_holder->GetCanvas()); 912 return browser_view_renderer_.OnDrawSoftware(canvas_holder->GetCanvas());
903 } 913 }
904 914
905 void AwContents::SetPendingWebContentsForPopup( 915 void AwContents::SetPendingWebContentsForPopup(
906 scoped_ptr<content::WebContents> pending) { 916 scoped_ptr<content::WebContents> pending) {
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 1163
1154 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports, 1164 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports,
1155 GetMessagePortMessageFilter()); 1165 GetMessagePortMessageFilter());
1156 } 1166 }
1157 1167
1158 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { 1168 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) {
1159 g_should_download_favicons = true; 1169 g_should_download_favicons = true;
1160 } 1170 }
1161 1171
1162 } // namespace android_webview 1172 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwContents.java ('k') | android_webview/native/aw_picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698