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

Unified Diff: cc/test/fake_surface_observer.h

Issue 2854163003: [cc] Plumb BeginFrameAcks through SurfaceManager to DisplayScheduler. (Closed)
Patch Set: fix clang compile error 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/surface_synchronization_unittest.cc ('k') | cc/test/fake_surface_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/fake_surface_observer.h
diff --git a/cc/test/fake_surface_observer.h b/cc/test/fake_surface_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..bf325e7d5b0892583740536a339bc1e86b087099
--- /dev/null
+++ b/cc/test/fake_surface_observer.h
@@ -0,0 +1,55 @@
+// 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_TEST_FAKE_SURFACE_OBSERVER_H_
+#define CC_TEST_FAKE_SURFACE_OBSERVER_H_
+
+#include "base/containers/flat_set.h"
+#include "cc/output/begin_frame_args.h"
+#include "cc/surfaces/surface_id.h"
+#include "cc/surfaces/surface_info.h"
+#include "cc/surfaces/surface_observer.h"
+
+namespace cc {
+
+class FakeSurfaceObserver : public SurfaceObserver {
+ public:
+ // If |damage_display| is true, the observer will indicate display damage when
+ // a surface is damaged.
+ explicit FakeSurfaceObserver(bool damage_display = true);
+ virtual ~FakeSurfaceObserver();
+
+ const BeginFrameAck& last_ack() const { return last_ack_; }
+
+ bool IsSurfaceDamaged(const SurfaceId& surface_id) const;
+
+ const SurfaceId& last_created_surface_id() const {
+ return last_created_surface_id_;
+ }
+
+ const SurfaceInfo& last_surface_info() const { return last_surface_info_; }
+
+ void Reset();
+
+ private:
+ // SurfaceObserver implementation:
+ void OnSurfaceDamaged(const SurfaceId& surface_id,
+ const BeginFrameAck& ack,
+ bool* changed) override;
+ void OnSurfaceCreated(const SurfaceInfo& surface_info) override;
+ void OnSurfaceDiscarded(const SurfaceId& surface_id) override {}
+ void OnSurfaceDestroyed(const SurfaceId& surface_id) override {}
+ void OnSurfaceDamageExpected(const SurfaceId& surface_id,
+ const BeginFrameArgs& args) override {}
+
+ bool damage_display_;
+ BeginFrameAck last_ack_;
+ base::flat_set<SurfaceId> damaged_surfaces_;
+ SurfaceId last_created_surface_id_;
+ SurfaceInfo last_surface_info_;
+};
+
+} // namespace cc
+
+#endif // CC_TEST_FAKE_SURFACE_OBSERVER_H_
« no previous file with comments | « cc/surfaces/surface_synchronization_unittest.cc ('k') | cc/test/fake_surface_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698