Commit 91cae259 authored by tfarina@chromium.org's avatar tfarina@chromium.org

base: Update the calls from MessageLoop::Quit() to QuitWhenIdle().

Quit() is deprecated and we should switch to QuitWhenIdle().

BUG=131220
R=darin@chromium.org


Review URL: https://chromiumcodereview.appspot.com/11794032

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176082 0039d316-1c4b-4281-b951-d872f2087c98
parent 3c1ed419
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
// //
// void TimeoutCallback(const std::string& timeout_message) { // void TimeoutCallback(const std::string& timeout_message) {
// FAIL() << timeout_message; // FAIL() << timeout_message;
// MessageLoop::current()->Quit(); // MessageLoop::current()->QuitWhenIdle();
// } // }
// //
// CancelableClosure timeout(base::Bind(&TimeoutCallback, "Test timed out.")); // CancelableClosure timeout(base::Bind(&TimeoutCallback, "Test timed out."));
......
...@@ -40,7 +40,7 @@ class FileUtilProxyTest : public testing::Test { ...@@ -40,7 +40,7 @@ class FileUtilProxyTest : public testing::Test {
void DidFinish(PlatformFileError error) { void DidFinish(PlatformFileError error) {
error_ = error; error_ = error;
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
void DidCreateOrOpen(PlatformFileError error, void DidCreateOrOpen(PlatformFileError error,
...@@ -49,7 +49,7 @@ class FileUtilProxyTest : public testing::Test { ...@@ -49,7 +49,7 @@ class FileUtilProxyTest : public testing::Test {
error_ = error; error_ = error;
file_ = file.ReleaseValue(); file_ = file.ReleaseValue();
created_ = created; created_ = created;
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
void DidCreateTemporary(PlatformFileError error, void DidCreateTemporary(PlatformFileError error,
...@@ -58,14 +58,14 @@ class FileUtilProxyTest : public testing::Test { ...@@ -58,14 +58,14 @@ class FileUtilProxyTest : public testing::Test {
error_ = error; error_ = error;
file_ = file.ReleaseValue(); file_ = file.ReleaseValue();
path_ = path; path_ = path;
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
void DidGetFileInfo(PlatformFileError error, void DidGetFileInfo(PlatformFileError error,
const PlatformFileInfo& file_info) { const PlatformFileInfo& file_info) {
error_ = error; error_ = error;
file_info_ = file_info; file_info_ = file_info;
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
void DidRead(PlatformFileError error, void DidRead(PlatformFileError error,
...@@ -74,14 +74,14 @@ class FileUtilProxyTest : public testing::Test { ...@@ -74,14 +74,14 @@ class FileUtilProxyTest : public testing::Test {
error_ = error; error_ = error;
buffer_.resize(bytes_read); buffer_.resize(bytes_read);
memcpy(&buffer_[0], data, bytes_read); memcpy(&buffer_[0], data, bytes_read);
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
void DidWrite(PlatformFileError error, void DidWrite(PlatformFileError error,
int bytes_written) { int bytes_written) {
error_ = error; error_ = error;
bytes_written_ = bytes_written; bytes_written_ = bytes_written;
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
protected: protected:
......
...@@ -84,7 +84,7 @@ class MessageLoopProxyTest : public testing::Test { ...@@ -84,7 +84,7 @@ class MessageLoopProxyTest : public testing::Test {
static void RecordLoopAndQuit(scoped_refptr<LoopRecorder> recorder) { static void RecordLoopAndQuit(scoped_refptr<LoopRecorder> recorder) {
recorder->RecordRun(); recorder->RecordRun();
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
void UnblockTaskThread() { void UnblockTaskThread() {
......
...@@ -146,7 +146,7 @@ void RunTest_PostTask_SEH(MessageLoop::Type message_loop_type) { ...@@ -146,7 +146,7 @@ void RunTest_PostTask_SEH(MessageLoop::Type message_loop_type) {
static void SlowFunc(TimeDelta pause, int* quit_counter) { static void SlowFunc(TimeDelta pause, int* quit_counter) {
PlatformThread::Sleep(pause); PlatformThread::Sleep(pause);
if (--(*quit_counter) == 0) if (--(*quit_counter) == 0)
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
// This function records the time when Run was called in a Time object, which is // This function records the time when Run was called in a Time object, which is
...@@ -341,7 +341,7 @@ void SubPumpFunc() { ...@@ -341,7 +341,7 @@ void SubPumpFunc() {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
void RunTest_PostDelayedTask_SharedTimer_SubPump() { void RunTest_PostDelayedTask_SharedTimer_SubPump() {
...@@ -459,7 +459,7 @@ void NestingFunc(int* depth) { ...@@ -459,7 +459,7 @@ void NestingFunc(int* depth) {
MessageLoop::current()->SetNestableTasksAllowed(true); MessageLoop::current()->SetNestableTasksAllowed(true);
MessageLoop::current()->Run(); MessageLoop::current()->Run();
} }
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
#if defined(OS_WIN) #if defined(OS_WIN)
...@@ -502,7 +502,7 @@ class Crasher : public base::RefCounted<Crasher> { ...@@ -502,7 +502,7 @@ class Crasher : public base::RefCounted<Crasher> {
#error "needs architecture support" #error "needs architecture support"
#endif #endif
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
// Points the bad array to a valid memory location. // Points the bad array to a valid memory location.
static void FixError() { static void FixError() {
...@@ -726,7 +726,7 @@ void RecursiveSlowFunc(TaskList* order, int cookie, int depth, ...@@ -726,7 +726,7 @@ void RecursiveSlowFunc(TaskList* order, int cookie, int depth,
void QuitFunc(TaskList* order, int cookie) { void QuitFunc(TaskList* order, int cookie) {
order->RecordStart(QUITMESSAGELOOP, cookie); order->RecordStart(QUITMESSAGELOOP, cookie);
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
order->RecordEnd(QUITMESSAGELOOP, cookie); order->RecordEnd(QUITMESSAGELOOP, cookie);
} }
...@@ -1780,7 +1780,7 @@ void PostNTasksThenQuit(int posts_remaining) { ...@@ -1780,7 +1780,7 @@ void PostNTasksThenQuit(int posts_remaining) {
FROM_HERE, FROM_HERE,
base::Bind(&PostNTasksThenQuit, posts_remaining - 1)); base::Bind(&PostNTasksThenQuit, posts_remaining - 1));
} else { } else {
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
} }
...@@ -1892,10 +1892,10 @@ namespace { ...@@ -1892,10 +1892,10 @@ namespace {
class QuitDelegate : public MessageLoopForIO::Watcher { class QuitDelegate : public MessageLoopForIO::Watcher {
public: public:
virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE { virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE {
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE { virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE {
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
}; };
......
...@@ -311,7 +311,7 @@ class ConcurrentHelper : public base::RefCounted<ConcurrentHelper> { ...@@ -311,7 +311,7 @@ class ConcurrentHelper : public base::RefCounted<ConcurrentHelper> {
--task_count_; --task_count_;
} }
if (task_count_ == 0 && event_count_ == 0) { if (task_count_ == 0 && event_count_ == 0) {
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} else { } else {
MessageLoop::current()->PostTask( MessageLoop::current()->PostTask(
FROM_HERE, base::Bind(&ConcurrentHelper::FromTask, this)); FROM_HERE, base::Bind(&ConcurrentHelper::FromTask, this));
...@@ -323,7 +323,7 @@ class ConcurrentHelper : public base::RefCounted<ConcurrentHelper> { ...@@ -323,7 +323,7 @@ class ConcurrentHelper : public base::RefCounted<ConcurrentHelper> {
--event_count_; --event_count_;
} }
if (task_count_ == 0 && event_count_ == 0) { if (task_count_ == 0 && event_count_ == 0) {
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} else { } else {
injector_->AddEventAsTask( injector_->AddEventAsTask(
0, base::Bind(&ConcurrentHelper::FromEvent, this)); 0, base::Bind(&ConcurrentHelper::FromEvent, this));
...@@ -353,7 +353,7 @@ TEST_F(MessagePumpGLibTest, TestConcurrentEventPostedTask) { ...@@ -353,7 +353,7 @@ TEST_F(MessagePumpGLibTest, TestConcurrentEventPostedTask) {
// We use the helper class above. We keep both event and posted task queues // We use the helper class above. We keep both event and posted task queues
// full, the helper verifies that both tasks and events get processed. // full, the helper verifies that both tasks and events get processed.
// If that is not the case, either event_count_ or task_count_ will not get // If that is not the case, either event_count_ or task_count_ will not get
// to 0, and MessageLoop::Quit() will never be called. // to 0, and MessageLoop::QuitWhenIdle() will never be called.
scoped_refptr<ConcurrentHelper> helper = new ConcurrentHelper(injector()); scoped_refptr<ConcurrentHelper> helper = new ConcurrentHelper(injector());
// Add 2 events to the queue to make sure it is always full (when we remove // Add 2 events to the queue to make sure it is always full (when we remove
...@@ -514,7 +514,7 @@ void TestGLibLoopInternal(EventInjector* injector) { ...@@ -514,7 +514,7 @@ void TestGLibLoopInternal(EventInjector* injector) {
ASSERT_EQ(3, task_count); ASSERT_EQ(3, task_count);
EXPECT_EQ(4, injector->processed_events()); EXPECT_EQ(4, injector->processed_events());
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
void TestGtkLoopInternal(EventInjector* injector) { void TestGtkLoopInternal(EventInjector* injector) {
...@@ -549,7 +549,7 @@ void TestGtkLoopInternal(EventInjector* injector) { ...@@ -549,7 +549,7 @@ void TestGtkLoopInternal(EventInjector* injector) {
ASSERT_EQ(3, task_count); ASSERT_EQ(3, task_count);
EXPECT_EQ(4, injector->processed_events()); EXPECT_EQ(4, injector->processed_events());
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
} // namespace } // namespace
......
...@@ -26,7 +26,7 @@ const int kNumTestingMessageLoops = arraysize(testing_message_loops); ...@@ -26,7 +26,7 @@ const int kNumTestingMessageLoops = arraysize(testing_message_loops);
class QuitDelegate : public WaitableEventWatcher::Delegate { class QuitDelegate : public WaitableEventWatcher::Delegate {
public: public:
virtual void OnWaitableEventSignaled(WaitableEvent* event) OVERRIDE { virtual void OnWaitableEventSignaled(WaitableEvent* event) OVERRIDE {
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
}; };
......
...@@ -21,8 +21,8 @@ namespace { ...@@ -21,8 +21,8 @@ namespace {
// We use this thread-local variable to record whether or not a thread exited // We use this thread-local variable to record whether or not a thread exited
// because its Stop method was called. This allows us to catch cases where // because its Stop method was called. This allows us to catch cases where
// MessageLoop::Quit() is called directly, which is unexpected when using a // MessageLoop::QuitWhenIdle() is called directly, which is unexpected when
// Thread to setup and run a MessageLoop. // using a Thread to setup and run a MessageLoop.
base::LazyInstance<base::ThreadLocalBoolean> lazy_tls_bool = base::LazyInstance<base::ThreadLocalBoolean> lazy_tls_bool =
LAZY_INSTANCE_INITIALIZER; LAZY_INSTANCE_INITIALIZER;
...@@ -30,7 +30,7 @@ base::LazyInstance<base::ThreadLocalBoolean> lazy_tls_bool = ...@@ -30,7 +30,7 @@ base::LazyInstance<base::ThreadLocalBoolean> lazy_tls_bool =
// This is used to trigger the message loop to exit. // This is used to trigger the message loop to exit.
void ThreadQuitHelper() { void ThreadQuitHelper() {
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
Thread::SetThreadWasQuitProperly(true); Thread::SetThreadWasQuitProperly(true);
} }
......
...@@ -35,7 +35,7 @@ class OneShotTimerTester { ...@@ -35,7 +35,7 @@ class OneShotTimerTester {
private: private:
void Run() { void Run() {
*did_run_ = true; *did_run_ = true;
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
bool* did_run_; bool* did_run_;
base::OneShotTimer<OneShotTimerTester> timer_; base::OneShotTimer<OneShotTimerTester> timer_;
...@@ -56,7 +56,7 @@ class OneShotSelfDeletingTimerTester { ...@@ -56,7 +56,7 @@ class OneShotSelfDeletingTimerTester {
void Run() { void Run() {
*did_run_ = true; *did_run_ = true;
timer_.reset(); timer_.reset();
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
bool* did_run_; bool* did_run_;
scoped_ptr<base::OneShotTimer<OneShotSelfDeletingTimerTester> > timer_; scoped_ptr<base::OneShotTimer<OneShotSelfDeletingTimerTester> > timer_;
...@@ -76,7 +76,7 @@ class RepeatingTimerTester { ...@@ -76,7 +76,7 @@ class RepeatingTimerTester {
void Run() { void Run() {
if (--counter_ == 0) { if (--counter_ == 0) {
*did_run_ = true; *did_run_ = true;
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
} }
bool* did_run_; bool* did_run_;
...@@ -446,12 +446,12 @@ void ClearAllCallbackHappened() { ...@@ -446,12 +446,12 @@ void ClearAllCallbackHappened() {
void SetCallbackHappened1() { void SetCallbackHappened1() {
g_callback_happened1 = true; g_callback_happened1 = true;
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
void SetCallbackHappened2() { void SetCallbackHappened2() {
g_callback_happened2 = true; g_callback_happened2 = true;
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
TEST(TimerTest, ContinuationStopStart) { TEST(TimerTest, ContinuationStopStart) {
......
...@@ -16,7 +16,7 @@ namespace { ...@@ -16,7 +16,7 @@ namespace {
class QuitDelegate : public ObjectWatcher::Delegate { class QuitDelegate : public ObjectWatcher::Delegate {
public: public:
virtual void OnObjectSignaled(HANDLE object) { virtual void OnObjectSignaled(HANDLE object) {
MessageLoop::current()->Quit(); MessageLoop::current()->QuitWhenIdle();
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment