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

Unified Diff: cc/surfaces/direct_surface_reference_factory.cc

Issue 2514033002: Introducing SurfaceReferenceFactory (Closed)
Patch Set: rebase Created 4 years 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/direct_surface_reference_factory.cc
diff --git a/cc/surfaces/direct_surface_reference_factory.cc b/cc/surfaces/direct_surface_reference_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e7d8ad274ad215c184bf47b16268151567585918
--- /dev/null
+++ b/cc/surfaces/direct_surface_reference_factory.cc
@@ -0,0 +1,35 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/surfaces/direct_surface_reference_factory.h"
+
+#include <vector>
+
+#include "cc/surfaces/surface.h"
+
+namespace cc {
+
+DirectSurfaceReferenceFactory::DirectSurfaceReferenceFactory(
+ SurfaceManager* manager)
+ : manager_(manager) {}
+
+void DirectSurfaceReferenceFactory::SatisfySequence(
+ const SurfaceSequence& sequence) const {
+ std::vector<uint32_t> sequences;
+ sequences.push_back(sequence.sequence);
+ manager_->DidSatisfySequences(sequence.frame_sink_id, &sequences);
+}
+
+void DirectSurfaceReferenceFactory::RequireSequence(
+ const SurfaceId& surface_id,
+ const SurfaceSequence& sequence) const {
+ auto surface = manager_->GetSurfaceForId(surface_id);
kylechar 2016/12/15 19:08:45 This is a Surface* right? The convention is to use
Saman Sami 2016/12/15 20:41:37 Done.
+ if (!surface) {
+ LOG(ERROR) << "Attempting to require callback on nonexistent surface";
+ return;
+ }
+ surface->AddDestructionDependency(sequence);
+}
+
+} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698