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

Unified Diff: base/callback_helpers.h

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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 | « base/callback_forward.h ('k') | base/callback_helpers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/callback_helpers.h
diff --git a/base/callback_helpers.h b/base/callback_helpers.h
deleted file mode 100644
index 8481e3e71c0fc6c79f04e87e1158282888cb38cc..0000000000000000000000000000000000000000
--- a/base/callback_helpers.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2012 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.
-
-// This defines helpful methods for dealing with Callbacks. Because Callbacks
-// are implemented using templates, with a class per callback signature, adding
-// methods to Callback<> itself is unattractive (lots of extra code gets
-// generated). Instead, consider adding methods here.
-//
-// ResetAndReturn(&cb) is like cb.Reset() but allows executing a callback (via a
-// copy) after the original callback is Reset(). This can be handy if Run()
-// reads/writes the variable holding the Callback.
-
-#ifndef BASE_CALLBACK_HELPERS_H_
-#define BASE_CALLBACK_HELPERS_H_
-
-#include "base/basictypes.h"
-#include "base/callback.h"
-#include "base/compiler_specific.h"
-
-namespace base {
-
-template <typename Sig>
-base::Callback<Sig> ResetAndReturn(base::Callback<Sig>* cb) {
- base::Callback<Sig> ret(*cb);
- cb->Reset();
- return ret;
-}
-
-// ScopedClosureRunner is akin to scoped_ptr for Closures. It ensures that the
-// Closure is executed and deleted no matter how the current scope exits.
-class BASE_EXPORT ScopedClosureRunner {
- public:
- ScopedClosureRunner();
- explicit ScopedClosureRunner(const Closure& closure);
- ~ScopedClosureRunner();
-
- void Reset();
- void Reset(const Closure& closure);
- Closure Release() WARN_UNUSED_RESULT;
-
- private:
- Closure closure_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedClosureRunner);
-};
-
-} // namespace base
-
-#endif // BASE_CALLBACK_HELPERS_H_
« no previous file with comments | « base/callback_forward.h ('k') | base/callback_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698