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

Unified Diff: cc/resources/scoped_release_callback.h

Issue 23648014: cc: Move TextureMailbox::ReleaseCallback to SingleReleaseCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: releasecallback: missingfiles Created 7 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/resources/scoped_release_callback.h
diff --git a/cc/resources/scoped_release_callback.h b/cc/resources/scoped_release_callback.h
new file mode 100644
index 0000000000000000000000000000000000000000..d19c7bffcaeb9f99abd578b862441e47391aec2f
--- /dev/null
+++ b/cc/resources/scoped_release_callback.h
@@ -0,0 +1,44 @@
+// 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_RESOURCES_SCOPED_RELEASE_CALLBACK_H_
+#define CC_RESOURCES_SCOPED_RELEASE_CALLBACK_H_
+
+#include "base/move.h"
+#include "cc/base/cc_export.h"
+#include "cc/resources/release_callback.h"
+
+namespace cc {
+
+// A ReleaseCallback that can only have one owner. It must have RunAndReset()
awong 2013/09/13 07:07:19 ??? As is, can't people just copy ReleaseCallback
danakj 2013/09/13 17:32:59 Yes, we have been careful to ensure they are alway
+// called before it is destroyed.
+class CC_EXPORT ScopedReleaseCallback {
+ MOVE_ONLY_TYPE_FOR_CPP_03(ScopedReleaseCallback, RValue)
+ public:
+ ScopedReleaseCallback();
+ explicit ScopedReleaseCallback(const ReleaseCallback& callback);
+ // This constructor is for Pass().
+ ScopedReleaseCallback(RValue other); // NOLINT(runtime/explicit)
+ ~ScopedReleaseCallback();
+
+ void RunAndReset(unsigned sync_point, bool is_lost);
+
+ // Move-only emulation, only usable with Pass().
+ ScopedReleaseCallback& operator=(ScopedReleaseCallback rhs);
+
+ ReleaseCallback Leak();
+
+ bool Equals(const ScopedReleaseCallback& other) const {
+ return callback_.Equals(other.callback_);
+ }
+
+ bool IsEmpty() const { return callback_.is_null(); }
piman 2013/09/13 06:08:30 nit: is_null() ? I'm not sure 'empty' qualifies a
+
+ private:
+ ReleaseCallback callback_;
+};
+
+} // namespace cc
+
+#endif // CC_RESOURCES_SCOPED_RELEASE_CALLBACK_H_

Powered by Google App Engine
This is Rietveld 408576698