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

Unified Diff: base/callback.h

Issue 2317563002: Move CallbackBase::polymorphic_invoke_ into BindStateBase (Closed)
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/bind_internal.h ('k') | base/callback_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/callback.h
diff --git a/base/callback.h b/base/callback.h
index 15e84086f30279a143736c58cfbada1bd4f6843e..d173a3c7b6b47b564e698d02fe60a7b3d1947ca2 100644
--- a/base/callback.h
+++ b/base/callback.h
@@ -22,22 +22,17 @@ namespace base {
template <typename R, typename... Args, internal::CopyMode copy_mode>
class Callback<R(Args...), copy_mode>
: public internal::CallbackBase<copy_mode> {
- private:
+ public:
using PolymorphicInvoke = R (*)(internal::BindStateBase*, Args&&...);
- public:
// MSVC 2013 doesn't support Type Alias of function types.
// Revisit this after we update it to newer version.
typedef R RunType(Args...);
Callback() : internal::CallbackBase<copy_mode>(nullptr) {}
- Callback(internal::BindStateBase* bind_state, PolymorphicInvoke invoke_func)
+ explicit Callback(internal::BindStateBase* bind_state)
: internal::CallbackBase<copy_mode>(bind_state) {
- using InvokeFuncStorage =
- typename internal::CallbackBase<copy_mode>::InvokeFuncStorage;
- this->polymorphic_invoke_ =
- reinterpret_cast<InvokeFuncStorage>(invoke_func);
}
bool Equals(const Callback& other) const {
@@ -57,7 +52,7 @@ class Callback<R(Args...), copy_mode>
// cannot template its arguments based on how it's called.
R Run(Args... args) const {
PolymorphicInvoke f =
- reinterpret_cast<PolymorphicInvoke>(this->polymorphic_invoke_);
+ reinterpret_cast<PolymorphicInvoke>(this->polymorphic_invoke());
return f(this->bind_state_.get(), std::forward<Args>(args)...);
}
};
« no previous file with comments | « base/bind_internal.h ('k') | base/callback_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698