Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1979)

Side by Side Diff: android_webview/browser/browser_view_renderer.cc

Issue 2096493002: Make cc::CompositorFrames movable [Part 1 of 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make CompositorFrameMetadata movable Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_; 240 viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_;
241 } 241 }
242 242
243 content::SynchronousCompositor::Frame frame = 243 content::SynchronousCompositor::Frame frame =
244 compositor_->DemandDrawHw(surface_size, 244 compositor_->DemandDrawHw(surface_size,
245 gfx::Transform(), 245 gfx::Transform(),
246 viewport, 246 viewport,
247 clip, 247 clip,
248 viewport_rect_for_tile_priority, 248 viewport_rect_for_tile_priority,
249 transform_for_tile_priority); 249 transform_for_tile_priority);
250 if (!frame.frame.get()) { 250 if (!frame.frame) {
251 TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame", 251 TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame",
252 TRACE_EVENT_SCOPE_THREAD); 252 TRACE_EVENT_SCOPE_THREAD);
253 return current_compositor_frame_consumer_->HasFrameOnUI(); 253 return current_compositor_frame_consumer_->HasFrameOnUI();
254 } 254 }
255 255
256 std::unique_ptr<ChildFrame> child_frame = base::WrapUnique(new ChildFrame( 256 std::unique_ptr<ChildFrame> child_frame = base::WrapUnique(new ChildFrame(
257 frame.output_surface_id, std::move(frame.frame), compositor_id_, 257 frame.output_surface_id, std::move(*frame.frame), compositor_id_,
258 viewport_rect_for_tile_priority.IsEmpty(), transform_for_tile_priority, 258 viewport_rect_for_tile_priority.IsEmpty(), transform_for_tile_priority,
259 offscreen_pre_raster_, external_draw_constraints_.is_layer)); 259 offscreen_pre_raster_, external_draw_constraints_.is_layer));
260 260
261 ReturnUnusedResource( 261 ReturnUnusedResource(
262 current_compositor_frame_consumer_->PassUncommittedFrameOnUI()); 262 current_compositor_frame_consumer_->PassUncommittedFrameOnUI());
263 current_compositor_frame_consumer_->SetFrameOnUI(std::move(child_frame)); 263 current_compositor_frame_consumer_->SetFrameOnUI(std::move(child_frame));
264 return true; 264 return true;
265 } 265 }
266 266
267 void BrowserViewRenderer::OnParentDrawConstraintsUpdated( 267 void BrowserViewRenderer::OnParentDrawConstraintsUpdated(
(...skipping 18 matching lines...) Expand all
286 // At this point the compositor frame consumer has to hand back all resources 286 // At this point the compositor frame consumer has to hand back all resources
287 // to the child compositor. 287 // to the child compositor.
288 compositor_frame_consumer->DeleteHardwareRendererOnUI(); 288 compositor_frame_consumer->DeleteHardwareRendererOnUI();
289 ReturnUnusedResource(compositor_frame_consumer->PassUncommittedFrameOnUI()); 289 ReturnUnusedResource(compositor_frame_consumer->PassUncommittedFrameOnUI());
290 ReturnResourceFromParent(compositor_frame_consumer); 290 ReturnResourceFromParent(compositor_frame_consumer);
291 compositor_frame_consumer->SetCompositorFrameProducer(nullptr); 291 compositor_frame_consumer->SetCompositorFrameProducer(nullptr);
292 } 292 }
293 293
294 void BrowserViewRenderer::ReturnUnusedResource( 294 void BrowserViewRenderer::ReturnUnusedResource(
295 std::unique_ptr<ChildFrame> child_frame) { 295 std::unique_ptr<ChildFrame> child_frame) {
296 if (!child_frame.get() || !child_frame->frame.get()) 296 if (!child_frame.get() || !child_frame->frame)
297 return; 297 return;
298 298
299 cc::CompositorFrameAck frame_ack; 299 cc::CompositorFrameAck frame_ack;
300 cc::TransferableResource::ReturnResources( 300 cc::TransferableResource::ReturnResources(
301 child_frame->frame->delegated_frame_data->resource_list, 301 child_frame->frame->delegated_frame_data->resource_list,
302 &frame_ack.resources); 302 &frame_ack.resources);
303 content::SynchronousCompositor* compositor = 303 content::SynchronousCompositor* compositor =
304 FindCompositor(child_frame->compositor_id); 304 FindCompositor(child_frame->compositor_id);
305 if (compositor && !frame_ack.resources.empty()) 305 if (compositor && !frame_ack.resources.empty())
306 compositor->ReturnResources(child_frame->output_surface_id, frame_ack); 306 compositor->ReturnResources(child_frame->output_surface_id, frame_ack);
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 base::StringAppendF(&str, 739 base::StringAppendF(&str,
740 "overscroll_rounding_error_: %s ", 740 "overscroll_rounding_error_: %s ",
741 overscroll_rounding_error_.ToString().c_str()); 741 overscroll_rounding_error_.ToString().c_str());
742 base::StringAppendF( 742 base::StringAppendF(
743 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); 743 &str, "on_new_picture_enable: %d ", on_new_picture_enable_);
744 base::StringAppendF(&str, "clear_view: %d ", clear_view_); 744 base::StringAppendF(&str, "clear_view: %d ", clear_view_);
745 return str; 745 return str;
746 } 746 }
747 747
748 } // namespace android_webview 748 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | android_webview/browser/browser_view_renderer_unittest.cc » ('j') | cc/output/delegating_renderer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698