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

Side by Side Diff: base/cancelable_callback.cc

Issue 8673008: base::Bind: Implement CancelableCallback to replace CancelableTaske. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/cancelable_callback.h"
6
7 namespace base {
8
9 CancelableCallback::CancelableCallback(const base::Closure callback)
10 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
11 forwarder_(base::Bind(&CancelableCallback::RunCallback,
12 weak_factory_.GetWeakPtr())),
13 callback_(callback) {
binji 2011/11/23 02:21:44 check for !callback.is_null?
James Hawkins 2011/11/23 03:59:08 Done.
14 }
15
16 void CancelableCallback::Cancel() {
17 weak_factory_.InvalidateWeakPtrs();
18 }
19
20 const base::Closure& CancelableCallback::callback() const {
21 return forwarder_;
22 }
23
24 void CancelableCallback::RunCallback() {
25 callback_.Run();
26 }
27
28 }
groby-ooo-7-16 2011/11/23 02:14:12 nit: } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698