| OLD | NEW |
| 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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 874 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 875 gfx::Vector2d scroll(scroll_x, scroll_y); | 875 gfx::Vector2d scroll(scroll_x, scroll_y); |
| 876 browser_view_renderer_.PrepareToDraw( | 876 browser_view_renderer_.PrepareToDraw( |
| 877 scroll, gfx::Rect(visible_left, visible_top, visible_right - visible_left, | 877 scroll, gfx::Rect(visible_left, visible_top, visible_right - visible_left, |
| 878 visible_bottom - visible_top)); | 878 visible_bottom - visible_top)); |
| 879 if (is_hardware_accelerated && browser_view_renderer_.attached_to_window()) { | 879 if (is_hardware_accelerated && browser_view_renderer_.attached_to_window()) { |
| 880 return browser_view_renderer_.OnDrawHardware(); | 880 return browser_view_renderer_.OnDrawHardware(); |
| 881 } | 881 } |
| 882 | 882 |
| 883 gfx::Size view_size = browser_view_renderer_.size(); | 883 gfx::Size view_size = browser_view_renderer_.size(); |
| 884 if (view_size.IsEmpty()) | 884 if (view_size.IsEmpty()) { |
| 885 TRACE_EVENT_INSTANT0("android_webview", "EarlyOut_EmptySize", |
| 886 TRACE_EVENT_SCOPE_THREAD); |
| 885 return false; | 887 return false; |
| 888 } |
| 886 | 889 |
| 887 // TODO(hush): Right now webview size is passed in as the auxiliary bitmap | 890 // TODO(hush): Right now webview size is passed in as the auxiliary bitmap |
| 888 // size, which might hurt performace (only for software draws with auxiliary | 891 // size, which might hurt performace (only for software draws with auxiliary |
| 889 // bitmap). For better performance, get global visible rect, transform it | 892 // bitmap). For better performance, get global visible rect, transform it |
| 890 // from screen space to view space, then intersect with the webview in | 893 // from screen space to view space, then intersect with the webview in |
| 891 // viewspace. Use the resulting rect as the auxiliary bitmap. | 894 // viewspace. Use the resulting rect as the auxiliary bitmap. |
| 892 scoped_ptr<SoftwareCanvasHolder> canvas_holder = | 895 scoped_ptr<SoftwareCanvasHolder> canvas_holder = |
| 893 SoftwareCanvasHolder::Create(canvas, scroll, view_size); | 896 SoftwareCanvasHolder::Create(canvas, scroll, view_size); |
| 894 if (!canvas_holder || !canvas_holder->GetCanvas()) | 897 if (!canvas_holder || !canvas_holder->GetCanvas()) { |
| 898 TRACE_EVENT_INSTANT0("android_webview", "EarlyOut_EmptySize", |
| 899 TRACE_EVENT_SCOPE_THREAD); |
| 895 return false; | 900 return false; |
| 901 } |
| 896 return browser_view_renderer_.OnDrawSoftware(canvas_holder->GetCanvas()); | 902 return browser_view_renderer_.OnDrawSoftware(canvas_holder->GetCanvas()); |
| 897 } | 903 } |
| 898 | 904 |
| 899 void AwContents::SetPendingWebContentsForPopup( | 905 void AwContents::SetPendingWebContentsForPopup( |
| 900 scoped_ptr<content::WebContents> pending) { | 906 scoped_ptr<content::WebContents> pending) { |
| 901 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 907 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 902 if (pending_contents_.get()) { | 908 if (pending_contents_.get()) { |
| 903 // TODO(benm): Support holding multiple pop up window requests. | 909 // TODO(benm): Support holding multiple pop up window requests. |
| 904 LOG(WARNING) << "Blocking popup window creation as an outstanding " | 910 LOG(WARNING) << "Blocking popup window creation as an outstanding " |
| 905 << "popup window is still pending."; | 911 << "popup window is still pending."; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 base::Owned(port1), | 1124 base::Owned(port1), |
| 1119 base::Owned(port2))); | 1125 base::Owned(port2))); |
| 1120 } | 1126 } |
| 1121 | 1127 |
| 1122 | 1128 |
| 1123 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1129 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
| 1124 g_should_download_favicons = true; | 1130 g_should_download_favicons = true; |
| 1125 } | 1131 } |
| 1126 | 1132 |
| 1127 } // namespace android_webview | 1133 } // namespace android_webview |
| OLD | NEW |