| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/browser_view_renderer.h" | 5 #include "android_webview/browser/browser_view_renderer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "android_webview/browser/browser_view_renderer_client.h" | 9 #include "android_webview/browser/browser_view_renderer_client.h" |
| 10 #include "android_webview/browser/compositor_frame_consumer.h" | 10 #include "android_webview/browser/compositor_frame_consumer.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 BrowserViewRenderer* BrowserViewRenderer::FromWebContents( | 86 BrowserViewRenderer* BrowserViewRenderer::FromWebContents( |
| 87 content::WebContents* web_contents) { | 87 content::WebContents* web_contents) { |
| 88 return BrowserViewRendererUserData::GetBrowserViewRenderer(web_contents); | 88 return BrowserViewRendererUserData::GetBrowserViewRenderer(web_contents); |
| 89 } | 89 } |
| 90 | 90 |
| 91 BrowserViewRenderer::BrowserViewRenderer( | 91 BrowserViewRenderer::BrowserViewRenderer( |
| 92 BrowserViewRendererClient* client, | 92 BrowserViewRendererClient* client, |
| 93 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) | 93 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) |
| 94 : client_(client), | 94 : client_(client), |
| 95 ui_task_runner_(ui_task_runner), | 95 ui_task_runner_(ui_task_runner), |
| 96 async_on_draw_hardware_(base::CommandLine::ForCurrentProcess()->HasSwitch( | 96 sync_on_draw_hardware_(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 97 switches::kAsyncOnDrawHardware)), | 97 switches::kSyncOnDrawHardware)), |
| 98 current_compositor_frame_consumer_(nullptr), | 98 current_compositor_frame_consumer_(nullptr), |
| 99 compositor_(nullptr), | 99 compositor_(nullptr), |
| 100 is_paused_(false), | 100 is_paused_(false), |
| 101 view_visible_(false), | 101 view_visible_(false), |
| 102 window_visible_(false), | 102 window_visible_(false), |
| 103 attached_to_window_(false), | 103 attached_to_window_(false), |
| 104 hardware_enabled_(false), | 104 hardware_enabled_(false), |
| 105 dip_scale_(0.f), | 105 dip_scale_(0.f), |
| 106 page_scale_factor_(1.f), | 106 page_scale_factor_(1.f), |
| 107 min_page_scale_factor_(0.f), | 107 min_page_scale_factor_(0.f), |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 UpdateMemoryPolicy(); | 227 UpdateMemoryPolicy(); |
| 228 | 228 |
| 229 gfx::Transform transform_for_tile_priority = | 229 gfx::Transform transform_for_tile_priority = |
| 230 external_draw_constraints_.transform; | 230 external_draw_constraints_.transform; |
| 231 | 231 |
| 232 gfx::Rect viewport_rect_for_tile_priority = | 232 gfx::Rect viewport_rect_for_tile_priority = |
| 233 ComputeViewportRectForTilePriority(); | 233 ComputeViewportRectForTilePriority(); |
| 234 | 234 |
| 235 scoped_refptr<content::SynchronousCompositor::FrameFuture> future; // Async. | 235 scoped_refptr<content::SynchronousCompositor::FrameFuture> future; // Async. |
| 236 content::SynchronousCompositor::Frame frame; // Sync. | 236 content::SynchronousCompositor::Frame frame; // Sync. |
| 237 bool async = async_on_draw_hardware_ && allow_async_draw_; | 237 bool async = !sync_on_draw_hardware_ && allow_async_draw_; |
| 238 if (async) { | 238 if (async) { |
| 239 future = compositor_->DemandDrawHwAsync( | 239 future = compositor_->DemandDrawHwAsync( |
| 240 size_, viewport_rect_for_tile_priority, transform_for_tile_priority); | 240 size_, viewport_rect_for_tile_priority, transform_for_tile_priority); |
| 241 } else { | 241 } else { |
| 242 frame = compositor_->DemandDrawHw(size_, viewport_rect_for_tile_priority, | 242 frame = compositor_->DemandDrawHw(size_, viewport_rect_for_tile_priority, |
| 243 transform_for_tile_priority); | 243 transform_for_tile_priority); |
| 244 } | 244 } |
| 245 | 245 |
| 246 if (!frame.frame && !future) { | 246 if (!frame.frame && !future) { |
| 247 TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame", | 247 TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame", |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 base::StringAppendF(&str, | 765 base::StringAppendF(&str, |
| 766 "overscroll_rounding_error_: %s ", | 766 "overscroll_rounding_error_: %s ", |
| 767 overscroll_rounding_error_.ToString().c_str()); | 767 overscroll_rounding_error_.ToString().c_str()); |
| 768 base::StringAppendF( | 768 base::StringAppendF( |
| 769 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); | 769 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); |
| 770 base::StringAppendF(&str, "clear_view: %d ", clear_view_); | 770 base::StringAppendF(&str, "clear_view: %d ", clear_view_); |
| 771 return str; | 771 return str; |
| 772 } | 772 } |
| 773 | 773 |
| 774 } // namespace android_webview | 774 } // namespace android_webview |
| OLD | NEW |