| 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/child_frame.h" | 10 #include "android_webview/browser/child_frame.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 current_compositor_frame_consumer_->SetScrollOffsetOnUI( | 216 current_compositor_frame_consumer_->SetScrollOffsetOnUI( |
| 217 last_on_draw_scroll_offset_); | 217 last_on_draw_scroll_offset_); |
| 218 hardware_enabled_ = true; | 218 hardware_enabled_ = true; |
| 219 | 219 |
| 220 external_draw_constraints_ = | 220 external_draw_constraints_ = |
| 221 current_compositor_frame_consumer_->GetParentDrawConstraintsOnUI(); | 221 current_compositor_frame_consumer_->GetParentDrawConstraintsOnUI(); |
| 222 | 222 |
| 223 ReturnResourceFromParent(current_compositor_frame_consumer_); | 223 ReturnResourceFromParent(current_compositor_frame_consumer_); |
| 224 UpdateMemoryPolicy(); | 224 UpdateMemoryPolicy(); |
| 225 | 225 |
| 226 gfx::Size surface_size(size_); | |
| 227 gfx::Rect viewport(surface_size); | |
| 228 gfx::Rect clip = viewport; | |
| 229 gfx::Transform transform_for_tile_priority = | 226 gfx::Transform transform_for_tile_priority = |
| 230 external_draw_constraints_.transform; | 227 external_draw_constraints_.transform; |
| 231 | 228 |
| 232 // If the WebView is on a layer, WebView does not know what transform is | 229 // If the WebView is on a layer, WebView does not know what transform is |
| 233 // applied onto the layer so global visible rect does not make sense here. | 230 // applied onto the layer so global visible rect does not make sense here. |
| 234 // In this case, just use the surface rect for tiling. | 231 // In this case, just use the surface rect for tiling. |
| 235 gfx::Rect viewport_rect_for_tile_priority; | 232 gfx::Rect viewport_rect_for_tile_priority; |
| 236 | 233 |
| 237 // Leave viewport_rect_for_tile_priority empty if offscreen_pre_raster_ is on. | 234 // Leave viewport_rect_for_tile_priority empty if offscreen_pre_raster_ is on. |
| 238 if (!offscreen_pre_raster_ && !external_draw_constraints_.is_layer) { | 235 if (!offscreen_pre_raster_ && !external_draw_constraints_.is_layer) { |
| 239 viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_; | 236 viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_; |
| 240 } | 237 } |
| 241 | 238 |
| 242 content::SynchronousCompositor::Frame frame = | 239 content::SynchronousCompositor::Frame frame = compositor_->DemandDrawHw( |
| 243 compositor_->DemandDrawHw(surface_size, | 240 size_, viewport_rect_for_tile_priority, transform_for_tile_priority); |
| 244 gfx::Transform(), | |
| 245 viewport, | |
| 246 clip, | |
| 247 viewport_rect_for_tile_priority, | |
| 248 transform_for_tile_priority); | |
| 249 if (!frame.frame.get()) { | 241 if (!frame.frame.get()) { |
| 250 TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame", | 242 TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame", |
| 251 TRACE_EVENT_SCOPE_THREAD); | 243 TRACE_EVENT_SCOPE_THREAD); |
| 252 return current_compositor_frame_consumer_->HasFrameOnUI(); | 244 return current_compositor_frame_consumer_->HasFrameOnUI(); |
| 253 } | 245 } |
| 254 | 246 |
| 255 std::unique_ptr<ChildFrame> child_frame = base::WrapUnique(new ChildFrame( | 247 std::unique_ptr<ChildFrame> child_frame = base::WrapUnique(new ChildFrame( |
| 256 frame.output_surface_id, std::move(frame.frame), compositor_id_, | 248 frame.output_surface_id, std::move(frame.frame), compositor_id_, |
| 257 viewport_rect_for_tile_priority.IsEmpty(), transform_for_tile_priority, | 249 viewport_rect_for_tile_priority.IsEmpty(), transform_for_tile_priority, |
| 258 offscreen_pre_raster_, external_draw_constraints_.is_layer)); | 250 offscreen_pre_raster_, external_draw_constraints_.is_layer)); |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 base::StringAppendF(&str, | 732 base::StringAppendF(&str, |
| 741 "overscroll_rounding_error_: %s ", | 733 "overscroll_rounding_error_: %s ", |
| 742 overscroll_rounding_error_.ToString().c_str()); | 734 overscroll_rounding_error_.ToString().c_str()); |
| 743 base::StringAppendF( | 735 base::StringAppendF( |
| 744 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); | 736 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); |
| 745 base::StringAppendF(&str, "clear_view: %d ", clear_view_); | 737 base::StringAppendF(&str, "clear_view: %d ", clear_view_); |
| 746 return str; | 738 return str; |
| 747 } | 739 } |
| 748 | 740 |
| 749 } // namespace android_webview | 741 } // namespace android_webview |
| OLD | NEW |