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

Unified Diff: cc/base/swap_promise.h

Issue 60513007: Add SwapPromise support to LayerTreeHost and LayerTreeImpl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rework SwapPromise() interface to have virtual DidSwap() & DidNotSwap() interface Created 7 years, 1 month 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 | « no previous file | cc/cc.gyp » ('j') | cc/cc.gyp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/swap_promise.h
diff --git a/cc/base/swap_promise.h b/cc/base/swap_promise.h
new file mode 100644
index 0000000000000000000000000000000000000000..5b213d2ddb73b78956840c34fa5b904e96b2f283
--- /dev/null
+++ b/cc/base/swap_promise.h
@@ -0,0 +1,51 @@
+// Copyright 2013 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_BASE_SWAP_PROMISE_H_
+#define CC_BASE_SWAP_PROMISE_H_
+
+#include "base/compiler_specific.h"
+
+namespace cc {
+
+// A SwapPromise can be queued into LTH/LTI to track if an expected swap
danakj 2013/11/13 23:22:09 spell out LayerTreeHost(Impl) here
Yufeng Shen (Slow to review) 2013/11/14 22:09:55 Done.
+// buffer will happen or not. If the swap buffer happens, DidSwap() will
danakj 2013/11/13 23:22:09 Can you reword this comment to match what I wrote
Yufeng Shen (Slow to review) 2013/11/14 22:09:55 Done.
+// be called, and if the swap buffer somehow fails to happen, DidNotSwap()
+// will be called.
+// Client wishes to use SwapPromise should have a subclass that defines
+// the behavior of DidSwap() and DidNotSwap(). Notice that swap buffer can
+// fail at main/impl thread, so don't assume that DidSwap() and DidNotSwap()
+// are called at a particular thread. It is better to let the subclass carry
+// thread-safe member data and operate on that member data in DidSwap() and
+// DidNotSwap().
+class SwapPromise {
+ public:
+ enum SwapPromiseType {
+ SWAP_PROMISE_UNKNOWN,
+ };
+
+ explicit SwapPromise(SwapPromiseType type);
+ virtual ~SwapPromise() {}
+
+ enum DidNotSwapReason {
+ DID_NOT_SWAP_UNKNOWN,
+ SWAP_FAILS,
+ COMMIT_FAILS,
+ SWAP_PROMISE_LIST_OVERFLOW,
+ };
+
+ SwapPromiseType type() {
danakj 2013/11/13 23:22:09 If there's only one type, what's the point of this
Yufeng Shen (Slow to review) 2013/11/14 22:09:55 It is intended that subclass added in the future w
danakj 2013/11/20 03:00:55 Then I prefer we add it in a later patch that will
Yufeng Shen (Slow to review) 2013/11/20 19:15:41 removed.
+ return type_;
+ }
+
+ virtual void DidSwap() = 0;
+ virtual void DidNotSwap(DidNotSwapReason reason) = 0;
+
+ protected:
+ SwapPromiseType type_;
+};
+
+} // namespace cc
+
+#endif // CC_BASE_SWAP_PROMISE_H_
« no previous file with comments | « no previous file | cc/cc.gyp » ('j') | cc/cc.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698