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

Unified Diff: cc/output/forced_redraw_swap_promise.cc

Issue 2185823005: Make RenderViewImpl::OnForceRedraw more robust (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comments and add tests Created 4 years, 4 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
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

Powered by Google App Engine
This is Rietveld 408576698