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

Side by Side Diff: base/cancelable_callback.h

Issue 11794032: base: Update the calls from MessageLoop::Quit() to QuitWhenIdle(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/file_util_proxy_unittest.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) 2011 The Chromium Authors. All rights reserved. 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 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 // CancelableCallback is a wrapper around base::Callback that allows 5 // CancelableCallback is a wrapper around base::Callback that allows
6 // cancellation of a callback. CancelableCallback takes a reference on the 6 // cancellation of a callback. CancelableCallback takes a reference on the
7 // wrapped callback until this object is destroyed or Reset()/Cancel() are 7 // wrapped callback until this object is destroyed or Reset()/Cancel() are
8 // called. 8 // called.
9 // 9 //
10 // NOTE: 10 // NOTE:
(...skipping 10 matching lines...) Expand all
21 // 21 //
22 // EXAMPLE USAGE: 22 // EXAMPLE USAGE:
23 // 23 //
24 // In the following example, the test is verifying that RunIntensiveTest() 24 // In the following example, the test is verifying that RunIntensiveTest()
25 // Quit()s the message loop within 4 seconds. The cancelable callback is posted 25 // Quit()s the message loop within 4 seconds. The cancelable callback is posted
26 // to the message loop, the intensive test runs, the message loop is run, 26 // to the message loop, the intensive test runs, the message loop is run,
27 // then the callback is cancelled. 27 // then the callback is cancelled.
28 // 28 //
29 // void TimeoutCallback(const std::string& timeout_message) { 29 // void TimeoutCallback(const std::string& timeout_message) {
30 // FAIL() << timeout_message; 30 // FAIL() << timeout_message;
31 // MessageLoop::current()->Quit(); 31 // MessageLoop::current()->QuitWhenIdle();
32 // } 32 // }
33 // 33 //
34 // CancelableClosure timeout(base::Bind(&TimeoutCallback, "Test timed out.")); 34 // CancelableClosure timeout(base::Bind(&TimeoutCallback, "Test timed out."));
35 // MessageLoop::current()->PostDelayedTask(FROM_HERE, timeout.callback(), 35 // MessageLoop::current()->PostDelayedTask(FROM_HERE, timeout.callback(),
36 // 4000) // 4 seconds to run. 36 // 4000) // 4 seconds to run.
37 // RunIntensiveTest(); 37 // RunIntensiveTest();
38 // MessageLoop::current()->Run(); 38 // MessageLoop::current()->Run();
39 // timeout.Cancel(); // Hopefully this is hit before the timeout callback runs. 39 // timeout.Cancel(); // Hopefully this is hit before the timeout callback runs.
40 // 40 //
41 41
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 base::Callback<void(A1)> callback_; 193 base::Callback<void(A1)> callback_;
194 194
195 DISALLOW_COPY_AND_ASSIGN(CancelableCallback); 195 DISALLOW_COPY_AND_ASSIGN(CancelableCallback);
196 }; 196 };
197 197
198 typedef CancelableCallback<void(void)> CancelableClosure; 198 typedef CancelableCallback<void(void)> CancelableClosure;
199 199
200 } // namespace base 200 } // namespace base
201 201
202 #endif // BASE_CANCELABLE_CALLBACK_H_ 202 #endif // BASE_CANCELABLE_CALLBACK_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_util_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698