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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 // If the WebView is on a layer, WebView does not know what transform is | 232 // 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. | 233 // applied onto the layer so global visible rect does not make sense here. |
234 // In this case, just use the surface rect for tiling. | 234 // In this case, just use the surface rect for tiling. |
235 gfx::Rect viewport_rect_for_tile_priority; | 235 gfx::Rect viewport_rect_for_tile_priority; |
236 | 236 |
237 // Leave viewport_rect_for_tile_priority empty if offscreen_pre_raster_ is on. | 237 // Leave viewport_rect_for_tile_priority empty if offscreen_pre_raster_ is on. |
238 if (!offscreen_pre_raster_ && !external_draw_constraints_.is_layer) { | 238 if (!offscreen_pre_raster_ && !external_draw_constraints_.is_layer) { |
239 viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_; | 239 viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_; |
240 } | 240 } |
241 | 241 |
242 /* Nullptr will be received as this is now async */ | |
242 content::SynchronousCompositor::Frame frame = | 243 content::SynchronousCompositor::Frame frame = |
243 compositor_->DemandDrawHw(surface_size, | 244 compositor_->DemandDrawHw(surface_size, |
244 gfx::Transform(), | 245 gfx::Transform(), |
245 viewport, | 246 viewport, |
246 clip, | 247 clip, |
247 viewport_rect_for_tile_priority, | 248 viewport_rect_for_tile_priority, |
248 transform_for_tile_priority); | 249 transform_for_tile_priority); |
249 if (!frame.frame.get()) { | 250 if (!frame.frame.get()) { |
250 TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame", | 251 TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame", |
251 TRACE_EVENT_SCOPE_THREAD); | 252 TRACE_EVENT_SCOPE_THREAD); |
252 return current_compositor_frame_consumer_->HasFrameOnUI(); | 253 return current_compositor_frame_consumer_->HasFrameOnUI(); |
253 } | 254 } |
254 | 255 |
255 std::unique_ptr<ChildFrame> child_frame = base::WrapUnique(new ChildFrame( | 256 std::unique_ptr<ChildFrame> child_frame = base::WrapUnique(new ChildFrame( |
256 frame.output_surface_id, std::move(frame.frame), compositor_id_, | 257 frame.output_surface_id, std::move(frame.frame), compositor_id_, |
257 viewport_rect_for_tile_priority.IsEmpty(), transform_for_tile_priority, | 258 viewport_rect_for_tile_priority.IsEmpty(), transform_for_tile_priority, |
258 offscreen_pre_raster_, external_draw_constraints_.is_layer)); | 259 offscreen_pre_raster_, external_draw_constraints_.is_layer)); |
259 | 260 |
260 ReturnUnusedResource( | 261 ReturnUnusedResource( |
261 current_compositor_frame_consumer_->PassUncommittedFrameOnUI()); | 262 current_compositor_frame_consumer_->PassUncommittedFrameOnUI()); |
262 current_compositor_frame_consumer_->SetFrameOnUI(std::move(child_frame)); | 263 current_compositor_frame_consumer_->SetFrameOnUI(std::move(child_frame)); |
263 return true; | 264 return true; |
264 } | 265 } |
265 | 266 |
267 void BrowserViewRenderer::OnDrawHardwareProcessFrame( | |
boliu
2016/07/24 17:33:54
You want to add this method to SynchronousComposit
ojars
2016/07/28 22:53:55
Done.
| |
268 content::SynchronousCompositor::Frame frame) { | |
269 std::unique_ptr<ChildFrame> child_frame = base::WrapUnique(new ChildFrame( | |
270 frame.output_surface_id, std::move(frame.frame), compositor_id_, | |
271 viewport_rect_for_tile_priority.IsEmpty(), transform_for_tile_priority, | |
272 offscreen_pre_raster_, external_draw_constraints_.is_layer)); | |
273 | |
274 ReturnUnusedResource( | |
275 current_compositor_frame_consumer_->PassUncommittedFrameOnUI()); | |
276 current_compositor_frame_consumer_->SetFrameOnUI(std::move(child_frame)); | |
277 return true; | |
278 } | |
279 | |
266 void BrowserViewRenderer::OnParentDrawConstraintsUpdated( | 280 void BrowserViewRenderer::OnParentDrawConstraintsUpdated( |
267 CompositorFrameConsumer* compositor_frame_consumer) { | 281 CompositorFrameConsumer* compositor_frame_consumer) { |
268 DCHECK(compositor_frame_consumer); | 282 DCHECK(compositor_frame_consumer); |
269 if (compositor_frame_consumer != current_compositor_frame_consumer_) | 283 if (compositor_frame_consumer != current_compositor_frame_consumer_) |
270 return; | 284 return; |
271 PostInvalidate(compositor_); | 285 PostInvalidate(compositor_); |
272 external_draw_constraints_ = | 286 external_draw_constraints_ = |
273 current_compositor_frame_consumer_->GetParentDrawConstraintsOnUI(); | 287 current_compositor_frame_consumer_->GetParentDrawConstraintsOnUI(); |
274 UpdateMemoryPolicy(); | 288 UpdateMemoryPolicy(); |
275 } | 289 } |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
740 base::StringAppendF(&str, | 754 base::StringAppendF(&str, |
741 "overscroll_rounding_error_: %s ", | 755 "overscroll_rounding_error_: %s ", |
742 overscroll_rounding_error_.ToString().c_str()); | 756 overscroll_rounding_error_.ToString().c_str()); |
743 base::StringAppendF( | 757 base::StringAppendF( |
744 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); | 758 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); |
745 base::StringAppendF(&str, "clear_view: %d ", clear_view_); | 759 base::StringAppendF(&str, "clear_view: %d ", clear_view_); |
746 return str; | 760 return str; |
747 } | 761 } |
748 | 762 |
749 } // namespace android_webview | 763 } // namespace android_webview |
OLD | NEW |