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

Unified Diff: cc/surfaces/surface_dependency_deadline.h

Issue 2887453002: SurfaceDependencyTracker: Only observe BeginFrames if a deadline is needed (Closed)
Patch Set: Fixed an incorrect DCHECK Created 3 years, 7 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
« no previous file with comments | « cc/surfaces/BUILD.gn ('k') | cc/surfaces/surface_dependency_deadline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_dependency_deadline.h
diff --git a/cc/surfaces/surface_dependency_deadline.h b/cc/surfaces/surface_dependency_deadline.h
new file mode 100644
index 0000000000000000000000000000000000000000..f226bd0985f5df03e157312361386753aebe36b6
--- /dev/null
+++ b/cc/surfaces/surface_dependency_deadline.h
@@ -0,0 +1,44 @@
+// Copyright 2017 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.
+
+#ifndef CC_SURFACES_SURFACE_DEPENDENCY_DEADLINE_H_
+#define CC_SURFACES_SURFACE_DEPENDENCY_DEADLINE_H_
+
+#include "cc/scheduler/begin_frame_source.h"
+
+namespace cc {
+
+class SurfaceDependencyTracker;
+
+class SurfaceDependencyDeadline : public BeginFrameObserver {
+ public:
+ SurfaceDependencyDeadline(SurfaceDependencyTracker* dependency_tracker,
+ BeginFrameSource* begin_frame_source);
+ ~SurfaceDependencyDeadline() override;
+
+ void Set(uint32_t number_of_frames_to_deadline);
+ void Cancel();
+
+ bool has_deadline() const {
+ return number_of_frames_to_deadline_.has_value();
+ }
+
+ // BeginFrameObserver implementation.
+ void OnBeginFrame(const BeginFrameArgs& args) override;
+ const BeginFrameArgs& LastUsedBeginFrameArgs() const override;
+ void OnBeginFrameSourcePausedChanged(bool paused) override;
+
+ private:
+ SurfaceDependencyTracker* const dependency_tracker_;
+ BeginFrameSource* begin_frame_source_ = nullptr;
+ base::Optional<uint32_t> number_of_frames_to_deadline_;
+
+ BeginFrameArgs last_begin_frame_args_;
+
+ DISALLOW_COPY_AND_ASSIGN(SurfaceDependencyDeadline);
+};
+
+} // namespace cc
+
+#endif // CC_SURFACES_SURFACE_DEPENDENCY_DEADLINE_H_
« no previous file with comments | « cc/surfaces/BUILD.gn ('k') | cc/surfaces/surface_dependency_deadline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698