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

Side by Side Diff: content/browser/renderer_host/delegated_frame_host.cc

Issue 2774373002: Use MojoCompositorFrameSink in RendererCompositorFrameSink (Closed)
Patch Set: Rebased, dedup IPC Created 3 years, 8 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 "content/browser/renderer_host/delegated_frame_host.h" 5 #include "content/browser/renderer_host/delegated_frame_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 // To avoid unnecessary browser composites, try to go directly to the Surface 371 // To avoid unnecessary browser composites, try to go directly to the Surface
372 // rather than through the Layer (which goes through the browser compositor). 372 // rather than through the Layer (which goes through the browser compositor).
373 if (has_frame_ && request_copy_of_output_callback_for_testing_.is_null()) { 373 if (has_frame_ && request_copy_of_output_callback_for_testing_.is_null()) {
374 support_->RequestCopyOfSurface(std::move(request)); 374 support_->RequestCopyOfSurface(std::move(request));
375 } else { 375 } else {
376 RequestCopyOfOutput(std::move(request)); 376 RequestCopyOfOutput(std::move(request));
377 } 377 }
378 } 378 }
379 379
380 void DelegatedFrameHost::DidCreateNewRendererCompositorFrameSink() { 380 void DelegatedFrameHost::DidCreateNewRendererCompositorFrameSink(
381 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink) {
381 ResetCompositorFrameSinkSupport(); 382 ResetCompositorFrameSinkSupport();
383 renderer_compositor_frame_sink_ = renderer_compositor_frame_sink;
382 CreateCompositorFrameSinkSupport(); 384 CreateCompositorFrameSinkSupport();
383 has_frame_ = false; 385 has_frame_ = false;
384 } 386 }
385 387
386 void DelegatedFrameHost::SubmitCompositorFrame( 388 void DelegatedFrameHost::SubmitCompositorFrame(
387 const cc::LocalSurfaceId& local_surface_id, 389 const cc::LocalSurfaceId& local_surface_id,
388 cc::CompositorFrame frame) { 390 cc::CompositorFrame frame) {
389 #if defined(OS_CHROMEOS) 391 #if defined(OS_CHROMEOS)
390 DCHECK(!resize_lock_ || !client_->IsAutoResizeEnabled()); 392 DCHECK(!resize_lock_ || !client_->IsAutoResizeEnabled());
391 #endif 393 #endif
(...skipping 14 matching lines...) Expand all
406 gfx::ConvertRectToDIP(frame_device_scale_factor, damage_rect); 408 gfx::ConvertRectToDIP(frame_device_scale_factor, damage_rect);
407 409
408 if (ShouldSkipFrame(frame_size_in_dip)) { 410 if (ShouldSkipFrame(frame_size_in_dip)) {
409 cc::ReturnedResourceArray resources; 411 cc::ReturnedResourceArray resources;
410 cc::TransferableResource::ReturnResources(frame.resource_list, &resources); 412 cc::TransferableResource::ReturnResources(frame.resource_list, &resources);
411 413
412 skipped_latency_info_list_.insert(skipped_latency_info_list_.end(), 414 skipped_latency_info_list_.insert(skipped_latency_info_list_.end(),
413 frame.metadata.latency_info.begin(), 415 frame.metadata.latency_info.begin(),
414 frame.metadata.latency_info.end()); 416 frame.metadata.latency_info.end());
415 417
416 client_->DelegatedFrameHostSendReclaimCompositorResources( 418 renderer_compositor_frame_sink_->DidReceiveCompositorFrameAck(resources);
417 true /* is_swap_ack*/, resources); 419
418 skipped_frames_ = true; 420 skipped_frames_ = true;
419 BeginFrameDidNotSwap(ack); 421 BeginFrameDidNotSwap(ack);
420 return; 422 return;
421 } 423 }
422 424
423 // If we are allowing one renderer frame through, this would ensure the frame 425 // If we are allowing one renderer frame through, this would ensure the frame
424 // gets through even if we regrab the lock after the UI compositor makes one 426 // gets through even if we regrab the lock after the UI compositor makes one
425 // frame. If the renderer frame beats the UI compositor, then we don't need to 427 // frame. If the renderer frame beats the UI compositor, then we don't need to
426 // allow any more, though. 428 // allow any more, though.
427 allow_one_renderer_frame_during_resize_lock_ = false; 429 allow_one_renderer_frame_during_resize_lock_ = false;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 489
488 DidFinishFrame(ack); 490 DidFinishFrame(ack);
489 } 491 }
490 492
491 void DelegatedFrameHost::ClearDelegatedFrame() { 493 void DelegatedFrameHost::ClearDelegatedFrame() {
492 EvictDelegatedFrame(); 494 EvictDelegatedFrame();
493 } 495 }
494 496
495 void DelegatedFrameHost::DidReceiveCompositorFrameAck( 497 void DelegatedFrameHost::DidReceiveCompositorFrameAck(
496 const cc::ReturnedResourceArray& resources) { 498 const cc::ReturnedResourceArray& resources) {
497 client_->DelegatedFrameHostSendReclaimCompositorResources( 499 renderer_compositor_frame_sink_->DidReceiveCompositorFrameAck(resources);
498 true /* is_swap_ack */, resources);
499 } 500 }
500 501
501 void DelegatedFrameHost::ReclaimResources( 502 void DelegatedFrameHost::ReclaimResources(
502 const cc::ReturnedResourceArray& resources) { 503 const cc::ReturnedResourceArray& resources) {
503 client_->DelegatedFrameHostSendReclaimCompositorResources( 504 renderer_compositor_frame_sink_->ReclaimResources(resources);
504 false /* is_swap_ack */, resources);
505 } 505 }
506 506
507 void DelegatedFrameHost::WillDrawSurface(const cc::LocalSurfaceId& id, 507 void DelegatedFrameHost::WillDrawSurface(const cc::LocalSurfaceId& id,
508 const gfx::Rect& damage_rect) { 508 const gfx::Rect& damage_rect) {
509 // Frame subscribers are only interested in changes to the target surface, so 509 // Frame subscribers are only interested in changes to the target surface, so
510 // do not attempt capture if |damage_rect| is empty. This prevents the draws 510 // do not attempt capture if |damage_rect| is empty. This prevents the draws
511 // of parent surfaces from triggering extra frame captures, which can affect 511 // of parent surfaces from triggering extra frame captures, which can affect
512 // smoothness. 512 // smoothness.
513 if (id != local_surface_id_ || damage_rect.IsEmpty()) 513 if (id != local_surface_id_ || damage_rect.IsEmpty())
514 return; 514 return;
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 } 862 }
863 863
864 if (!skipped_frames_) { 864 if (!skipped_frames_) {
865 latest_confirmed_begin_frame_source_id_ = ack.source_id; 865 latest_confirmed_begin_frame_source_id_ = ack.source_id;
866 latest_confirmed_begin_frame_sequence_number_ = 866 latest_confirmed_begin_frame_sequence_number_ =
867 ack.latest_confirmed_sequence_number; 867 ack.latest_confirmed_sequence_number;
868 } 868 }
869 } 869 }
870 870
871 } // namespace content 871 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/delegated_frame_host.h ('k') | content/browser/renderer_host/delegated_frame_host_client_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698