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

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

Issue 2807653003: Move Work From CompositorFrameSinkSupport() To Init() (Closed)
Patch Set: Add CompositorFrameSinkSupport::Create 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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 } 826 }
827 } 827 }
828 828
829 void DelegatedFrameHost::UnlockResources() { 829 void DelegatedFrameHost::UnlockResources() {
830 DCHECK(local_surface_id_.is_valid()); 830 DCHECK(local_surface_id_.is_valid());
831 delegated_frame_evictor_->UnlockFrame(); 831 delegated_frame_evictor_->UnlockFrame();
832 } 832 }
833 833
834 void DelegatedFrameHost::CreateCompositorFrameSinkSupport() { 834 void DelegatedFrameHost::CreateCompositorFrameSinkSupport() {
835 DCHECK(!support_); 835 DCHECK(!support_);
836 constexpr bool is_root = false;
837 constexpr bool handles_frame_sink_id_invalidation = false;
838 constexpr bool needs_sync_points = true;
836 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 839 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
837 support_ = base::MakeUnique<cc::CompositorFrameSinkSupport>( 840 support_ = cc::CompositorFrameSinkSupport::Create(
838 this, factory->GetContextFactoryPrivate()->GetSurfaceManager(), 841 this, factory->GetContextFactoryPrivate()->GetSurfaceManager(),
839 frame_sink_id_, false /* is_root */, 842 frame_sink_id_, is_root, handles_frame_sink_id_invalidation,
840 false /* handles_frame_sink_id_invalidation */, 843 needs_sync_points);
841 true /* needs_sync_points */);
842 if (compositor_) 844 if (compositor_)
843 compositor_->AddFrameSink(frame_sink_id_); 845 compositor_->AddFrameSink(frame_sink_id_);
844 if (needs_begin_frame_) 846 if (needs_begin_frame_)
845 support_->SetNeedsBeginFrame(true); 847 support_->SetNeedsBeginFrame(true);
846 } 848 }
847 849
848 void DelegatedFrameHost::ResetCompositorFrameSinkSupport() { 850 void DelegatedFrameHost::ResetCompositorFrameSinkSupport() {
849 if (!support_) 851 if (!support_)
850 return; 852 return;
851 if (compositor_) 853 if (compositor_)
852 compositor_->RemoveFrameSink(frame_sink_id_); 854 compositor_->RemoveFrameSink(frame_sink_id_);
853 support_.reset(); 855 support_.reset();
854 } 856 }
855 857
856 void DelegatedFrameHost::DidFinishFrame(const cc::BeginFrameAck& ack) { 858 void DelegatedFrameHost::DidFinishFrame(const cc::BeginFrameAck& ack) {
857 if (ack.source_id != latest_confirmed_begin_frame_source_id_) { 859 if (ack.source_id != latest_confirmed_begin_frame_source_id_) {
858 // Source changed, we don't know our freshness anymore. 860 // Source changed, we don't know our freshness anymore.
859 latest_confirmed_begin_frame_sequence_number_ = 861 latest_confirmed_begin_frame_sequence_number_ =
860 cc::BeginFrameArgs::kInvalidFrameNumber; 862 cc::BeginFrameArgs::kInvalidFrameNumber;
861 } 863 }
862 864
863 if (!skipped_frames_) { 865 if (!skipped_frames_) {
864 latest_confirmed_begin_frame_source_id_ = ack.source_id; 866 latest_confirmed_begin_frame_source_id_ = ack.source_id;
865 latest_confirmed_begin_frame_sequence_number_ = 867 latest_confirmed_begin_frame_sequence_number_ =
866 ack.latest_confirmed_sequence_number; 868 ack.latest_confirmed_sequence_number;
867 } 869 }
868 } 870 }
869 871
870 } // namespace content 872 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698