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

Unified Diff: content/browser/compositor/delegated_frame_host.cc

Issue 1304063014: cc: Plumbing for BeginFrameSource based on Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« cc/surfaces/surface_aggregator.cc ('K') | « cc/surfaces/surface_factory_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/delegated_frame_host.cc
diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc
index c6657b7974e50224fff636414b9cc22e5d64418b..ea85703ffc415b46504b6f7fe22c95f633e1aaa8 100644
--- a/content/browser/compositor/delegated_frame_host.cc
+++ b/content/browser/compositor/delegated_frame_host.cc
@@ -61,6 +61,7 @@ DelegatedFrameHost::DelegatedFrameHost(DelegatedFrameHostClient* client)
: client_(client),
compositor_(nullptr),
use_surfaces_(UseSurfacesEnabled()),
+ current_begin_frame_source_(nullptr),
tick_clock_(new base::DefaultTickClock()),
last_output_surface_id_(0),
pending_delegated_ack_count_(0),
@@ -68,11 +69,28 @@ DelegatedFrameHost::DelegatedFrameHost(DelegatedFrameHostClient* client)
current_scale_factor_(1.f),
can_lock_compositor_(YES_CAN_LOCK),
delegated_frame_evictor_(new DelegatedFrameEvictor(this)) {
+ SetCurrentBeginFrameSource(nullptr);
ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
factory->AddObserver(this);
id_allocator_ = factory->GetContextFactory()->CreateSurfaceIdAllocator();
}
+void DelegatedFrameHost::SetCurrentBeginFrameSource(BeginFrameSource* new_bfs) {
+ if (!new_bfs) {
+ // FIXME(mithro): Add a OrphanedBeginFrameSource
+ // FIXME(mithro): We can probably figure out a better BeginFrameSource to use here using what the DelegatedFrameHost.
+ new_bfs = OrphanedBeginFrameSource::getSource();
+ }
+
+ // FIXME(mithro): This will need some of the BeginFrameSourceMultiplexer stuff....
+ if (new_bfs != current_begin_frame_source_) {
+ if (current_begin_frame_source_)
+ current_begin_frame_source_->RemoveObserver(this);
+ current_begin_frame_source_ = new_bfs;
+ current_begin_frame_source_->AddObserver(this);
+ }
+}
+
void DelegatedFrameHost::WasShown(const ui::LatencyInfo& latency_info) {
delegated_frame_evictor_->SetVisible(true);
@@ -480,6 +498,11 @@ void DelegatedFrameHost::SwapDelegatedFrame(
// Note: the frame may have been evicted immediately.
}
+void DelegatedFrameHost::SetBeginFrameSource(SurfaceId id, BeginFrameSource* new_bfs) {
+ if (id != surface_id_) return;
+ SetCurrentBeginFrameSource(new_bfs);
+}
+
void DelegatedFrameHost::SendDelegatedFrameAck(uint32 output_surface_id) {
cc::CompositorFrameAck ack;
if (!surface_returned_resources_.empty())
@@ -941,6 +964,10 @@ DelegatedFrameHost::~DelegatedFrameHost() {
if (resource_collection_.get())
resource_collection_->SetClient(NULL);
+ DCHECK_EQ(current_begin_frame_source_, OrphanBeginFrameSource::getSource());
+ current_begin_frame_source_->RemoveObserver(this);
+ current_begin_frame_source_ = NULL;
+
DCHECK(!vsync_manager_.get());
}
« cc/surfaces/surface_aggregator.cc ('K') | « cc/surfaces/surface_factory_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698