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

Unified Diff: base/cancelable_callback.h

Issue 846543002: Make CancelableCallback::weak_factory_ the last member (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: style Created 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/cancelable_callback.h
diff --git a/base/cancelable_callback.h b/base/cancelable_callback.h
index 91eb046153c9cc5412e9339dd19a1c181d7337bf..2b9d26094641b2133bc2ba55fe744aa88086bc8a 100644
--- a/base/cancelable_callback.h
+++ b/base/cancelable_callback.h
@@ -62,8 +62,7 @@ class CancelableCallback<void(A...)> {
// |callback| must not be null.
explicit CancelableCallback(const base::Callback<void(A...)>& callback)
- : weak_factory_(this),
- callback_(callback) {
+ : callback_(callback), weak_factory_(this) {
DCHECK(!callback.is_null());
InitializeForwarder();
}
@@ -113,17 +112,15 @@ class CancelableCallback<void(A...)> {
weak_factory_.GetWeakPtr());
}
- // Used to ensure Forward() is not run when this object is destroyed.
- // TODO(ckehoe): This should be the last class member.
- // Move it there when crbug.com/433583 is fixed.
- base::WeakPtrFactory<CancelableCallback<void(A...)> > weak_factory_;
-
// The wrapper closure.
base::Callback<void(A...)> forwarder_;
// The stored closure that may be cancelled.
base::Callback<void(A...)> callback_;
+ // Used to ensure Forward() is not run when this object is destroyed.
+ base::WeakPtrFactory<CancelableCallback<void(A...)>> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(CancelableCallback);
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698