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

Side by Side Diff: base/callback_internal.h

Issue 2042223002: Introduce OnceClosure and BindOnce (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: swap Once & Repeating positions Created 4 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 unified diff | Download patch
« no previous file with comments | « base/callback_forward.h ('k') | base/callback_internal.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file contains utility functions and classes that help the 5 // This file contains utility functions and classes that help the
6 // implementation, and management of the Callback objects. 6 // implementation, and management of the Callback objects.
7 7
8 #ifndef BASE_CALLBACK_INTERNAL_H_ 8 #ifndef BASE_CALLBACK_INTERNAL_H_
9 #define BASE_CALLBACK_INTERNAL_H_ 9 #define BASE_CALLBACK_INTERNAL_H_
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // Holds the Callback methods that don't require specialization to reduce 70 // Holds the Callback methods that don't require specialization to reduce
71 // template bloat. 71 // template bloat.
72 // CallbackBase<MoveOnly> is a direct base class of MoveOnly callbacks, and 72 // CallbackBase<MoveOnly> is a direct base class of MoveOnly callbacks, and
73 // CallbackBase<Copyable> uses CallbackBase<MoveOnly> for its implementation. 73 // CallbackBase<Copyable> uses CallbackBase<MoveOnly> for its implementation.
74 template <> 74 template <>
75 class BASE_EXPORT CallbackBase<CopyMode::MoveOnly> { 75 class BASE_EXPORT CallbackBase<CopyMode::MoveOnly> {
76 public: 76 public:
77 CallbackBase(CallbackBase&& c); 77 CallbackBase(CallbackBase&& c);
78 CallbackBase& operator=(CallbackBase&& c); 78 CallbackBase& operator=(CallbackBase&& c);
79 79
80 explicit CallbackBase(const CallbackBase<CopyMode::Copyable>& c);
81 CallbackBase& operator=(const CallbackBase<CopyMode::Copyable>& c);
82
80 // Returns true if Callback is null (doesn't refer to anything). 83 // Returns true if Callback is null (doesn't refer to anything).
81 bool is_null() const { return bind_state_.get() == NULL; } 84 bool is_null() const { return bind_state_.get() == NULL; }
82 explicit operator bool() const { return !is_null(); } 85 explicit operator bool() const { return !is_null(); }
83 86
84 // Returns true if the callback invocation will be nop due to an cancellation. 87 // Returns true if the callback invocation will be nop due to an cancellation.
85 // It's invalid to call this on uninitialized callback. 88 // It's invalid to call this on uninitialized callback.
86 bool IsCancelled() const; 89 bool IsCancelled() const;
87 90
88 // Returns the Callback into an uninitialized state. 91 // Returns the Callback into an uninitialized state.
89 void Reset(); 92 void Reset();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 ~CallbackBase() {} 128 ~CallbackBase() {}
126 }; 129 };
127 130
128 extern template class CallbackBase<CopyMode::MoveOnly>; 131 extern template class CallbackBase<CopyMode::MoveOnly>;
129 extern template class CallbackBase<CopyMode::Copyable>; 132 extern template class CallbackBase<CopyMode::Copyable>;
130 133
131 } // namespace internal 134 } // namespace internal
132 } // namespace base 135 } // namespace base
133 136
134 #endif // BASE_CALLBACK_INTERNAL_H_ 137 #endif // BASE_CALLBACK_INTERNAL_H_
OLDNEW
« no previous file with comments | « base/callback_forward.h ('k') | base/callback_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698