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

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

Issue 1769913003: sync compositor: Add output_surface_id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nit in test Created 4 years, 9 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
« no previous file with comments | « no previous file | android_webview/browser/browser_view_renderer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 // If the WebView is on a layer, WebView does not know what transform is 243 // If the WebView is on a layer, WebView does not know what transform is
244 // applied onto the layer so global visible rect does not make sense here. 244 // applied onto the layer so global visible rect does not make sense here.
245 // In this case, just use the surface rect for tiling. 245 // In this case, just use the surface rect for tiling.
246 gfx::Rect viewport_rect_for_tile_priority; 246 gfx::Rect viewport_rect_for_tile_priority;
247 247
248 // Leave viewport_rect_for_tile_priority empty if offscreen_pre_raster_ is on. 248 // Leave viewport_rect_for_tile_priority empty if offscreen_pre_raster_ is on.
249 if (!offscreen_pre_raster_ && !parent_draw_constraints.is_layer) { 249 if (!offscreen_pre_raster_ && !parent_draw_constraints.is_layer) {
250 viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_; 250 viewport_rect_for_tile_priority = last_on_draw_global_visible_rect_;
251 } 251 }
252 252
253 scoped_ptr<cc::CompositorFrame> frame = 253 content::SynchronousCompositor::Frame frame =
254 compositor_->DemandDrawHw(surface_size, 254 compositor_->DemandDrawHw(surface_size,
255 gfx::Transform(), 255 gfx::Transform(),
256 viewport, 256 viewport,
257 clip, 257 clip,
258 viewport_rect_for_tile_priority, 258 viewport_rect_for_tile_priority,
259 transform_for_tile_priority); 259 transform_for_tile_priority);
260 if (!frame.get()) { 260 if (!frame.frame.get()) {
261 TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame", 261 TRACE_EVENT_INSTANT0("android_webview", "NoNewFrame",
262 TRACE_EVENT_SCOPE_THREAD); 262 TRACE_EVENT_SCOPE_THREAD);
263 return shared_renderer_state_.HasFrameOnUI(); 263 return shared_renderer_state_.HasFrameOnUI();
264 } 264 }
265 265
266 scoped_ptr<ChildFrame> child_frame = make_scoped_ptr(new ChildFrame( 266 scoped_ptr<ChildFrame> child_frame = make_scoped_ptr(new ChildFrame(
267 std::move(frame), GetCompositorID(compositor_), 267 frame.output_surface_id, std::move(frame.frame),
268 viewport_rect_for_tile_priority.IsEmpty(), transform_for_tile_priority, 268 GetCompositorID(compositor_), viewport_rect_for_tile_priority.IsEmpty(),
269 offscreen_pre_raster_, parent_draw_constraints.is_layer)); 269 transform_for_tile_priority, offscreen_pre_raster_,
270 parent_draw_constraints.is_layer));
270 271
271 ReturnUnusedResource(shared_renderer_state_.PassUncommittedFrameOnUI()); 272 ReturnUnusedResource(shared_renderer_state_.PassUncommittedFrameOnUI());
272 shared_renderer_state_.SetCompositorFrameOnUI(std::move(child_frame)); 273 shared_renderer_state_.SetCompositorFrameOnUI(std::move(child_frame));
273 return true; 274 return true;
274 } 275 }
275 276
276 void BrowserViewRenderer::UpdateParentDrawConstraints() { 277 void BrowserViewRenderer::UpdateParentDrawConstraints() {
277 PostInvalidate(); 278 PostInvalidate();
278 ParentCompositorDrawConstraints parent_draw_constraints = 279 ParentCompositorDrawConstraints parent_draw_constraints =
279 shared_renderer_state_.GetParentDrawConstraintsOnUI(); 280 shared_renderer_state_.GetParentDrawConstraintsOnUI();
280 client_->ParentDrawConstraintsUpdated(parent_draw_constraints); 281 client_->ParentDrawConstraintsUpdated(parent_draw_constraints);
281 } 282 }
282 283
283 void BrowserViewRenderer::ReturnUnusedResource( 284 void BrowserViewRenderer::ReturnUnusedResource(
284 scoped_ptr<ChildFrame> child_frame) { 285 scoped_ptr<ChildFrame> child_frame) {
285 if (!child_frame.get() || !child_frame->frame.get()) 286 if (!child_frame.get() || !child_frame->frame.get())
286 return; 287 return;
287 288
288 cc::CompositorFrameAck frame_ack; 289 cc::CompositorFrameAck frame_ack;
289 cc::TransferableResource::ReturnResources( 290 cc::TransferableResource::ReturnResources(
290 child_frame->frame->delegated_frame_data->resource_list, 291 child_frame->frame->delegated_frame_data->resource_list,
291 &frame_ack.resources); 292 &frame_ack.resources);
292 content::SynchronousCompositor* compositor = 293 content::SynchronousCompositor* compositor =
293 compositor_map_[child_frame->compositor_id]; 294 compositor_map_[child_frame->compositor_id];
294 if (compositor && !frame_ack.resources.empty()) 295 if (compositor && !frame_ack.resources.empty())
295 compositor->ReturnResources(frame_ack); 296 compositor->ReturnResources(child_frame->output_surface_id, frame_ack);
296 } 297 }
297 298
298 void BrowserViewRenderer::ReturnResourceFromParent() { 299 void BrowserViewRenderer::ReturnResourceFromParent() {
299 std::map<uint32_t, cc::ReturnedResourceArray> returned_resource_map; 300 SharedRendererState::ReturnedResourcesMap returned_resource_map;
300 shared_renderer_state_.SwapReturnedResourcesOnUI(&returned_resource_map); 301 shared_renderer_state_.SwapReturnedResourcesOnUI(&returned_resource_map);
301 for (auto iterator = returned_resource_map.begin(); 302 for (auto iterator = returned_resource_map.begin();
302 iterator != returned_resource_map.end(); iterator++) { 303 iterator != returned_resource_map.end(); iterator++) {
303 uint32_t compositor_id = iterator->first; 304 uint32_t compositor_id = iterator->first;
304 content::SynchronousCompositor* compositor = compositor_map_[compositor_id]; 305 content::SynchronousCompositor* compositor = compositor_map_[compositor_id];
305 cc::CompositorFrameAck frame_ack; 306 cc::CompositorFrameAck frame_ack;
306 frame_ack.resources.swap(iterator->second); 307 frame_ack.resources.swap(iterator->second.resources);
307 308
308 if (compositor && !frame_ack.resources.empty()) 309 if (compositor && !frame_ack.resources.empty()) {
309 compositor->ReturnResources(frame_ack); 310 compositor->ReturnResources(iterator->second.output_surface_id,
311 frame_ack);
312 }
310 } 313 }
311 } 314 }
312 315
313 void BrowserViewRenderer::DetachFunctorFromView() { 316 void BrowserViewRenderer::DetachFunctorFromView() {
314 client_->DetachFunctorFromView(); 317 client_->DetachFunctorFromView();
315 } 318 }
316 319
317 bool BrowserViewRenderer::OnDrawSoftware(SkCanvas* canvas) { 320 bool BrowserViewRenderer::OnDrawSoftware(SkCanvas* canvas) {
318 return CanOnDraw() && CompositeSW(canvas); 321 return CanOnDraw() && CompositeSW(canvas);
319 } 322 }
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 base::StringAppendF(&str, 726 base::StringAppendF(&str,
724 "overscroll_rounding_error_: %s ", 727 "overscroll_rounding_error_: %s ",
725 overscroll_rounding_error_.ToString().c_str()); 728 overscroll_rounding_error_.ToString().c_str());
726 base::StringAppendF( 729 base::StringAppendF(
727 &str, "on_new_picture_enable: %d ", on_new_picture_enable_); 730 &str, "on_new_picture_enable: %d ", on_new_picture_enable_);
728 base::StringAppendF(&str, "clear_view: %d ", clear_view_); 731 base::StringAppendF(&str, "clear_view: %d ", clear_view_);
729 return str; 732 return str;
730 } 733 }
731 734
732 } // namespace android_webview 735 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | android_webview/browser/browser_view_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698