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

Unified Diff: cc/resources/single_release_callback.cc

Issue 23648014: cc: Move TextureMailbox::ReleaseCallback to SingleReleaseCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: releasecallback: SingleReleaseCallback 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
« no previous file with comments | « cc/resources/single_release_callback.h ('k') | cc/resources/texture_mailbox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/single_release_callback.cc
diff --git a/cc/resources/single_release_callback.cc b/cc/resources/single_release_callback.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9c6b9de5f07635a26c55567e3059277c0d609083
--- /dev/null
+++ b/cc/resources/single_release_callback.cc
@@ -0,0 +1,29 @@
+// 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.
+
+#include "cc/resources/single_release_callback.h"
+
+#include "base/callback_helpers.h"
+#include "base/logging.h"
+
+namespace cc {
+
+SingleReleaseCallback::SingleReleaseCallback(const ReleaseCallback& callback)
+ : has_been_run_(false), callback_(callback) {
+ DCHECK(!callback_.is_null())
+ << "Use a NULL SingleReleaseCallback for an empty callback.";
+}
+
+SingleReleaseCallback::~SingleReleaseCallback() {
+ DCHECK(callback_.is_null() || has_been_run_)
+ << "SingleReleaseCallback was never run.";
+}
+
+void SingleReleaseCallback::Run(unsigned sync_point, bool is_lost) {
+ DCHECK(!has_been_run_) << "SingleReleaseCallback was run more than once.";
+ has_been_run_ = true;
+ callback_.Run(sync_point, is_lost);
+}
+
+} // namespace cc
« no previous file with comments | « cc/resources/single_release_callback.h ('k') | cc/resources/texture_mailbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698