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

Unified Diff: cc/test/fake_surface_observer.cc

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/test/fake_surface_observer.h ('k') | components/viz/frame_sinks/mojo_frame_sink_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/fake_surface_observer.cc
diff --git a/cc/test/fake_surface_observer.cc b/cc/test/fake_surface_observer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..15ed3b9111ee12e7f46f393ed1ca875c4d7e198b
--- /dev/null
+++ b/cc/test/fake_surface_observer.cc
@@ -0,0 +1,40 @@
+// 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.
+
+#include "cc/test/fake_surface_observer.h"
+
+namespace cc {
+
+FakeSurfaceObserver::FakeSurfaceObserver(bool damage_display)
+ : damage_display_(damage_display) {}
+
+FakeSurfaceObserver::~FakeSurfaceObserver() {}
+
+void FakeSurfaceObserver::Reset() {
+ last_ack_ = BeginFrameAck();
+ damaged_surfaces_.clear();
+ last_surface_info_ = SurfaceInfo();
+ last_created_surface_id_ = SurfaceId();
+}
+
+bool FakeSurfaceObserver::IsSurfaceDamaged(const SurfaceId& surface_id) const {
+ return damaged_surfaces_.count(surface_id) > 0;
+}
+
+void FakeSurfaceObserver::OnSurfaceDamaged(const SurfaceId& surface_id,
+ const BeginFrameAck& ack,
+ bool* changed) {
+ if (ack.has_damage)
+ damaged_surfaces_.insert(surface_id);
+ last_ack_ = ack;
+ if (damage_display_)
+ *changed = true;
+}
+
+void FakeSurfaceObserver::OnSurfaceCreated(const SurfaceInfo& surface_info) {
+ last_created_surface_id_ = surface_info.id();
+ last_surface_info_ = surface_info;
+}
+
+} // namespace cc
« no previous file with comments | « cc/test/fake_surface_observer.h ('k') | components/viz/frame_sinks/mojo_frame_sink_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698