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

Unified Diff: cc/surfaces/display.cc

Issue 1304063014: cc: Plumbing for BeginFrameSource based on Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More use-after-free. Attempt to fix mojo. 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
Index: cc/surfaces/display.cc
diff --git a/cc/surfaces/display.cc b/cc/surfaces/display.cc
index dd776fb1bc4d118408d8557c20a7b2eefc75389b..14afd863de7c8858e7db473264c279843768ebf5 100644
--- a/cc/surfaces/display.cc
+++ b/cc/surfaces/display.cc
@@ -131,8 +131,8 @@ void Display::InitializeRenderer() {
// overlays.
bool output_partial_list = renderer_->Capabilities().using_partial_swap &&
!output_surface_->GetOverlayCandidateValidator();
- aggregator_.reset(new SurfaceAggregator(manager_, resource_provider_.get(),
- output_partial_list));
+ aggregator_.reset(new SurfaceAggregator(
+ this, manager_, resource_provider_.get(), output_partial_list));
}
void Display::DidLoseOutputSurface() {
@@ -150,6 +150,33 @@ void Display::UpdateRootSurfaceResourcesLocked() {
scheduler_->SetRootSurfaceResourcesLocked(root_surface_resources_locked);
}
+void Display::AddSurface(Surface* surface) {
+ // Checking for the output_surface ensures Display::Initialize has been
+ // called and that scheduler_ won't change its value.
+ DCHECK(output_surface_);
+
+ // TODO(brianderson): Make sure all users of Display provide a
+ // DisplayScheduler. crbug.com/476676
mithro-old 2015/10/01 03:00:23 nit: Can you put http:// before this URL so it bec
brianderson 2015/10/07 20:54:48 Done.
+ if (!scheduler_)
+ return;
+
+ surface->AddBeginFrameSource(scheduler_->begin_frame_source_for_children());
+}
+
+void Display::RemoveSurface(Surface* surface) {
+ // Checking for the output_surface ensures Display::Initialize has been
+ // called and that scheduler_ won't change its value.
+ DCHECK(output_surface_);
+
+ // TODO(brianderson): Make sure all users of Display provide a
+ // DisplayScheduler. crbug.com/476676
+ if (!scheduler_)
+ return;
+
+ surface->RemoveBeginFrameSource(
+ scheduler_->begin_frame_source_for_children());
+}
+
bool Display::DrawAndSwap() {
TRACE_EVENT0("cc", "Display::DrawAndSwap");

Powered by Google App Engine
This is Rietveld 408576698