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

Side by Side Diff: base/callback_internal.h

Issue 540883002: Make base::internal::CallbackBase::is_null inline. (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 unified diff | Download patch
« no previous file with comments | « no previous file | 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 19 matching lines...) Expand all
30 protected: 30 protected:
31 friend class RefCountedThreadSafe<BindStateBase>; 31 friend class RefCountedThreadSafe<BindStateBase>;
32 virtual ~BindStateBase() {} 32 virtual ~BindStateBase() {}
33 }; 33 };
34 34
35 // Holds the Callback methods that don't require specialization to reduce 35 // Holds the Callback methods that don't require specialization to reduce
36 // template bloat. 36 // template bloat.
37 class BASE_EXPORT CallbackBase { 37 class BASE_EXPORT CallbackBase {
38 public: 38 public:
39 // Returns true if Callback is null (doesn't refer to anything). 39 // Returns true if Callback is null (doesn't refer to anything).
40 bool is_null() const; 40 bool is_null() const { return bind_state_.get() == NULL; }
41 41
42 // Returns the Callback into an uninitialized state. 42 // Returns the Callback into an uninitialized state.
43 void Reset(); 43 void Reset();
44 44
45 protected: 45 protected:
46 // In C++, it is safe to cast function pointers to function pointers of 46 // In C++, it is safe to cast function pointers to function pointers of
47 // another type. It is not okay to use void*. We create a InvokeFuncStorage 47 // another type. It is not okay to use void*. We create a InvokeFuncStorage
48 // that that can store our function pointer, and then cast it back to 48 // that that can store our function pointer, and then cast it back to
49 // the original type on usage. 49 // the original type on usage.
50 typedef void(*InvokeFuncStorage)(void); 50 typedef void(*InvokeFuncStorage)(void);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
170 template <typename T> 170 template <typename T>
171 typename enable_if<IsMoveOnlyType<T>::value, T>::type CallbackForward(T& t) { 171 typename enable_if<IsMoveOnlyType<T>::value, T>::type CallbackForward(T& t) {
172 return t.Pass(); 172 return t.Pass();
173 } 173 }
174 174
175 } // namespace internal 175 } // namespace internal
176 } // namespace base 176 } // namespace base
177 177
178 #endif // BASE_CALLBACK_INTERNAL_H_ 178 #endif // BASE_CALLBACK_INTERNAL_H_
OLDNEW
« no previous file with comments | « no previous file | base/callback_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698