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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 TRACE_EVENT0("android_webview", | 255 TRACE_EVENT0("android_webview", |
256 "BrowserViewRenderer::OnDrawHardwareProcessFrame"); | 256 "BrowserViewRenderer::OnDrawHardwareProcessFrame"); |
257 if (!frame.frame) | 257 if (!frame.frame) |
258 return; | 258 return; |
259 | 259 |
260 gfx::Transform transform_for_tile_priority = | 260 gfx::Transform transform_for_tile_priority = |
261 external_draw_constraints_.transform; | 261 external_draw_constraints_.transform; |
262 gfx::Rect viewport_rect_for_tile_priority = | 262 gfx::Rect viewport_rect_for_tile_priority = |
263 ComputeViewportRectForTilePriority(); | 263 ComputeViewportRectForTilePriority(); |
264 std::unique_ptr<ChildFrame> child_frame = base::MakeUnique<ChildFrame>( | 264 std::unique_ptr<ChildFrame> child_frame = base::MakeUnique<ChildFrame>( |
265 frame.output_surface_id, std::move(frame.frame), compositor_id_, | 265 frame.compositor_frame_sink_id, std::move(frame.frame), compositor_id_, |
266 viewport_rect_for_tile_priority.IsEmpty(), transform_for_tile_priority, | 266 viewport_rect_for_tile_priority.IsEmpty(), transform_for_tile_priority, |
267 offscreen_pre_raster_, external_draw_constraints_.is_layer); | 267 offscreen_pre_raster_, external_draw_constraints_.is_layer); |
268 | 268 |
269 ReturnUnusedResource( | 269 ReturnUnusedResource( |
270 current_compositor_frame_consumer_->PassUncommittedFrameOnUI()); | 270 current_compositor_frame_consumer_->PassUncommittedFrameOnUI()); |
271 current_compositor_frame_consumer_->SetFrameOnUI(std::move(child_frame)); | 271 current_compositor_frame_consumer_->SetFrameOnUI(std::move(child_frame)); |
272 } | 272 } |
273 | 273 |
274 gfx::Rect BrowserViewRenderer::ComputeViewportRectForTilePriority() { | 274 gfx::Rect BrowserViewRenderer::ComputeViewportRectForTilePriority() { |
275 // If the WebView is on a layer, WebView does not know what transform is | 275 // If the WebView is on a layer, WebView does not know what transform is |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 std::unique_ptr<ChildFrame> child_frame) { | 315 std::unique_ptr<ChildFrame> child_frame) { |
316 if (!child_frame.get() || !child_frame->frame.get()) | 316 if (!child_frame.get() || !child_frame->frame.get()) |
317 return; | 317 return; |
318 | 318 |
319 cc::ReturnedResourceArray resources; | 319 cc::ReturnedResourceArray resources; |
320 cc::TransferableResource::ReturnResources( | 320 cc::TransferableResource::ReturnResources( |
321 child_frame->frame->delegated_frame_data->resource_list, &resources); | 321 child_frame->frame->delegated_frame_data->resource_list, &resources); |
322 content::SynchronousCompositor* compositor = | 322 content::SynchronousCompositor* compositor = |
323 FindCompositor(child_frame->compositor_id); | 323 FindCompositor(child_frame->compositor_id); |
324 if (compositor && !resources.empty()) | 324 if (compositor && !resources.empty()) |
325 compositor->ReturnResources(child_frame->output_surface_id, resources); | 325 compositor->ReturnResources(child_frame->compositor_frame_sink_id, |
| 326 resources); |
326 } | 327 } |
327 | 328 |
328 void BrowserViewRenderer::ReturnResourceFromParent( | 329 void BrowserViewRenderer::ReturnResourceFromParent( |
329 CompositorFrameConsumer* compositor_frame_consumer) { | 330 CompositorFrameConsumer* compositor_frame_consumer) { |
330 CompositorFrameConsumer::ReturnedResourcesMap returned_resource_map; | 331 CompositorFrameConsumer::ReturnedResourcesMap returned_resource_map; |
331 compositor_frame_consumer->SwapReturnedResourcesOnUI(&returned_resource_map); | 332 compositor_frame_consumer->SwapReturnedResourcesOnUI(&returned_resource_map); |
332 for (auto& pair : returned_resource_map) { | 333 for (auto& pair : returned_resource_map) { |
333 CompositorID compositor_id = pair.first; | 334 CompositorID compositor_id = pair.first; |
334 content::SynchronousCompositor* compositor = FindCompositor(compositor_id); | 335 content::SynchronousCompositor* compositor = FindCompositor(compositor_id); |
335 cc::ReturnedResourceArray resources; | 336 cc::ReturnedResourceArray resources; |
336 resources.swap(pair.second.resources); | 337 resources.swap(pair.second.resources); |
337 | 338 |
338 if (compositor && !resources.empty()) { | 339 if (compositor && !resources.empty()) { |
339 compositor->ReturnResources(pair.second.output_surface_id, resources); | 340 compositor->ReturnResources(pair.second.compositor_frame_sink_id, |
| 341 resources); |
340 } | 342 } |
341 } | 343 } |
342 } | 344 } |
343 | 345 |
344 bool BrowserViewRenderer::OnDrawSoftware(SkCanvas* canvas) { | 346 bool BrowserViewRenderer::OnDrawSoftware(SkCanvas* canvas) { |
345 return CanOnDraw() && CompositeSW(canvas); | 347 return CanOnDraw() && CompositeSW(canvas); |
346 } | 348 } |
347 | 349 |
348 sk_sp<SkPicture> BrowserViewRenderer::CapturePicture(int width, | 350 sk_sp<SkPicture> BrowserViewRenderer::CapturePicture(int width, |
349 int height) { | 351 int height) { |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 base::StringAppendF(&str, | 767 base::StringAppendF(&str, |
766 "overscroll_rounding_error_: %s ", | 768 "overscroll_rounding_error_: %s ", |
767 overscroll_rounding_error_.ToString().c_str()); | 769 overscroll_rounding_error_.ToString().c_str()); |
768 base::StringAppendF( | 770 base::StringAppendF( |
769 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); | 771 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); |
770 base::StringAppendF(&str, "clear_view: %d ", clear_view_); | 772 base::StringAppendF(&str, "clear_view: %d ", clear_view_); |
771 return str; | 773 return str; |
772 } | 774 } |
773 | 775 |
774 } // namespace android_webview | 776 } // namespace android_webview |
OLD | NEW |