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

Unified Diff: cc/surfaces/surface_sequence.h

Issue 553213003: Avoid destroying surface before the parent surface stops referencing it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/surfaces/surface_sequence.h
diff --git a/cc/surfaces/surface_sequence.h b/cc/surfaces/surface_sequence.h
new file mode 100644
index 0000000000000000000000000000000000000000..8526024f99e56fee86b89222ec9336b12cbbe7aa
--- /dev/null
+++ b/cc/surfaces/surface_sequence.h
@@ -0,0 +1,40 @@
+// Copyright 2014 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_SURFACES_SURFACE_SEQUENCE_H_
+#define CC_SURFACES_SURFACE_SEQUENCE_H_
+
+#include "base/compiler_specific.h"
jamesr 2014/09/24 04:51:01 don't think you need this (since this type isn't h
+
+namespace cc {
+
+// A per-surface-namespace sequence number that's used to coordinate
+// dependencies between frames. A sequence number may be satisfied once, and
+// may be depended on once.
+struct SurfaceSequence {
+ SurfaceSequence() : id_namespace(0u), sequence(0u) {}
+ explicit SurfaceSequence(uint32_t id_namespace, uint32_t sequence)
jamesr 2014/09/24 04:51:01 no explicit for 2-arg c'tors
+ : id_namespace(id_namespace), sequence(sequence) {}
+
+ uint32_t id_namespace;
+ uint32_t sequence;
+};
+
+inline bool operator==(const SurfaceSequence& a, const SurfaceSequence& b) {
+ return a.id_namespace == b.id_namespace && a.sequence == b.sequence;
+}
+
+inline bool operator!=(const SurfaceSequence& a, const SurfaceSequence& b) {
+ return !(a == b);
+}
+
+inline bool operator<(const SurfaceSequence& a, const SurfaceSequence& b) {
+ if (a.id_namespace != b.id_namespace)
+ return a.id_namespace < b.id_namespace;
+ return a.sequence < b.sequence;
+}
+
+} // namespace cc
+
+#endif // CC_SURFACES_SURFACE_SEQUENCE_H_

Powered by Google App Engine
This is Rietveld 408576698