Index: cc/output/forced_redraw_swap_promise.cc |
diff --git a/cc/output/forced_redraw_swap_promise.cc b/cc/output/forced_redraw_swap_promise.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b719638fb9cf3c9b95a177ac1b172872600d8bb5 |
--- /dev/null |
+++ b/cc/output/forced_redraw_swap_promise.cc |
@@ -0,0 +1,33 @@ |
+// 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/output/forced_redraw_swap_promise.h" |
+ |
+#include "base/logging.h" |
+#include "base/trace_event/trace_event.h" |
+ |
+namespace cc { |
+ |
+ForcedRedrawSwapPromise::ForcedRedrawSwapPromise(const ui::LatencyInfo& latency) |
+ : latency_(latency) {} |
+ |
+ForcedRedrawSwapPromise::~ForcedRedrawSwapPromise() = default; |
+ |
+void ForcedRedrawSwapPromise::DidSwap(CompositorFrameMetadata* metadata) { |
+ DCHECK(!latency_.terminated()); |
+ metadata->latency_info.push_back(latency_); |
+} |
+ |
+SwapPromise::DidNotSwapAction ForcedRedrawSwapPromise::DidNotSwap( |
+ DidNotSwapReason reason) { |
+ return reason == DidNotSwapReason::SWAP_FAILS |
+ ? DidNotSwapAction::KEEP_ACTIVE |
+ : DidNotSwapAction::DEFAULT_ACTION; |
+} |
+ |
+int64_t ForcedRedrawSwapPromise::TraceId() const { |
+ return latency_.trace_id(); |
+} |
+ |
+} // namespace cc |