diff options
author | ki.stfu <ki.stfu@gmail.com> | 2015-10-09 13:40:20 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-09 20:41:11 +0000 |
commit | c4f8e240ff989382ac3a1ad994fd6098fbb0b0a1 (patch) | |
tree | f0053d441db726ec25c41dda503e6324c4059f75 | |
parent | 116fe2ebd62c23e1d99a57020705865d0da9258a (diff) | |
download | chromium_src-c4f8e240ff989382ac3a1ad994fd6098fbb0b0a1.zip chromium_src-c4f8e240ff989382ac3a1ad994fd6098fbb0b0a1.tar.gz chromium_src-c4f8e240ff989382ac3a1ad994fd6098fbb0b0a1.tar.bz2 |
Don't use base::MessageLoop::{Quit,QuitClosure} in chrome/
This patch renames base::MessageLoop::{Quit,QuitClosure} to
base::MessageLoop::{QuitWhenIdle,QuitWhenIdleClosure}.
BUG=131220
TEST=
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1395103003
Cr-Commit-Position: refs/heads/master@{#353376}
153 files changed, 326 insertions, 350 deletions
diff --git a/chrome/browser/app_controller_mac_browsertest.mm b/chrome/browser/app_controller_mac_browsertest.mm index c304151..591ac50 100644 --- a/chrome/browser/app_controller_mac_browsertest.mm +++ b/chrome/browser/app_controller_mac_browsertest.mm @@ -218,7 +218,7 @@ void CreateProfileCallback(const base::Closure& quit_closure, void CreateAndWaitForSystemProfile() { ProfileManager::CreateCallback create_callback = base::Bind(&CreateProfileCallback, - base::MessageLoop::current()->QuitClosure()); + base::MessageLoop::current()->QuitWhenIdleClosure()); g_browser_process->profile_manager()->CreateProfileAsync( ProfileManager::GetSystemProfilePath(), create_callback, diff --git a/chrome/browser/apps/app_window_browsertest.cc b/chrome/browser/apps/app_window_browsertest.cc index 80765dc..f498e37 100644 --- a/chrome/browser/apps/app_window_browsertest.cc +++ b/chrome/browser/apps/app_window_browsertest.cc @@ -61,7 +61,7 @@ class GeometryCacheChangeHelper : AppWindowGeometryCache::Observer { cache_->RemoveObserver(this); if (waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/apps/ephemeral_app_launcher_browsertest.cc b/chrome/browser/apps/ephemeral_app_launcher_browsertest.cc index 63e6bc9..fbeb7f8 100644 --- a/chrome/browser/apps/ephemeral_app_launcher_browsertest.cc +++ b/chrome/browser/apps/ephemeral_app_launcher_browsertest.cc @@ -150,7 +150,7 @@ class LaunchObserver { done_ = true; if (waiting_) { waiting_ = false; - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/autocomplete/autocomplete_provider_unittest.cc b/chrome/browser/autocomplete/autocomplete_provider_unittest.cc index 68f80f6..3c876a2 100644 --- a/chrome/browser/autocomplete/autocomplete_provider_unittest.cc +++ b/chrome/browser/autocomplete/autocomplete_provider_unittest.cc @@ -507,7 +507,7 @@ void AutocompleteProviderTest::Observe( const content::NotificationDetails& details) { if (controller_->done()) { CopyResults(); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/autocomplete/history_quick_provider_unittest.cc b/chrome/browser/autocomplete/history_quick_provider_unittest.cc index dd9d840..e554276 100644 --- a/chrome/browser/autocomplete/history_quick_provider_unittest.cc +++ b/chrome/browser/autocomplete/history_quick_provider_unittest.cc @@ -168,7 +168,7 @@ class GetURLTask : public history::HistoryDBTask { } void DoneRunOnMainThread() override { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } private: diff --git a/chrome/browser/autocomplete/history_url_provider_unittest.cc b/chrome/browser/autocomplete/history_url_provider_unittest.cc index c8e4847..f904c91 100644 --- a/chrome/browser/autocomplete/history_url_provider_unittest.cc +++ b/chrome/browser/autocomplete/history_url_provider_unittest.cc @@ -248,7 +248,7 @@ class HistoryURLProviderTestNoSearchProvider : public HistoryURLProviderTest { void HistoryURLProviderTest::OnProviderUpdate(bool updated_matches) { if (autocomplete_->done()) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } bool HistoryURLProviderTest::SetUpImpl(bool no_db) { diff --git a/chrome/browser/autocomplete/shortcuts_backend_unittest.cc b/chrome/browser/autocomplete/shortcuts_backend_unittest.cc index 4ac93bc..1ccc1b5 100644 --- a/chrome/browser/autocomplete/shortcuts_backend_unittest.cc +++ b/chrome/browser/autocomplete/shortcuts_backend_unittest.cc @@ -136,7 +136,7 @@ void ShortcutsBackendTest::TearDown() { void ShortcutsBackendTest::OnShortcutsLoaded() { load_notified_ = true; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void ShortcutsBackendTest::OnShortcutsChanged() { diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index ecd5e80..a298a6e 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -97,7 +97,7 @@ class WindowedPersonalDataManagerObserver // PersonalDataManagerObserver: void OnPersonalDataChanged() override { if (has_run_message_loop_) { - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); has_run_message_loop_ = false; } alerted_ = true; diff --git a/chrome/browser/autofill/autofill_uitest_util.cc b/chrome/browser/autofill/autofill_uitest_util.cc index 85e560d..f220408 100644 --- a/chrome/browser/autofill/autofill_uitest_util.cc +++ b/chrome/browser/autofill/autofill_uitest_util.cc @@ -43,7 +43,7 @@ class PdmChangeWaiter // PersonalDataManagerObserver: void OnPersonalDataChanged() override { if (has_run_message_loop_) { - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); has_run_message_loop_ = false; } alerted_ = true; diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc index d7fc76fd..31718d2 100644 --- a/chrome/browser/browser_keyevents_browsertest.cc +++ b/chrome/browser/browser_keyevents_browsertest.cc @@ -117,7 +117,7 @@ class TestFinishObserver : public content::NotificationObserver { if (*dom_op_result.ptr() == "\"FINISHED\"") { finished_ = true; if (waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 8d432d6..b77777e 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -401,7 +401,7 @@ unsigned int BrowserProcessImpl::ReleaseModule() { FROM_HERE, base::Bind(ChromeBrowserMainPartsMac::DidEndMainMessageLoop)); #endif - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } return module_ref_count_; } diff --git a/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc b/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc index c78471a..e6ddc59 100644 --- a/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_database_helper_browsertest.cc @@ -72,7 +72,7 @@ class StopTestOnCallback { ASSERT_EQ(1UL, database_info_list.size()); EXPECT_EQ(std::string(kTestIdentifier1), database_info_list.begin()->identifier.ToString()); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } private: diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc index 32a8fc2..7b57261 100644 --- a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc @@ -87,9 +87,7 @@ class BrowsingDataFileSystemHelperTest : public testing::Test { // Unblocks the current MessageLoop. Should be called in response to some sort // of async activity in a callback method. - void Notify() { - base::MessageLoop::current()->Quit(); - } + void Notify() { base::MessageLoop::current()->QuitWhenIdle(); } // Callback that should be executed in response to // storage::FileSystemContext::OpenFileSystem. diff --git a/chrome/browser/browsing_data/browsing_data_helper_browsertest.h b/chrome/browser/browsing_data/browsing_data_helper_browsertest.h index 8c326c7..29a82881 100644 --- a/chrome/browser/browsing_data/browsing_data_helper_browsertest.h +++ b/chrome/browser/browsing_data/browsing_data_helper_browsertest.h @@ -30,7 +30,7 @@ class BrowsingDataHelperCallback { void callback(const std::list<T>& info) { result_ = info; has_result_ = true; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } private: diff --git a/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc b/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc index 1dad27a..ae40709 100644 --- a/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_local_storage_helper_browsertest.cc @@ -100,7 +100,7 @@ class StopTestOnCallback { for (size_t i = 0; i < arraysize(kTestHosts); ++i) { ASSERT_TRUE(test_hosts_found[i]) << kTestHosts[i]; } - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } private: diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc index 467596a..b3ff6a9 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc @@ -651,7 +651,7 @@ class RemoveAutofillTester : public autofill::PersonalDataManagerObserver { private: void OnPersonalDataChanged() override { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } autofill::PersonalDataManager* personal_data_manager_; diff --git a/chrome/browser/captive_portal/captive_portal_browsertest.cc b/chrome/browser/captive_portal/captive_portal_browsertest.cc index 1bca5ec..d6a50c6 100644 --- a/chrome/browser/captive_portal/captive_portal_browsertest.cc +++ b/chrome/browser/captive_portal/captive_portal_browsertest.cc @@ -319,7 +319,7 @@ void URLRequestTimeoutOnDemandJob::MaybeStopWaitingForJobsOnIOThread() { last_num_jobs_to_wait_for_ = num_jobs_to_wait_for_; num_jobs_to_wait_for_ = 0; BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::MessageLoop::QuitClosure()); + base::MessageLoop::QuitWhenIdleClosure()); } } @@ -651,7 +651,7 @@ void MultiNavigationObserver::Observe( if (waiting_for_navigation_ && num_navigations_to_wait_for_ == num_navigations_) { waiting_for_navigation_ = false; - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } @@ -741,7 +741,7 @@ void FailLoadsAfterLoginObserver::Observe( tabs_needing_navigation_.size() == tabs_navigated_to_final_destination_.size()) { waiting_for_navigation_ = false; - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } @@ -835,7 +835,7 @@ void CaptivePortalObserver::Observe( if (waiting_for_result_ && num_results_to_wait_for_ == num_results_received_) { waiting_for_result_ = false; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/chromeos/customization/customization_wallpaper_downloader_browsertest.cc b/chrome/browser/chromeos/customization/customization_wallpaper_downloader_browsertest.cc index 6a97f30..a294883 100644 --- a/chrome/browser/chromeos/customization/customization_wallpaper_downloader_browsertest.cc +++ b/chrome/browser/chromeos/customization/customization_wallpaper_downloader_browsertest.cc @@ -69,7 +69,7 @@ class TestWallpaperObserver : public WallpaperManager::Observer { void OnWallpaperAnimationFinished(const std::string&) override { finished_ = true; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void WaitForWallpaperAnimationFinished() { diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc index 16eff75..5a2ff7e 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc @@ -232,7 +232,7 @@ class FileManagerTestListener : public content::NotificationObserver { ? content::Source<extensions::TestSendMessageFunction>(source).ptr() : NULL; messages_.push_back(entry); - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } private: diff --git a/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc b/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc index be373fb..1dbc17e 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc @@ -119,7 +119,7 @@ class KeyEventDoneCallback { void Run(bool consumed) { if (consumed == expected_argument_) { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); is_called_ = true; } } diff --git a/chrome/browser/chromeos/input_method/textinput_test_helper.cc b/chrome/browser/chromeos/input_method/textinput_test_helper.cc index 34554d2..7a7d3a6 100644 --- a/chrome/browser/chromeos/input_method/textinput_test_helper.cc +++ b/chrome/browser/chromeos/input_method/textinput_test_helper.cc @@ -76,7 +76,7 @@ void TextInputTestHelper::OnTextInputTypeChanged( latest_text_input_type_ = client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; if (waiting_type_ == WAIT_ON_TEXT_INPUT_TYPE_CHANGED) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void TextInputTestHelper::OnShowImeIfNeeded() { @@ -89,13 +89,13 @@ void TextInputTestHelper::OnInputMethodDestroyed( void TextInputTestHelper::OnFocus() { focus_state_ = true; if (waiting_type_ == WAIT_ON_FOCUS) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void TextInputTestHelper::OnBlur() { focus_state_ = false; if (waiting_type_ == WAIT_ON_BLUR) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void TextInputTestHelper::OnCaretBoundsChanged( @@ -109,7 +109,7 @@ void TextInputTestHelper::OnCaretBoundsChanged( return; } if (waiting_type_ == WAIT_ON_CARET_BOUNDS_CHANGED) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void TextInputTestHelper::OnTextInputStateChanged( diff --git a/chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc b/chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc index fb398bbf..c3bbabe 100644 --- a/chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc +++ b/chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc @@ -62,7 +62,7 @@ class Waiter : public content::NotificationObserver { DCHECK(type == chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED || type == chrome::NOTIFICATION_FULLSCREEN_CHANGED); if (running_) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } // Wait until the two conditions are met. diff --git a/chrome/browser/chromeos/login/lock/screen_locker_tester.cc b/chrome/browser/chromeos/login/lock/screen_locker_tester.cc index c3fc29b..2b6720b 100644 --- a/chrome/browser/chromeos/login/lock/screen_locker_tester.cc +++ b/chrome/browser/chromeos/login/lock/screen_locker_tester.cc @@ -82,7 +82,7 @@ void LoginAttemptObserver::WaitForAttempt() { void LoginAttemptObserver::LoginAttempted() { login_attempted_ = true; if (waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } // anyonymous namespace diff --git a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc index f3d283e..226ea84 100644 --- a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc +++ b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc @@ -913,7 +913,7 @@ void LoginDisplayHostImpl::ShutdownDisplayHost(bool post_quit_task) { registrar_.RemoveAll(); base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); if (post_quit_task) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); if (!completion_callback_.is_null()) base::MessageLoop::current()->PostTask(FROM_HERE, completion_callback_); diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_utils.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_utils.cc index b655409..59eebad 100644 --- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_utils.cc +++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_utils.cc @@ -41,7 +41,7 @@ class TestWallpaperObserverPendingListEmpty void OnPendingListEmptyForTesting() override { empty_ = true; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void WaitForPendingListEmpty() { diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc index 7d89c81..05c8c9e 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc @@ -206,7 +206,7 @@ class FakeClientObserver delegate_->FakeRegisterWithOS(worker_->protocol()); } if (state != ShellIntegration::STATE_PROCESSING) { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/devtools/device/adb/adb_client_socket_browsertest.cc b/chrome/browser/devtools/device/adb/adb_client_socket_browsertest.cc index b0b4e5f..0f30260 100644 --- a/chrome/browser/devtools/device/adb/adb_client_socket_browsertest.cc +++ b/chrome/browser/devtools/device/adb/adb_client_socket_browsertest.cc @@ -41,7 +41,7 @@ class AdbClientSocketTest : public InProcessBrowserTest, const DevToolsAndroidBridge::RemoteDevices& devices) override { devices_ = devices; android_bridge_->RemoveDeviceListListener(this); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void CheckDevices() { diff --git a/chrome/browser/devtools/device/adb/mock_adb_server.cc b/chrome/browser/devtools/device/adb/mock_adb_server.cc index 70e9a0c..3fe93df 100644 --- a/chrome/browser/devtools/device/adb/mock_adb_server.cc +++ b/chrome/browser/devtools/device/adb/mock_adb_server.cc @@ -601,19 +601,16 @@ void MockAndroidConnection::SendHTTPResponse(const std::string& body) { void StartMockAdbServer(FlushMode flush_mode) { BrowserThread::PostTaskAndReply( - BrowserThread::IO, - FROM_HERE, + BrowserThread::IO, FROM_HERE, base::Bind(&StartMockAdbServerOnIOThread, flush_mode), - base::MessageLoop::QuitClosure()); + base::MessageLoop::QuitWhenIdleClosure()); content::RunMessageLoop(); } void StopMockAdbServer() { - BrowserThread::PostTaskAndReply( - BrowserThread::IO, - FROM_HERE, - base::Bind(&StopMockAdbServerOnIOThread), - base::MessageLoop::QuitClosure()); + BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE, + base::Bind(&StopMockAdbServerOnIOThread), + base::MessageLoop::QuitWhenIdleClosure()); content::RunMessageLoop(); } diff --git a/chrome/browser/devtools/device/port_forwarding_browsertest.cc b/chrome/browser/devtools/device/port_forwarding_browsertest.cc index e52ae72..5e2599d 100644 --- a/chrome/browser/devtools/device/port_forwarding_browsertest.cc +++ b/chrome/browser/devtools/device/port_forwarding_browsertest.cc @@ -62,7 +62,7 @@ class PortForwardingTest: public InProcessBrowserTest { if (status.empty() && skip_empty_devices_) return; base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); } void set_skip_empty_devices(bool skip_empty_devices) { @@ -178,9 +178,8 @@ IN_PROC_BROWSER_TEST_F(PortForwardingDisconnectTest, DisconnectOnRelease) { self_provider->set_release_callback_for_test( base::Bind(&base::MessageLoop::PostTask, - base::Unretained(base::MessageLoop::current()), - FROM_HERE, - base::MessageLoop::QuitClosure())); + base::Unretained(base::MessageLoop::current()), FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure())); wait_for_port_forwarding.reset(); content::RunMessageLoop(); } diff --git a/chrome/browser/devtools/device/usb/android_usb_browsertest.cc b/chrome/browser/devtools/device/usb/android_usb_browsertest.cc index 64a8c33..a01b9ac 100644 --- a/chrome/browser/devtools/device/usb/android_usb_browsertest.cc +++ b/chrome/browser/devtools/device/usb/android_usb_browsertest.cc @@ -641,7 +641,7 @@ class MockCountListener : public DevToolsAndroidBridge::DeviceCountListener { Shutdown(); } - void Shutdown() { base::MessageLoop::current()->Quit(); } + void Shutdown() { base::MessageLoop::current()->QuitWhenIdle(); } DevToolsAndroidBridge* adb_bridge_; int invoked_; diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index e8fc89c..b547a00 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc @@ -316,7 +316,7 @@ class DevToolsUnresponsiveBeforeUnloadTest: public DevToolsBeforeUnloadTest { void TimeoutCallback(const std::string& timeout_message) { ADD_FAILURE() << timeout_message; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } // Base class for DevTools tests that test devtools functionality for @@ -400,7 +400,7 @@ class DevToolsExtensionTest : public DevToolsSanityTest, switch (type) { case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD: - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); break; default: NOTREACHED(); @@ -454,7 +454,7 @@ class WorkerDevToolsSanityTest : public InProcessBrowserTest { worker_data_->worker_route_id = route_id; WorkerService::GetInstance()->RemoveObserver(this); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::MessageLoop::QuitClosure()); + base::MessageLoop::QuitWhenIdleClosure()); delete this; } std::string path_; @@ -475,7 +475,7 @@ class WorkerDevToolsSanityTest : public InProcessBrowserTest { ASSERT_EQ(worker_data_->worker_route_id, route_id); WorkerService::GetInstance()->RemoveObserver(this); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::MessageLoop::QuitClosure()); + base::MessageLoop::QuitWhenIdleClosure()); delete this; } scoped_refptr<WorkerData> worker_data_; @@ -521,7 +521,7 @@ class WorkerDevToolsSanityTest : public InProcessBrowserTest { worker_data->worker_process_id = worker_info[0].process_id; worker_data->worker_route_id = worker_info[0].route_id; BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::MessageLoop::QuitClosure()); + base::MessageLoop::QuitWhenIdleClosure()); return; } diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 9abd16f..690bf41 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -145,7 +145,7 @@ class CreatedObserver : public content::DownloadManager::Observer { content::DownloadItem* item) override { DCHECK_EQ(manager_, manager); if (waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } content::DownloadManager* manager_; @@ -187,10 +187,10 @@ class PercentWaiter : public content::DownloadItem::Observer { (item_->PercentComplete() != 100)))) { error_ = true; if (waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } if (item_->GetState() == DownloadItem::COMPLETE && waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } void OnDownloadDestroyed(content::DownloadItem* item) override { @@ -274,7 +274,7 @@ class DownloadsHistoryDataCollector { scoped_ptr<std::vector<history::DownloadRow> > entries) { result_valid_ = true; results_ = entries.Pass(); - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } Profile* profile_; @@ -298,7 +298,7 @@ class MockAbortExtensionInstallPrompt : public ExtensionInstallPrompt { const Extension* extension, const ShowDialogCallback& show_dialog_callback) override { delegate->InstallUIAbort(true); - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } void OnInstallSuccess(const Extension* extension, SkBitmap* icon) override {} @@ -395,7 +395,7 @@ class HistoryObserver : public DownloadHistory::Observer { seen_stored_ = true; if (waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } void OnDownloadHistoryDestroyed() override { @@ -1109,8 +1109,8 @@ class DownloadTest : public InProcessBrowserTest { static void EnsureNoPendingDownloadJobsOnIO(bool* result) { if (net::URLRequestSlowDownloadJob::NumberOutstandingRequests()) *result = false; - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, base::MessageLoop::QuitClosure()); + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); } // Location of the test data. @@ -3553,7 +3553,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTestWithShelf, PRE_DownloadTest_History) { HistoryServiceFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) ->FlushForTest(base::Bind( - &base::MessageLoop::Quit, + &base::MessageLoop::QuitWhenIdle, base::Unretained(base::MessageLoop::current()->current()))); content::RunMessageLoop(); } diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc index 67ba540..d1f0cf3 100644 --- a/chrome/browser/download/save_page_browsertest.cc +++ b/chrome/browser/download/save_page_browsertest.cc @@ -96,7 +96,7 @@ class DownloadPersistedObserver : public DownloadHistory::Observer { const history::DownloadRow& info) override { persisted_ = persisted_ || filter_.Run(item, info); if (persisted_ && waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } private: @@ -134,7 +134,7 @@ class DownloadRemovedObserver : public DownloadPersistedObserver { void OnDownloadsRemoved(const DownloadHistory::IdSet& ids) override { removed_ = ids.find(download_id_) != ids.end(); if (removed_ && waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } private: @@ -230,14 +230,14 @@ class DownloadItemCreatedObserver : public DownloadManager::Observer { items_seen_.push_back(item); if (waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } void ManagerGoingDown(DownloadManager* manager) override { manager_->RemoveObserver(this); manager_ = NULL; if (waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } bool waiting_; diff --git a/chrome/browser/extensions/activity_log/activity_log_browsertest.cc b/chrome/browser/extensions/activity_log/activity_log_browsertest.cc index 41fb708..7cfd7c0 100644 --- a/chrome/browser/extensions/activity_log/activity_log_browsertest.cc +++ b/chrome/browser/extensions/activity_log/activity_log_browsertest.cc @@ -42,7 +42,7 @@ class ActivityLogPrerenderTest : public ExtensionApiTest { scoped_ptr<std::vector<scoped_refptr<Action> > > i) { // This is to exit RunLoop (base::MessageLoop::current()->Run()) below base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); ASSERT_TRUE(i->size()); scoped_refptr<Action> last = i->front(); diff --git a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc index 45ac541..51218db 100644 --- a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc +++ b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc @@ -69,10 +69,8 @@ class CountingPolicyTest : public testing::Test { // Wait for the task queue for the specified thread to empty. void WaitOnThread(const BrowserThread::ID& thread) { BrowserThread::PostTaskAndReply( - thread, - FROM_HERE, - base::Bind(&base::DoNothing), - base::MessageLoop::current()->QuitClosure()); + thread, FROM_HERE, base::Bind(&base::DoNothing), + base::MessageLoop::current()->QuitWhenIdleClosure()); base::MessageLoop::current()->Run(); } @@ -102,15 +100,9 @@ class CountingPolicyTest : public testing::Test { // checker function when results are available. This will happen on the // database thread. policy->ReadFilteredData( - extension_id, - type, - api_name, - page_url, - arg_url, - day, - base::Bind(&CountingPolicyTest::CheckWrapper, - checker, - base::MessageLoop::current()->QuitClosure())); + extension_id, type, api_name, page_url, arg_url, day, + base::Bind(&CountingPolicyTest::CheckWrapper, checker, + base::MessageLoop::current()->QuitWhenIdleClosure())); // Set up a timeout for receiving results; if we haven't received anything // when the timeout triggers then assume that the test is broken. diff --git a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc index a96d0d3..8f969b8 100644 --- a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc +++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc @@ -92,15 +92,9 @@ class FullStreamUIPolicyTest : public testing::Test { // checker function when results are available. This will happen on the // database thread. policy->ReadFilteredData( - extension_id, - type, - api_name, - page_url, - arg_url, - days_ago, - base::Bind(&FullStreamUIPolicyTest::CheckWrapper, - checker, - base::MessageLoop::current()->QuitClosure())); + extension_id, type, api_name, page_url, arg_url, days_ago, + base::Bind(&FullStreamUIPolicyTest::CheckWrapper, checker, + base::MessageLoop::current()->QuitWhenIdleClosure())); // Set up a timeout for receiving results; if we haven't received anything // when the timeout triggers then assume that the test is broken. @@ -935,10 +929,8 @@ TEST_F(FullStreamUIPolicyTest, CapReturns) { policy->Flush(); BrowserThread::PostTaskAndReply( - BrowserThread::DB, - FROM_HERE, - base::Bind(&base::DoNothing), - base::MessageLoop::current()->QuitClosure()); + BrowserThread::DB, FROM_HERE, base::Bind(&base::DoNothing), + base::MessageLoop::current()->QuitWhenIdleClosure()); base::MessageLoop::current()->Run(); CheckReadFilteredData( diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc index 13eea4b..df3396b 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc @@ -185,7 +185,7 @@ class DownloadsEventsListener : public content::NotificationObserver { waiting_for_.get() && new_event->Satisfies(*waiting_for_)) { waiting_ = false; - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } break; } diff --git a/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc b/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc index b166f4c..3ff3d1f 100644 --- a/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc +++ b/chrome/browser/extensions/api/feedback_private/feedback_browsertest.cc @@ -22,7 +22,7 @@ namespace { void StopMessageLoopCallback() { - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } // namespace diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc index a626f92..b964bc9 100644 --- a/chrome/browser/extensions/api/identity/identity_apitest.cc +++ b/chrome/browser/extensions/api/identity/identity_apitest.cc @@ -105,7 +105,7 @@ class SendResponseDelegate response_.reset(new bool); *response_ = success; if (should_post_quit_) { - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/extensions/api/notifications/notifications_apitest.cc b/chrome/browser/extensions/api/notifications/notifications_apitest.cc index ff5ec2f..ba9fe44 100644 --- a/chrome/browser/extensions/api/notifications/notifications_apitest.cc +++ b/chrome/browser/extensions/api/notifications/notifications_apitest.cc @@ -68,7 +68,7 @@ class UserGestureCatcher : public content::NotificationObserver { .ptr() ->user_gesture()); if (waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } content::NotificationRegistrar registrar_; diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc index 786554d..7bcba9b 100644 --- a/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc +++ b/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc @@ -437,7 +437,7 @@ IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_TabIndicator) { last_media_state_ = media_state; if (has_changed) { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); } } diff --git a/chrome/browser/extensions/api/tabs/tabs_test.cc b/chrome/browser/extensions/api/tabs/tabs_test.cc index 43cd585..06e5571 100644 --- a/chrome/browser/extensions/api/tabs/tabs_test.cc +++ b/chrome/browser/extensions/api/tabs/tabs_test.cc @@ -832,7 +832,7 @@ class ExtensionWindowLastFocusedTest : public ExtensionTabsTest { // AppWindowRegistry::Observer: void OnAppWindowActivated(AppWindow* app_window) override { if (app_window_ == app_window && waiting_) { - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); waiting_ = false; } } @@ -864,7 +864,7 @@ class ExtensionWindowLastFocusedTest : public ExtensionTabsTest { void OnWidgetActivationChanged(views::Widget* widget, bool active) override { if (widget_ == widget && waiting_) { - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); waiting_ = false; } } diff --git a/chrome/browser/extensions/api/top_sites/top_sites_apitest.cc b/chrome/browser/extensions/api/top_sites/top_sites_apitest.cc index 059bb13..17bd016 100644 --- a/chrome/browser/extensions/api/top_sites/top_sites_apitest.cc +++ b/chrome/browser/extensions/api/top_sites/top_sites_apitest.cc @@ -53,7 +53,7 @@ class TopSitesExtensionTest : public InProcessBrowserTest { private: void OnTopSitesAvailable(const history::MostVisitedURLList& data) { if (waiting_) { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); waiting_ = false; } top_sites_inited_ = true; diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc index c2bc422..c263ce7 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc @@ -465,8 +465,8 @@ TEST_F(ExtensionWebRequestTest, SimulateChancelWhileBlocked) { // Extension response for OnErrorOccurred: Terminate the message loop. ipc_sender_.PushTask( base::Bind(&base::MessageLoop::PostTask, - base::Unretained(base::MessageLoop::current()), - FROM_HERE, base::MessageLoop::QuitClosure())); + base::Unretained(base::MessageLoop::current()), FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure())); request->Start(); // request->Start() will have submitted OnBeforeRequest by the time we cancel. diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc index a304a04..6d63a6a 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc @@ -54,7 +54,7 @@ class WebstoreInstallListener : public WebstoreInstaller::Delegate { if (waiting_) { waiting_ = false; - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } @@ -68,7 +68,7 @@ class WebstoreInstallListener : public WebstoreInstaller::Delegate { if (waiting_) { waiting_ = false; - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/extensions/app_data_migrator_unittest.cc b/chrome/browser/extensions/app_data_migrator_unittest.cc index 8bb4f43..a9d1e32 100644 --- a/chrome/browser/extensions/app_data_migrator_unittest.cc +++ b/chrome/browser/extensions/app_data_migrator_unittest.cc @@ -105,7 +105,7 @@ void MigrationCallback() { } void DidWrite(base::File::Error status, int64 bytes, bool complete) { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void DidCreate(base::File::Error status) { @@ -183,7 +183,7 @@ void VerifyFileContents(base::File file, file.Close(); if (!on_close_callback.is_null()) on_close_callback.Run(); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void VerifyTestFilesMigrated(content::StoragePartition* new_partition, diff --git a/chrome/browser/extensions/crx_installer_browsertest.cc b/chrome/browser/extensions/crx_installer_browsertest.cc index f01c8f8..4656593 100644 --- a/chrome/browser/extensions/crx_installer_browsertest.cc +++ b/chrome/browser/extensions/crx_installer_browsertest.cc @@ -116,11 +116,11 @@ class MockInstallPrompt : public ExtensionInstallPrompt { } void OnInstallSuccess(const Extension* extension, SkBitmap* icon) override { proxy_->set_extension_id(extension->id()); - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } void OnInstallFailure(const CrxInstallError& error) override { proxy_->set_error(error.message()); - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } private: diff --git a/chrome/browser/extensions/error_console/error_console_browsertest.cc b/chrome/browser/extensions/error_console/error_console_browsertest.cc index e55f097..b8ef787 100644 --- a/chrome/browser/extensions/error_console/error_console_browsertest.cc +++ b/chrome/browser/extensions/error_console/error_console_browsertest.cc @@ -158,7 +158,7 @@ class ErrorConsoleBrowserTest : public ExtensionBrowserTest { ++errors_observed_; if (errors_observed_ >= errors_expected_) { if (waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/extensions/extension_action_icon_factory_unittest.cc b/chrome/browser/extensions/extension_action_icon_factory_unittest.cc index 3d45e15..6af5c77 100644 --- a/chrome/browser/extensions/extension_action_icon_factory_unittest.cc +++ b/chrome/browser/extensions/extension_action_icon_factory_unittest.cc @@ -149,7 +149,7 @@ class ExtensionActionIconFactoryTest // ExtensionActionIconFactory::Observer overrides: void OnIconUpdated() override { if (quit_in_icon_updated_) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } gfx::ImageSkia GetFavicon() { diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index d264328..a510d74 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -389,7 +389,7 @@ class MockAbortExtensionInstallPrompt : public ExtensionInstallPrompt { const Extension* extension, const ShowDialogCallback& show_dialog_callback) override { delegate->InstallUIAbort(true); - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } void OnInstallSuccess(const Extension* extension, SkBitmap* icon) override {} diff --git a/chrome/browser/extensions/extension_function_test_utils.cc b/chrome/browser/extensions/extension_function_test_utils.cc index 7938d45..3dec01e 100644 --- a/chrome/browser/extensions/extension_function_test_utils.cc +++ b/chrome/browser/extensions/extension_function_test_utils.cc @@ -149,7 +149,7 @@ class SendResponseDelegate response_.reset(new bool); *response_ = success; if (should_post_quit_) { - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/extensions/extension_icon_manager_unittest.cc b/chrome/browser/extensions/extension_icon_manager_unittest.cc index 004c196..bcec7a8 100644 --- a/chrome/browser/extensions/extension_icon_manager_unittest.cc +++ b/chrome/browser/extensions/extension_icon_manager_unittest.cc @@ -35,7 +35,7 @@ class ExtensionIconManagerTest : public testing::Test { void ImageLoadObserved() { unwaited_image_loads_++; if (waiting_) { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 7935705..d22415f 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -1240,7 +1240,7 @@ void PackExtensionTestClient::OnPackSuccess( // on with the rest of the test. // This call to |Quit()| matches the call to |Run()| in the // |PackPunctuatedExtension| test. - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); EXPECT_EQ(expected_crx_path_.value(), crx_path.value()); EXPECT_EQ(expected_private_key_path_.value(), private_key_path.value()); ASSERT_TRUE(base::PathExists(private_key_path)); @@ -4715,15 +4715,15 @@ class ExtensionCookieCallback { void SetCookieCallback(bool result) { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::Bind(&base::MessageLoop::Quit, weak_factory_.GetWeakPtr())); + FROM_HERE, base::Bind(&base::MessageLoop::QuitWhenIdle, + weak_factory_.GetWeakPtr())); result_ = result; } void GetAllCookiesCallback(const net::CookieList& list) { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::Bind(&base::MessageLoop::Quit, weak_factory_.GetWeakPtr())); + FROM_HERE, base::Bind(&base::MessageLoop::QuitWhenIdle, + weak_factory_.GetWeakPtr())); list_ = list; } net::CookieList list_; diff --git a/chrome/browser/extensions/extension_storage_monitor_browsertest.cc b/chrome/browser/extensions/extension_storage_monitor_browsertest.cc index 295331d..1865a13 100644 --- a/chrome/browser/extensions/extension_storage_monitor_browsertest.cc +++ b/chrome/browser/extensions/extension_storage_monitor_browsertest.cc @@ -64,7 +64,7 @@ class NotificationObserver : public message_center::MessageCenterObserver { received_notifications_.insert(notification_id); if (waiting_ && HasReceivedNotification()) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } message_center::MessageCenter* message_center_; diff --git a/chrome/browser/extensions/extension_user_script_loader_unittest.cc b/chrome/browser/extensions/extension_user_script_loader_unittest.cc index 02de781..b343026 100644 --- a/chrome/browser/extensions/extension_user_script_loader_unittest.cc +++ b/chrome/browser/extensions/extension_user_script_loader_unittest.cc @@ -71,7 +71,7 @@ class ExtensionUserScriptLoaderTest : public testing::Test, shared_memory_ = content::Details<base::SharedMemory>(details).ptr(); if (base::MessageLoop::current() == &message_loop_) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } // Directory containing user scripts. @@ -97,8 +97,8 @@ TEST_F(ExtensionUserScriptLoaderTest, NoScripts) { HostID(), true /* listen_for_extension_system_loaded */); loader.StartLoad(); - message_loop_.task_runner()->PostTask(FROM_HERE, - base::MessageLoop::QuitClosure()); + message_loop_.task_runner()->PostTask( + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); message_loop_.Run(); ASSERT_TRUE(shared_memory_ != NULL); diff --git a/chrome/browser/extensions/permissions_updater_unittest.cc b/chrome/browser/extensions/permissions_updater_unittest.cc index 91e383e..2f4470f 100644 --- a/chrome/browser/extensions/permissions_updater_unittest.cc +++ b/chrome/browser/extensions/permissions_updater_unittest.cc @@ -161,7 +161,7 @@ class PermissionsUpdaterListener : public content::NotificationObserver { if (waiting_) { waiting_ = false; - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/external_protocol/external_protocol_handler_unittest.cc b/chrome/browser/external_protocol/external_protocol_handler_unittest.cc index f7d3511..b247a6d 100644 --- a/chrome/browser/external_protocol/external_protocol_handler_unittest.cc +++ b/chrome/browser/external_protocol/external_protocol_handler_unittest.cc @@ -85,7 +85,7 @@ class FakeExternalProtocolHandlerDelegate } void FinishedProcessingCheck() override { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void set_os_state(ShellIntegration::DefaultWebClientState value) { diff --git a/chrome/browser/first_run/try_chrome_dialog_view.cc b/chrome/browser/first_run/try_chrome_dialog_view.cc index 47666e6..5918776 100644 --- a/chrome/browser/first_run/try_chrome_dialog_view.cc +++ b/chrome/browser/first_run/try_chrome_dialog_view.cc @@ -359,7 +359,7 @@ void TryChromeDialogView::ButtonPressed(views::Button* sender, } popup_->Close(); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void TryChromeDialogView::LinkClicked(views::Link* source, int event_flags) { diff --git a/chrome/browser/geolocation/access_token_store_browsertest.cc b/chrome/browser/geolocation/access_token_store_browsertest.cc index 36acb04..803756e 100644 --- a/chrome/browser/geolocation/access_token_store_browsertest.cc +++ b/chrome/browser/geolocation/access_token_store_browsertest.cc @@ -99,8 +99,8 @@ void GeolocationAccessTokenStoreTest::OnAccessTokenStoresLoaded( scoped_refptr<AccessTokenStore> store(new ChromeAccessTokenStore()); store->SaveAccessToken(ref_url_, *token_to_set_); } - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, base::MessageLoop::QuitClosure()); + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); } IN_PROC_BROWSER_TEST_F(GeolocationAccessTokenStoreTest, SetAcrossInstances) { diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index fc44f49..c8ff648 100644 --- a/chrome/browser/geolocation/geolocation_browsertest.cc +++ b/chrome/browser/geolocation/geolocation_browsertest.cc @@ -122,7 +122,7 @@ void IFrameLoader::Observe(int type, javascript_completed_ = true; } if (javascript_completed_ && navigation_completed_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } // PermissionBubbleObserver --------------------------------------------------- diff --git a/chrome/browser/history/android/android_history_provider_service_unittest.cc b/chrome/browser/history/android/android_history_provider_service_unittest.cc index 0166f3c..4124971 100644 --- a/chrome/browser/history/android/android_history_provider_service_unittest.cc +++ b/chrome/browser/history/android/android_history_provider_service_unittest.cc @@ -106,30 +106,30 @@ class CallbackHelper : public base::RefCountedThreadSafe<CallbackHelper> { void OnInserted(int64 id) { success_ = id != 0; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void OnQueryResult(AndroidStatement* statement) { success_ = statement != NULL; statement_ = statement; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void OnUpdated(int count) { success_ = count != 0; count_ = count; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void OnDeleted(int count) { success_ = count != 0; count_ = count; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void OnStatementMoved(int cursor_position) { cursor_position_ = cursor_position; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } private: diff --git a/chrome/browser/history/android/sqlite_cursor.h b/chrome/browser/history/android/sqlite_cursor.h index 97f85bd..c828ad2 100644 --- a/chrome/browser/history/android/sqlite_cursor.h +++ b/chrome/browser/history/android/sqlite_cursor.h @@ -45,8 +45,8 @@ class SQLiteCursor { // give unit tests a chance to run the message loop before event_.Wait is // invoked, The OnGetMoveToResult() and OnGetFaviconResult() is used to notify // the test observer in the UI thread when the task's result comes back, it - // calls MessageLoop::Quit() to exit the loop, then the event.Wait() is - // called. Basically, Two threads are used to simulate 3 threads' behavior + // calls MessageLoop::QuitWhenIdle() to exit the loop, then the event.Wait() + // is called. Basically, Two threads are used to simulate 3 threads' behavior // here. // The whole observer design is only for test purpose and should only be used // in unit test. diff --git a/chrome/browser/history/android/sqlite_cursor_unittest.cc b/chrome/browser/history/android/sqlite_cursor_unittest.cc index 858f5e4..63b4d8ad 100644 --- a/chrome/browser/history/android/sqlite_cursor_unittest.cc +++ b/chrome/browser/history/android/sqlite_cursor_unittest.cc @@ -80,11 +80,15 @@ class SQLiteCursorTest : public testing::Test, // Override SQLiteCursor::TestObserver. void OnPostMoveToTask() override { base::MessageLoop::current()->Run(); } - void OnGetMoveToResult() override { base::MessageLoop::current()->Quit(); } + void OnGetMoveToResult() override { + base::MessageLoop::current()->QuitWhenIdle(); + } void OnPostGetFaviconTask() override { base::MessageLoop::current()->Run(); } - void OnGetFaviconResult() override { base::MessageLoop::current()->Quit(); } + void OnGetFaviconResult() override { + base::MessageLoop::current()->QuitWhenIdle(); + } protected: TestingProfileManager profile_manager_; @@ -117,13 +121,13 @@ class CallbackHelper : public base::RefCountedThreadSafe<CallbackHelper> { void OnInserted(int64 id) { success_ = id != 0; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void OnQueryResult(AndroidStatement* statement) { success_ = statement != NULL; statement_ = statement; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } private: diff --git a/chrome/browser/history/history_browsertest.cc b/chrome/browser/history/history_browsertest.cc index 0baf596..ae6f988 100644 --- a/chrome/browser/history/history_browsertest.cc +++ b/chrome/browser/history/history_browsertest.cc @@ -53,7 +53,9 @@ class WaitForHistoryTask : public history::HistoryDBTask { return true; } - void DoneRunOnMainThread() override { base::MessageLoop::current()->Quit(); } + void DoneRunOnMainThread() override { + base::MessageLoop::current()->QuitWhenIdle(); + } private: ~WaitForHistoryTask() override {} diff --git a/chrome/browser/history/redirect_browsertest.cc b/chrome/browser/history/redirect_browsertest.cc index 2746370..f51c18f 100644 --- a/chrome/browser/history/redirect_browsertest.cc +++ b/chrome/browser/history/redirect_browsertest.cc @@ -64,7 +64,7 @@ class RedirectTest : public InProcessBrowserTest { const history::RedirectList* redirects) { rv->insert(rv->end(), redirects->begin(), redirects->end()); base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); } // Tracker for asynchronous history queries. diff --git a/chrome/browser/importer/firefox_importer_browsertest.cc b/chrome/browser/importer/firefox_importer_browsertest.cc index 5f7d182..05ca389 100644 --- a/chrome/browser/importer/firefox_importer_browsertest.cc +++ b/chrome/browser/importer/firefox_importer_browsertest.cc @@ -144,7 +144,7 @@ class FirefoxObserver : public ProfileWriter, void ImportItemStarted(importer::ImportItem item) override {} void ImportItemEnded(importer::ImportItem item) override {} void ImportEnded() override { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); EXPECT_EQ(arraysize(kFirefoxBookmarks), bookmark_count_); EXPECT_EQ(1U, history_count_); EXPECT_EQ(arraysize(kFirefoxPasswords), password_count_); diff --git a/chrome/browser/importer/ie_importer_browsertest_win.cc b/chrome/browser/importer/ie_importer_browsertest_win.cc index c1a8eb44..168ab45 100644 --- a/chrome/browser/importer/ie_importer_browsertest_win.cc +++ b/chrome/browser/importer/ie_importer_browsertest_win.cc @@ -240,7 +240,7 @@ class TestObserver : public ProfileWriter, void ImportItemStarted(importer::ImportItem item) override {} void ImportItemEnded(importer::ImportItem item) override {} void ImportEnded() override { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); if (importer_items_ & importer::FAVORITES) { EXPECT_EQ(arraysize(kIEBookmarks), bookmark_count_); EXPECT_EQ(arraysize(kIEFaviconGroup), favicon_count_); @@ -388,7 +388,7 @@ class MalformedFavoritesRegistryTestObserver void ImportItemStarted(importer::ImportItem item) override {} void ImportItemEnded(importer::ImportItem item) override {} void ImportEnded() override { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); EXPECT_EQ(arraysize(kIESortedBookmarks), bookmark_count_); } diff --git a/chrome/browser/importer/profile_writer_unittest.cc b/chrome/browser/importer/profile_writer_unittest.cc index 74dd262..d49133e 100644 --- a/chrome/browser/importer/profile_writer_unittest.cc +++ b/chrome/browser/importer/profile_writer_unittest.cc @@ -102,7 +102,7 @@ class ProfileWriterTest : public testing::Test { } void HistoryQueryComplete(history::QueryResults* results) { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); history_count_ = results->size(); } diff --git a/chrome/browser/local_discovery/privet_http_unittest.cc b/chrome/browser/local_discovery/privet_http_unittest.cc index 1fbd4e3..1fd60be 100644 --- a/chrome/browser/local_discovery/privet_http_unittest.cc +++ b/chrome/browser/local_discovery/privet_http_unittest.cc @@ -337,9 +337,7 @@ class PrivetHTTPTest : public ::testing::Test { callback.Cancel(); } - void Stop() { - base::MessageLoop::current()->Quit(); - } + void Stop() { base::MessageLoop::current()->QuitWhenIdle(); } protected: base::MessageLoop loop_; diff --git a/chrome/browser/local_discovery/privet_url_fetcher_unittest.cc b/chrome/browser/local_discovery/privet_url_fetcher_unittest.cc index c2940aa6..be975f9 100644 --- a/chrome/browser/local_discovery/privet_url_fetcher_unittest.cc +++ b/chrome/browser/local_discovery/privet_url_fetcher_unittest.cc @@ -115,9 +115,7 @@ class PrivetURLFetcherTest : public ::testing::Test { callback.Cancel(); } - void Stop() { - base::MessageLoop::current()->Quit(); - } + void Stop() { base::MessageLoop::current()->QuitWhenIdle(); } protected: base::MessageLoop loop_; diff --git a/chrome/browser/media/desktop_media_list_ash_unittest.cc b/chrome/browser/media/desktop_media_list_ash_unittest.cc index d291dd2..49670b6 100644 --- a/chrome/browser/media/desktop_media_list_ash_unittest.cc +++ b/chrome/browser/media/desktop_media_list_ash_unittest.cc @@ -49,7 +49,7 @@ class DesktopMediaListAshTest : public ash::test::AshTestBase { ACTION(QuitMessageLoop) { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); } TEST_F(DesktopMediaListAshTest, Screen) { diff --git a/chrome/browser/media/native_desktop_media_list_unittest.cc b/chrome/browser/media/native_desktop_media_list_unittest.cc index 7ae36ea..a5925e9 100644 --- a/chrome/browser/media/native_desktop_media_list_unittest.cc +++ b/chrome/browser/media/native_desktop_media_list_unittest.cc @@ -133,8 +133,8 @@ ACTION_P2(CheckListSize, model, expected_list_size) { } ACTION_P(QuitMessageLoop, message_loop) { - message_loop->task_runner()->PostTask(FROM_HERE, - base::MessageLoop::QuitClosure()); + message_loop->task_runner()->PostTask( + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); } class DesktopMediaListTest : public testing::Test { diff --git a/chrome/browser/metrics/metrics_memory_details_browsertest.cc b/chrome/browser/metrics/metrics_memory_details_browsertest.cc index d38bfda..4abccd8 100644 --- a/chrome/browser/metrics/metrics_memory_details_browsertest.cc +++ b/chrome/browser/metrics/metrics_memory_details_browsertest.cc @@ -28,7 +28,7 @@ class TestMemoryDetails : public MetricsMemoryDetails { void OnDetailsAvailable() override { MetricsMemoryDetails::OnDetailsAvailable(); // Exit the loop initiated by StartFetchAndWait(). - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } DISALLOW_COPY_AND_ASSIGN(TestMemoryDetails); diff --git a/chrome/browser/metrics/thread_watcher_unittest.cc b/chrome/browser/metrics/thread_watcher_unittest.cc index 43c6b5c..ea47fa3 100644 --- a/chrome/browser/metrics/thread_watcher_unittest.cc +++ b/chrome/browser/metrics/thread_watcher_unittest.cc @@ -701,7 +701,7 @@ TEST_F(ThreadWatcherListTest, Restart) { ThreadWatcherList::StartWatchingAll(*base::CommandLine::ForCurrentProcess()); ThreadWatcherList::StopWatchingAll(); message_loop_for_ui.task_runner()->PostDelayedTask( - FROM_HERE, message_loop_for_ui.QuitClosure(), + FROM_HERE, message_loop_for_ui.QuitWhenIdleClosure(), base::TimeDelta::FromSeconds( ThreadWatcherList::g_initialize_delay_seconds)); message_loop_for_ui.Run(); @@ -713,7 +713,7 @@ TEST_F(ThreadWatcherListTest, Restart) { // Proceed with just |StartWatchingAll| and ensure it'll be started. ThreadWatcherList::StartWatchingAll(*base::CommandLine::ForCurrentProcess()); message_loop_for_ui.task_runner()->PostDelayedTask( - FROM_HERE, message_loop_for_ui.QuitClosure(), + FROM_HERE, message_loop_for_ui.QuitWhenIdleClosure(), base::TimeDelta::FromSeconds( ThreadWatcherList::g_initialize_delay_seconds + 1)); message_loop_for_ui.Run(); @@ -725,7 +725,7 @@ TEST_F(ThreadWatcherListTest, Restart) { // Finally, StopWatchingAll() must stop. ThreadWatcherList::StopWatchingAll(); message_loop_for_ui.task_runner()->PostDelayedTask( - FROM_HERE, message_loop_for_ui.QuitClosure(), + FROM_HERE, message_loop_for_ui.QuitWhenIdleClosure(), base::TimeDelta::FromSeconds( ThreadWatcherList::g_initialize_delay_seconds)); message_loop_for_ui.Run(); diff --git a/chrome/browser/net/dns_probe_browsertest.cc b/chrome/browser/net/dns_probe_browsertest.cc index de664cf..1cb43e7 100644 --- a/chrome/browser/net/dns_probe_browsertest.cc +++ b/chrome/browser/net/dns_probe_browsertest.cc @@ -666,7 +666,7 @@ void DnsProbeBrowserTest::OnDnsProbeStatusSent( DnsProbeStatus dns_probe_status) { dns_probe_status_queue_.push_back(dns_probe_status); if (awaiting_dns_probe_status_) - MessageLoop::current()->Quit(); + MessageLoop::current()->QuitWhenIdle(); } // Make sure probes don't break non-DNS error pages when corrections load. diff --git a/chrome/browser/net/predictor_browsertest.cc b/chrome/browser/net/predictor_browsertest.cc index 502b39e..7260873 100644 --- a/chrome/browser/net/predictor_browsertest.cc +++ b/chrome/browser/net/predictor_browsertest.cc @@ -181,7 +181,7 @@ class HostResolutionRequestRecorder : public net::HostResolverProc { if (is_waiting_for_hostname_ && waiting_for_hostname_ == hostname) { is_waiting_for_hostname_ = false; waiting_for_hostname_.clear(); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/net/predictor_unittest.cc b/chrome/browser/net/predictor_unittest.cc index 132f95c..00ed17f6 100644 --- a/chrome/browser/net/predictor_unittest.cc +++ b/chrome/browser/net/predictor_unittest.cc @@ -61,7 +61,7 @@ class WaitForResolutionHelper { // When all hostnames have been resolved, or we've hit the limit, // exit the loop. timer_->Stop(); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); delete timer_; delete this; } @@ -151,7 +151,7 @@ TEST_F(PredictorTest, ShutdownWhenResolutionIsPendingTest) { testing_master.ResolveList(names, UrlInfo::PAGE_SCAN_MOTIVATED); base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, base::MessageLoop::QuitClosure(), + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), base::TimeDelta::FromMilliseconds(500)); base::MessageLoop::current()->Run(); diff --git a/chrome/browser/net/sdch_browsertest.cc b/chrome/browser/net/sdch_browsertest.cc index 406aeca..00c9a80 100644 --- a/chrome/browser/net/sdch_browsertest.cc +++ b/chrome/browser/net/sdch_browsertest.cc @@ -640,7 +640,7 @@ class SdchBrowserTest : public InProcessBrowserTest, void OnURLFetchComplete(const net::URLFetcher* source) override { url_fetch_complete_ = true; if (waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } SdchResponseHandler response_handler_; diff --git a/chrome/browser/password_manager/native_backend_gnome_x_unittest.cc b/chrome/browser/password_manager/native_backend_gnome_x_unittest.cc index adcd284..c387919 100644 --- a/chrome/browser/password_manager/native_backend_gnome_x_unittest.cc +++ b/chrome/browser/password_manager/native_backend_gnome_x_unittest.cc @@ -405,7 +405,7 @@ class NativeBackendGnomeTest : public testing::Test { void TearDown() override { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); base::MessageLoop::current()->Run(); db_thread_.Stop(); } @@ -422,7 +422,8 @@ class NativeBackendGnomeTest : public testing::Test { } static void PostQuitTask(base::MessageLoop* loop) { - loop->task_runner()->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); + loop->task_runner()->PostTask(FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); } void CheckUint32Attribute(const MockKeyringItem* item, diff --git a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc index 7186cde..9f23b0d 100644 --- a/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc +++ b/chrome/browser/password_manager/native_backend_kwallet_x_unittest.cc @@ -388,7 +388,7 @@ void NativeBackendKWalletTest::SetUp() { void NativeBackendKWalletTest::TearDown() { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); base::MessageLoop::current()->Run(); db_thread_.Stop(); } diff --git a/chrome/browser/password_manager/native_backend_libsecret_unittest.cc b/chrome/browser/password_manager/native_backend_libsecret_unittest.cc index 759ba3f..c68673e 100644 --- a/chrome/browser/password_manager/native_backend_libsecret_unittest.cc +++ b/chrome/browser/password_manager/native_backend_libsecret_unittest.cc @@ -330,7 +330,7 @@ class NativeBackendLibsecretTest : public testing::Test { void TearDown() override { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); base::MessageLoop::current()->Run(); ASSERT_TRUE(global_mock_libsecret_items); global_mock_libsecret_items = nullptr; diff --git a/chrome/browser/password_manager/password_store_mac_unittest.cc b/chrome/browser/password_manager/password_store_mac_unittest.cc index 412e677..36cc507 100644 --- a/chrome/browser/password_manager/password_store_mac_unittest.cc +++ b/chrome/browser/password_manager/password_store_mac_unittest.cc @@ -50,7 +50,7 @@ namespace { ACTION(QuitUIMessageLoop) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } // From the mock's argument #0 of type const std::vector<PasswordForm*>& takes diff --git a/chrome/browser/password_manager/password_store_proxy_mac_unittest.cc b/chrome/browser/password_manager/password_store_proxy_mac_unittest.cc index d1bc400..a06e836 100644 --- a/chrome/browser/password_manager/password_store_proxy_mac_unittest.cc +++ b/chrome/browser/password_manager/password_store_proxy_mac_unittest.cc @@ -37,7 +37,7 @@ using testing::Pointee; ACTION(QuitUIMessageLoop) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } // Returns a change list corresponding to |form| being added. diff --git a/chrome/browser/password_manager/password_store_win_unittest.cc b/chrome/browser/password_manager/password_store_win_unittest.cc index c1c7ecb..173fe16 100644 --- a/chrome/browser/password_manager/password_store_win_unittest.cc +++ b/chrome/browser/password_manager/password_store_win_unittest.cc @@ -146,8 +146,8 @@ class PasswordStoreWinTest : public testing::Test { BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); done.Wait(); - base::MessageLoop::current()->PostTask(FROM_HERE, - base::MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); base::MessageLoop::current()->Run(); db_thread_.Stop(); } @@ -182,7 +182,7 @@ ACTION(STLDeleteElements0) { ACTION(QuitUIMessageLoop) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } MATCHER(EmptyWDResult, "") { diff --git a/chrome/browser/policy/cloud/device_management_service_browsertest.cc b/chrome/browser/policy/cloud/device_management_service_browsertest.cc index 76d13ed..cfe06fd 100644 --- a/chrome/browser/policy/cloud/device_management_service_browsertest.cc +++ b/chrome/browser/policy/cloud/device_management_service_browsertest.cc @@ -125,11 +125,10 @@ class DeviceManagementServiceIntegrationTest void PerformRegistration() { ExpectRequest(); EXPECT_CALL(*this, OnJobDone(DM_STATUS_SUCCESS, _, _)) - .WillOnce( - DoAll(Invoke(this, - &DeviceManagementServiceIntegrationTest::RecordToken), - InvokeWithoutArgs(base::MessageLoop::current(), - &base::MessageLoop::Quit))); + .WillOnce(DoAll( + Invoke(this, &DeviceManagementServiceIntegrationTest::RecordToken), + InvokeWithoutArgs(base::MessageLoop::current(), + &base::MessageLoop::QuitWhenIdle))); scoped_ptr<DeviceManagementRequestJob> job( service_->CreateJob(DeviceManagementRequestJob::TYPE_REGISTRATION, g_browser_process->system_request_context())); @@ -186,11 +185,10 @@ IN_PROC_BROWSER_TEST_P(DeviceManagementServiceIntegrationTest, ExpectRequest(); EXPECT_CALL(*this, OnJobDone(DM_STATUS_SUCCESS, _, _)) - .WillOnce( - DoAll(Invoke(this, - &DeviceManagementServiceIntegrationTest::RecordAuthCode), - InvokeWithoutArgs(base::MessageLoop::current(), - &base::MessageLoop::Quit))); + .WillOnce(DoAll( + Invoke(this, &DeviceManagementServiceIntegrationTest::RecordAuthCode), + InvokeWithoutArgs(base::MessageLoop::current(), + &base::MessageLoop::QuitWhenIdle))); scoped_ptr<DeviceManagementRequestJob> job(service_->CreateJob( DeviceManagementRequestJob::TYPE_API_AUTH_CODE_FETCH, g_browser_process->system_request_context())); @@ -212,7 +210,7 @@ IN_PROC_BROWSER_TEST_P(DeviceManagementServiceIntegrationTest, PolicyFetch) { ExpectRequest(); EXPECT_CALL(*this, OnJobDone(DM_STATUS_SUCCESS, _, _)) .WillOnce(InvokeWithoutArgs(base::MessageLoop::current(), - &base::MessageLoop::Quit)); + &base::MessageLoop::QuitWhenIdle)); scoped_ptr<DeviceManagementRequestJob> job( service_->CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, g_browser_process->system_request_context())); @@ -232,7 +230,7 @@ IN_PROC_BROWSER_TEST_P(DeviceManagementServiceIntegrationTest, Unregistration) { ExpectRequest(); EXPECT_CALL(*this, OnJobDone(DM_STATUS_SUCCESS, _, _)) .WillOnce(InvokeWithoutArgs(base::MessageLoop::current(), - &base::MessageLoop::Quit)); + &base::MessageLoop::QuitWhenIdle)); scoped_ptr<DeviceManagementRequestJob> job( service_->CreateJob(DeviceManagementRequestJob::TYPE_UNREGISTRATION, g_browser_process->system_request_context())); @@ -248,7 +246,7 @@ IN_PROC_BROWSER_TEST_P(DeviceManagementServiceIntegrationTest, AutoEnrollment) { ExpectRequest(); EXPECT_CALL(*this, OnJobDone(DM_STATUS_SUCCESS, _, _)) .WillOnce(InvokeWithoutArgs(base::MessageLoop::current(), - &base::MessageLoop::Quit)); + &base::MessageLoop::QuitWhenIdle)); scoped_ptr<DeviceManagementRequestJob> job( service_->CreateJob(DeviceManagementRequestJob::TYPE_AUTO_ENROLLMENT, g_browser_process->system_request_context())); diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index d965602..d4b38f3 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -295,17 +295,15 @@ class MakeRequestFail { public: // Sets up the filter on IO thread such that requests to |host| fail. explicit MakeRequestFail(const std::string& host) : host_(host) { - BrowserThread::PostTaskAndReply( - BrowserThread::IO, FROM_HERE, - base::Bind(MakeRequestFailOnIO, host_), - base::MessageLoop::QuitClosure()); + BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE, + base::Bind(MakeRequestFailOnIO, host_), + base::MessageLoop::QuitWhenIdleClosure()); content::RunMessageLoop(); } ~MakeRequestFail() { - BrowserThread::PostTaskAndReply( - BrowserThread::IO, FROM_HERE, - base::Bind(UndoMakeRequestFailOnIO, host_), - base::MessageLoop::QuitClosure()); + BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE, + base::Bind(UndoMakeRequestFailOnIO, host_), + base::MessageLoop::QuitWhenIdleClosure()); content::RunMessageLoop(); } @@ -688,10 +686,9 @@ class PolicyTest : public InProcessBrowserTest { void OnScreenshotCompleted( ScreenshotGrabberObserver::Result screenshot_result, const base::FilePath& screenshot_path) override { - BrowserThread::PostTaskAndReply(BrowserThread::IO, - FROM_HERE, + BrowserThread::PostTaskAndReply(BrowserThread::IO, FROM_HERE, base::Bind(base::DoNothing), - base::MessageLoop::QuitClosure()); + base::MessageLoop::QuitWhenIdleClosure()); } ~QuitMessageLoopAfterScreenshot() override {} diff --git a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc index 14a01fa..43ccc3f 100644 --- a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc +++ b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc @@ -364,7 +364,7 @@ class CloudPrintProxyPolicyStartupTest : public base::MultiProcessTest, void Notify() { seen_ = true; if (running_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } private: diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc index 66473c27..6da0aa0 100644 --- a/chrome/browser/printing/print_job.cc +++ b/chrome/browser/printing/print_job.cc @@ -443,7 +443,7 @@ void PrintJob::HoldUntilStopIsCalled() { } void PrintJob::Quit() { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } // Takes settings_ ownership and will be deleted in the receiving thread. diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc index 84cabec..421bb1e 100644 --- a/chrome/browser/printing/print_view_manager_base.cc +++ b/chrome/browser/printing/print_view_manager_base.cc @@ -324,9 +324,9 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() { // to actually spool the pages, only to have the renderer generate them. Run // a message loop until we get our signal that the print job is satisfied. // PrintJob will send a ALL_PAGES_REQUESTED after having received all the - // pages it needs. MessageLoop::current()->Quit() will be called as soon as - // print_job_->document()->IsComplete() is true on either ALL_PAGES_REQUESTED - // or in DidPrintPage(). The check is done in + // pages it needs. MessageLoop::current()->QuitWhenIdle() will be called as + // soon as print_job_->document()->IsComplete() is true on either + // ALL_PAGES_REQUESTED or in DidPrintPage(). The check is done in // ShouldQuitFromInnerMessageLoop(). // BLOCKS until all the pages are received. (Need to enable recursive task) if (!RunInnerMessageLoop()) { @@ -345,7 +345,7 @@ void PrintViewManagerBase::ShouldQuitFromInnerMessageLoop() { inside_inner_message_loop_) { // We are in a message loop created by RenderAllMissingPagesNow. Quit from // it. - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); inside_inner_message_loop_ = false; } } @@ -451,9 +451,9 @@ bool PrintViewManagerBase::RunInnerMessageLoop() { // memory-bound. static const int kPrinterSettingsTimeout = 60000; base::OneShotTimer quit_timer; - quit_timer.Start(FROM_HERE, - TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), - base::MessageLoop::current(), &base::MessageLoop::Quit); + quit_timer.Start( + FROM_HERE, TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), + base::MessageLoop::current(), &base::MessageLoop::QuitWhenIdle); inside_inner_message_loop_ = true; diff --git a/chrome/browser/printing/printing_layout_browsertest.cc b/chrome/browser/printing/printing_layout_browsertest.cc index 4755a18..3ab5dff 100644 --- a/chrome/browser/printing/printing_layout_browsertest.cc +++ b/chrome/browser/printing/printing_layout_browsertest.cc @@ -80,7 +80,7 @@ class PrintingLayoutTest : public PrintingTest<InProcessBrowserTest>, case printing::JobEventDetails::JOB_DONE: { // Succeeded. base::MessageLoop::current()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); break; } case printing::JobEventDetails::USER_INIT_CANCELED: @@ -88,7 +88,7 @@ class PrintingLayoutTest : public PrintingTest<InProcessBrowserTest>, // Failed. ASSERT_TRUE(false); base::MessageLoop::current()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); break; } case printing::JobEventDetails::NEW_DOC: diff --git a/chrome/browser/profiles/profile_list_desktop_browsertest.cc b/chrome/browser/profiles/profile_list_desktop_browsertest.cc index b49e226..bc0f641 100644 --- a/chrome/browser/profiles/profile_list_desktop_browsertest.cc +++ b/chrome/browser/profiles/profile_list_desktop_browsertest.cc @@ -24,7 +24,7 @@ namespace { void OnUnblockOnProfileCreation(Profile* profile, Profile::CreateStatus status) { if (status == Profile::CREATE_STATUS_INITIALIZED) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } } // namespace diff --git a/chrome/browser/profiles/profile_manager_browsertest.cc b/chrome/browser/profiles/profile_manager_browsertest.cc index 51af357..b9c7222 100644 --- a/chrome/browser/profiles/profile_manager_browsertest.cc +++ b/chrome/browser/profiles/profile_manager_browsertest.cc @@ -54,7 +54,7 @@ void ProfileCreationComplete(Profile* profile, Profile::CreateStatus status) { EXPECT_EQ(chrome::GetTotalBrowserCountForProfile(profile), 0U); EXPECT_EQ(chrome::GetTotalBrowserCount(), 1U); if (status == Profile::CREATE_STATUS_INITIALIZED) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void EphemeralProfileCreationComplete(Profile* profile, diff --git a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc index 6a9bfd3..44b0f91 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc @@ -87,8 +87,8 @@ class ProfileShortcutManagerTest : public testing::Test { } void RunPendingTasks() { - base::MessageLoop::current()->PostTask(FROM_HERE, - base::MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); base::MessageLoop::current()->Run(); } diff --git a/chrome/browser/profiles/profile_window_browsertest.cc b/chrome/browser/profiles/profile_window_browsertest.cc index 16fc0fc..817b46b 100644 --- a/chrome/browser/profiles/profile_window_browsertest.cc +++ b/chrome/browser/profiles/profile_window_browsertest.cc @@ -54,7 +54,9 @@ class WaitForHistoryTask : public history::HistoryDBTask { return true; } - void DoneRunOnMainThread() override { base::MessageLoop::current()->Quit(); } + void DoneRunOnMainThread() override { + base::MessageLoop::current()->QuitWhenIdle(); + } private: ~WaitForHistoryTask() override {} diff --git a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc index fb7606c9..32a26fc 100644 --- a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc +++ b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc @@ -119,7 +119,7 @@ class ChromeRenderProcessHostTest : public InProcessBrowserTest { void WaitForLauncherThread() { content::BrowserThread::PostTaskAndReply( content::BrowserThread::PROCESS_LAUNCHER, FROM_HERE, - base::Bind(&base::DoNothing), base::MessageLoop::QuitClosure()); + base::Bind(&base::DoNothing), base::MessageLoop::QuitWhenIdleClosure()); base::MessageLoop::current()->Run(); } diff --git a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc index 32e3e69..612156f 100644 --- a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc +++ b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc @@ -220,7 +220,7 @@ class BrowserFeatureExtractorTest : public ChromeRenderViewHostTestHarness { // the test case which passed it to ExtractFeatures above. success_[request.release()] = success; if (--num_pending_ == 0) { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } } @@ -233,7 +233,7 @@ class BrowserFeatureExtractorTest : public ChromeRenderViewHostTestHarness { // the test case which passed it to ExtractMalwareFeatures above. success_[request.release()] = success; if (--num_pending_ == 0) { - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } }; diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc index bb744cc..20a6464 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc @@ -90,7 +90,7 @@ MATCHER(CallbackIsNull, "") { ACTION(QuitUIMessageLoop) { EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } ACTION_P(InvokeDoneCallback, verdict) { diff --git a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc index ca40838..59411cc 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc @@ -236,7 +236,7 @@ class ClientSideDetectionServiceTest : public testing::Test { void SendRequestDone(GURL phishing_url, bool is_phishing) { ASSERT_EQ(phishing_url, phishing_url_); is_phishing_ = is_phishing; - msg_loop_.Quit(); + msg_loop_.QuitWhenIdle(); } void SendMalwareRequestDone(GURL original_url, GURL malware_url, @@ -244,7 +244,7 @@ class ClientSideDetectionServiceTest : public testing::Test { ASSERT_EQ(phishing_url_, original_url); confirmed_malware_url_ = malware_url; is_malware_ = is_malware; - msg_loop_.Quit(); + msg_loop_.QuitWhenIdle(); } scoped_ptr<content::TestBrowserThread> browser_thread_; diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc index cd27712..2606c2f 100644 --- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc @@ -343,9 +343,7 @@ class DownloadProtectionServiceTest : public testing::Test { base::Unretained(this))); } - void QuitMessageLoop() { - base::MessageLoop::current()->Quit(); - } + void QuitMessageLoop() { base::MessageLoop::current()->QuitWhenIdle(); } void PostRunMessageLoopTask(BrowserThread::ID thread) { BrowserThread::PostTask( @@ -377,7 +375,7 @@ class DownloadProtectionServiceTest : public testing::Test { DownloadProtectionService::DownloadCheckResult result) { result_ = result; has_result_ = true; - MessageLoop::current()->Quit(); + MessageLoop::current()->QuitWhenIdle(); } void SyncCheckDoneCallback( diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc index 99488eac..96f8352 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc @@ -266,7 +266,7 @@ class FakeMalwareDetails : public MalwareDetails { void OnDOMDetailsDone() { got_dom_ = true; if (waiting_) { - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } @@ -315,7 +315,7 @@ class TestSafeBrowsingBlockingPage : public SafeBrowsingBlockingPage { return; // Notify that we are gone - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); wait_for_delete_ = false; } diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc index e98c15d..5a98689 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc @@ -876,9 +876,7 @@ class TestSBClient base::Bind(&TestSBClient::CheckDone, this)); } - void CheckDone() { - base::MessageLoopForUI::current()->Quit(); - } + void CheckDone() { base::MessageLoopForUI::current()->QuitWhenIdle(); } SBThreatType threat_type_; SafeBrowsingService* safe_browsing_service_; @@ -1149,7 +1147,7 @@ class SafeBrowsingServiceShutdownTest : public SafeBrowsingServiceTest { Profile::CreateStatus status) { if (status == Profile::CREATE_STATUS_INITIALIZED) { profile2_ = profile; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc index 9e0d347..60b215e 100644 --- a/chrome/browser/safe_browsing/safe_browsing_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_test.cc @@ -472,7 +472,7 @@ class SafeBrowsingServerTestHelper // Stops UI loop after desired status is updated. void StopUILoop() { EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } // Fetch a URL. If message_loop_started is true, starts the message loop diff --git a/chrome/browser/service_process/service_process_control_browsertest.cc b/chrome/browser/service_process/service_process_control_browsertest.cc index 2be64a7..8228194 100644 --- a/chrome/browser/service_process/service_process_control_browsertest.cc +++ b/chrome/browser/service_process/service_process_control_browsertest.cc @@ -55,7 +55,7 @@ class ServiceProcessControlBrowserTest } static void QuitMessageLoop() { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } static void CloudPrintInfoCallback( @@ -111,14 +111,14 @@ class ServiceProcessControlBrowserTest // because this can get invoked in the context of a Launch() call and we // may not be in Run() yet. base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); } void ProcessControlLaunchFailed() { ADD_FAILURE(); // Quit the current message. base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); } private: @@ -200,7 +200,7 @@ static void DecrementUntilZero(int* count) { (*count)--; if (!(*count)) base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); } // Flaky on Mac. http://crbug.com/517420 @@ -218,7 +218,7 @@ IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, for (int i = 0; i < launch_count; i++) { // Launch the process asynchronously. process->Launch(base::Bind(&DecrementUntilZero, &launch_count), - base::MessageLoop::QuitClosure()); + base::MessageLoop::QuitWhenIdleClosure()); } // Then run the message loop to keep things running. content::RunMessageLoop(); diff --git a/chrome/browser/site_details_browsertest.cc b/chrome/browser/site_details_browsertest.cc index 43c955a..bd3420fc 100644 --- a/chrome/browser/site_details_browsertest.cc +++ b/chrome/browser/site_details_browsertest.cc @@ -61,7 +61,7 @@ class TestMemoryDetails : public MetricsMemoryDetails { void OnDetailsAvailable() override { MetricsMemoryDetails::OnDetailsAvailable(); // Exit the loop initiated by StartFetchAndWait(). - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } scoped_ptr<base::HistogramTester> uma_; diff --git a/chrome/browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc b/chrome/browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc index 591513c..4e15232 100644 --- a/chrome/browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc +++ b/chrome/browser/spellchecker/spellcheck_message_filter_platform_mac_browsertest.cc @@ -24,7 +24,7 @@ class TestingSpellCheckMessageFilter : public SpellCheckMessageFilterPlatform { bool Send(IPC::Message* message) override { sent_messages_.push_back(message); - loop_->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); + loop_->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); return true; } diff --git a/chrome/browser/spellchecker/spellcheck_platform_mac_unittest.cc b/chrome/browser/spellchecker/spellcheck_platform_mac_unittest.cc index 4375e00..c8dbe9d 100644 --- a/chrome/browser/spellchecker/spellcheck_platform_mac_unittest.cc +++ b/chrome/browser/spellchecker/spellcheck_platform_mac_unittest.cc @@ -32,7 +32,7 @@ class SpellcheckPlatformMacTest: public testing::Test { private: void QuitMessageLoop() { CHECK(base::MessageLoop::current() == &message_loop_); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void CompletionCallback(const std::vector<SpellCheckResult>& results) { diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 8b79012..cd4a177 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -125,7 +125,7 @@ class ProvisionalLoadWaiter : public content::WebContentsObserver { bool was_ignored_by_handler) override { seen_ = true; if (waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } private: @@ -336,7 +336,7 @@ class SSLUITest // Wait a bit. base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, base::MessageLoop::QuitClosure(), + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), base::TimeDelta::FromMilliseconds(kTimeoutMS)); content::RunMessageLoop(); } @@ -1760,7 +1760,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) { if (IsShowingWebContentsModalDialog()) break; base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, base::MessageLoop::QuitClosure(), + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), base::TimeDelta::FromSeconds(1)); content::RunMessageLoop(); } diff --git a/chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc b/chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc index 9d6891ca..aa78da1 100644 --- a/chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc +++ b/chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc @@ -60,8 +60,8 @@ class SyncBrowserThreadModelWorkerTest : public testing::Test { syncer::SyncerError DoWork() { EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); timer_.Stop(); // Stop the failure timer so the test succeeds. - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, base::MessageLoop::QuitClosure()); + BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); did_do_work_ = true; return syncer::SYNCER_OK; } @@ -70,8 +70,8 @@ class SyncBrowserThreadModelWorkerTest : public testing::Test { // DoWork is called first. void Timeout() { ADD_FAILURE() << "Timed out waiting for work to be done on the DB thread."; - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, base::MessageLoop::QuitClosure()); + BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); } protected: diff --git a/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc index 4c09eea..d424388 100644 --- a/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc +++ b/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc @@ -70,7 +70,7 @@ ACTION_P(Signal, event) { } void QuitMessageLoop() { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } class MockSyncFrontend : public sync_driver::SyncFrontend { @@ -274,7 +274,7 @@ class SyncBackendHostTest : public testing::Test { protected: void DownloadReady(syncer::ModelTypeSet succeeded_types, syncer::ModelTypeSet failed_types) { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void OnDownloadRetry() { diff --git a/chrome/browser/sync/glue/ui_model_worker_unittest.cc b/chrome/browser/sync/glue/ui_model_worker_unittest.cc index e0e02cc..f256eee 100644 --- a/chrome/browser/sync/glue/ui_model_worker_unittest.cc +++ b/chrome/browser/sync/glue/ui_model_worker_unittest.cc @@ -31,7 +31,7 @@ class UIModelWorkerVisitor { EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); was_run_->Signal(); if (quit_loop_when_run_) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); return syncer::SYNCER_OK; } diff --git a/chrome/browser/sync/profile_sync_test_util.h b/chrome/browser/sync/profile_sync_test_util.h index 2fb4274..7062907 100644 --- a/chrome/browser/sync/profile_sync_test_util.h +++ b/chrome/browser/sync/profile_sync_test_util.h @@ -30,7 +30,7 @@ ACTION_P(Notify, type) { ACTION(QuitUIMessageLoop) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } class SyncServiceObserverMock : public sync_driver::SyncServiceObserver { diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc index aa9aba7..4b5db5c 100644 --- a/chrome/browser/sync/test/integration/bookmarks_helper.cc +++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc @@ -129,7 +129,7 @@ class FaviconChangeObserver : public bookmarks::BookmarkModelObserver { const BookmarkNode* node) override { if (model == model_ && node == node_) { if (!wait_for_load_ || (wait_for_load_ && node->is_favicon_loaded())) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } } diff --git a/chrome/browser/sync/test/integration/passwords_helper.cc b/chrome/browser/sync/test/integration/passwords_helper.cc index ade29b6..4b9de83 100644 --- a/chrome/browser/sync/test/integration/passwords_helper.cc +++ b/chrome/browser/sync/test/integration/passwords_helper.cc @@ -48,7 +48,7 @@ class PasswordStoreConsumerHelper void OnGetPasswordStoreResults(ScopedVector<PasswordForm> results) override { result_.swap(results); // Quit the message loop to wake up passwords_helper::GetLogins. - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } ScopedVector<PasswordForm> result() { return result_.Pass(); } diff --git a/chrome/browser/sync/test/integration/sessions_helper.cc b/chrome/browser/sync/test/integration/sessions_helper.cc index d8ecce4..d69baa2 100644 --- a/chrome/browser/sync/test/integration/sessions_helper.cc +++ b/chrome/browser/sync/test/integration/sessions_helper.cc @@ -156,9 +156,7 @@ class TabEventHandler : public browser_sync::LocalSessionEventHandler { } private: - void QuitLoop() { - base::MessageLoop::current()->Quit(); - } + void QuitLoop() { base::MessageLoop::current()->QuitWhenIdle(); } base::WeakPtrFactory<TabEventHandler> weak_factory_; }; diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index 1e37357..53fd6b8 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -116,7 +116,7 @@ class SyncServerStatusChecker : public net::URLFetcherDelegate { running_ = (source->GetStatus().status() == net::URLRequestStatus::SUCCESS && source->GetResponseCode() == 200 && data.find("ok") == 0); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } bool running() const { return running_; } diff --git a/chrome/browser/sync/test_profile_sync_service.cc b/chrome/browser/sync/test_profile_sync_service.cc index 323b957..6ee7799 100644 --- a/chrome/browser/sync/test_profile_sync_service.cc +++ b/chrome/browser/sync/test_profile_sync_service.cc @@ -181,7 +181,7 @@ TestProfileSyncService::GetSyncApiComponentFactoryMock() { void TestProfileSyncService::OnConfigureDone( const sync_driver::DataTypeManager::ConfigureResult& result) { ProfileSyncService::OnConfigureDone(result); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } UserShare* TestProfileSyncService::GetUserShare() const { diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc index 46f4c6d..82b4989 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc +++ b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc @@ -132,7 +132,7 @@ class LocalFileSyncContextTest : public testing::Test { *changes_out = sync_file_info.changes; if (snapshot_out) *snapshot_out = snapshot.Pass(); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } SyncStatusCode ApplyRemoteChange(FileSystemContext* file_system_context, @@ -169,7 +169,7 @@ class LocalFileSyncContextTest : public testing::Test { sync_context_->FinalizeExclusiveSync( file_system_context, url, status == SYNC_STATUS_OK /* clear_local_changes */, - base::MessageLoop::QuitClosure()); + base::MessageLoop::QuitWhenIdleClosure()); } void StartModifyFileOnIOThread(CannedSyncableFileSystem* file_system, diff --git a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc index 9d477c9..2391dcc 100644 --- a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc +++ b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc @@ -132,7 +132,7 @@ class SyncableFileOperationRunnerTest : public testing::Test { SCOPED_TRACE(testing::Message() << location.ToString()); EXPECT_EQ(expect, status); ++callback_count_; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } bool CreateTempFile(base::FilePath* path) { diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc index e10c952..44eded2 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc @@ -800,8 +800,8 @@ class MultiProfileMultiBrowserShelfLayoutChromeLauncherControllerTest // A Task is leaked if we don't destroy everything, then run the message // loop. - base::MessageLoop::current()->PostTask(FROM_HERE, - base::MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); base::MessageLoop::current()->Run(); } diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 89435cc..3b5e683 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -1043,7 +1043,7 @@ class BeforeUnloadAtQuitWithTwoWindows : public InProcessBrowserTest { // Run the application event loop to completion, which will cycle the // native MessagePump on all platforms. base::MessageLoop::current()->task_runner()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); base::MessageLoop::current()->Run(); // Take care of any remaining Cocoa work. diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc index 7511437..1667d7a 100644 --- a/chrome/browser/ui/browser_focus_uitest.cc +++ b/chrome/browser/ui/browser_focus_uitest.cc @@ -202,7 +202,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_ClickingMovesFocus) { // It seems we have to wait a little bit for the widgets to spin up before // we can start clicking on them. base::MessageLoop::current()->task_runner()->PostDelayedTask( - FROM_HERE, base::MessageLoop::QuitClosure(), + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), base::TimeDelta::FromMilliseconds(kActionDelayMs)); content::RunMessageLoop(); #endif // defined(OS_POSIX) diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state_unittest.mm index f9a95ba..f31befc 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state_unittest.mm @@ -47,7 +47,7 @@ TEST_F(BookmarkBarFolderHoverStateTest, HoverState) { // Test transition from opening to opened. message_loop.PostDelayedTask( FROM_HERE, - base::MessageLoop::QuitClosure(), + base::MessageLoop::QuitWhenIdleClosure(), base::TimeDelta::FromMilliseconds( bookmarks::kDragHoverOpenDelay * 1000.0 * 1.5)); message_loop.Run(); @@ -68,7 +68,7 @@ TEST_F(BookmarkBarFolderHoverStateTest, HoverState) { ASSERT_EQ(kHoverStateClosing, [bbfhs hoverState]); message_loop.PostDelayedTask( FROM_HERE, - base::MessageLoop::QuitClosure(), + base::MessageLoop::QuitWhenIdleClosure(), base::TimeDelta::FromMilliseconds( bookmarks::kDragHoverCloseDelay * 1000.0 * 1.5)); message_loop.Run(); diff --git a/chrome/browser/ui/cocoa/location_bar/zoom_decoration_browsertest.mm b/chrome/browser/ui/cocoa/location_bar/zoom_decoration_browsertest.mm index 61ef358..4261962 100644 --- a/chrome/browser/ui/cocoa/location_bar/zoom_decoration_browsertest.mm +++ b/chrome/browser/ui/cocoa/location_bar/zoom_decoration_browsertest.mm @@ -64,9 +64,10 @@ class ZoomDecorationTest : public InProcessBrowserTest { void OnZoomChanged(const content::HostZoomMap::ZoomLevelChange& host) { if (should_quit_on_zoom_) { - base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( - &base::MessageLoop::Quit, - base::Unretained(base::MessageLoop::current()))); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&base::MessageLoop::QuitWhenIdle, + base::Unretained(base::MessageLoop::current()))); } } diff --git a/chrome/browser/ui/exclusive_access/flash_fullscreen_interactive_browsertest.cc b/chrome/browser/ui/exclusive_access/flash_fullscreen_interactive_browsertest.cc index d0e6b8c..7c987e1 100644 --- a/chrome/browser/ui/exclusive_access/flash_fullscreen_interactive_browsertest.cc +++ b/chrome/browser/ui/exclusive_access/flash_fullscreen_interactive_browsertest.cc @@ -37,7 +37,7 @@ bool RunLoopUntil(const base::Callback<bool()>& condition) { } base::MessageLoop::current()->task_runner()->PostDelayedTask( - FROM_HERE, base::MessageLoop::QuitClosure(), + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), base::TimeDelta::FromMilliseconds(20)); content::RunMessageLoop(); } @@ -228,13 +228,11 @@ class FlashFullscreenInteractiveBrowserTest : public OutOfProcessPPAPITest { // |expected_color|. bool is_expected_color = false; flash_fs_host->CopyFromBackingStore( - gfx::Rect(0, 0, 1, 1), - gfx::Size(1, 1), + gfx::Rect(0, 0, 1, 1), gfx::Size(1, 1), base::Bind( &FlashFullscreenInteractiveBrowserTest::CheckBitmapForFillColor, - expected_color, - &is_expected_color, - base::MessageLoop::QuitClosure()), + expected_color, &is_expected_color, + base::MessageLoop::QuitWhenIdleClosure()), kN32_SkColorType); content::RunMessageLoop(); diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc index a949449..4b32edd 100644 --- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc +++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc @@ -198,7 +198,7 @@ class FindInPageControllerTest : public InProcessBrowserTest { HistoryServiceFactory::GetForProfile(browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS) ->FlushForTest(base::Bind( - &base::MessageLoop::Quit, + &base::MessageLoop::QuitWhenIdle, base::Unretained(base::MessageLoop::current()->current()))); content::RunMessageLoop(); } diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc index a25b311..ab12bb7 100644 --- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc +++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc @@ -155,7 +155,7 @@ class OmniboxViewTest : public InProcessBrowserTest, // history::HisoryServiceObserver void OnHistoryServiceLoaded( history::HistoryService* history_service) override { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } protected: @@ -369,12 +369,12 @@ class OmniboxViewTest : public InProcessBrowserTest, default: FAIL() << "Unexpected notification type"; } - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void OnURLsModified(history::HistoryService* history_service, const history::URLRows& changed_urls) override { - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } private: diff --git a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc index aae0adf..34a519e 100644 --- a/chrome/browser/ui/search/instant_extended_interactive_uitest.cc +++ b/chrome/browser/ui/search/instant_extended_interactive_uitest.cc @@ -95,7 +95,9 @@ class QuittingHistoryDBTask : public history::HistoryDBTask { return true; } - void DoneRunOnMainThread() override { base::MessageLoop::current()->Quit(); } + void DoneRunOnMainThread() override { + base::MessageLoop::current()->QuitWhenIdle(); + } private: ~QuittingHistoryDBTask() override {} diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc index 66c4092..73c76e3 100644 --- a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc +++ b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc @@ -46,7 +46,7 @@ class FaviconDelegate : public ui::MenuModelDelegate { void OnIconChanged(int model_index) override { was_called_ = true; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } bool was_called() const { return was_called_; } diff --git a/chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc b/chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc index ef19840..dc33183 100644 --- a/chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc +++ b/chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc @@ -48,7 +48,7 @@ namespace { void UnblockOnProfileCreation(Profile* profile, Profile::CreateStatus status) { if (status == Profile::CREATE_STATUS_INITIALIZED) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } // Checks that the relaunch name, relaunch command and app icon for the given @@ -95,7 +95,7 @@ void ValidateBrowserWindowProperties( browser->profile()->GetPath()).value(), prop_var.get().pwszVal); prop_var.Reset(); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void ValidateHostedAppWindowProperties(const Browser* browser, @@ -140,7 +140,7 @@ void ValidateHostedAppWindowProperties(const Browser* browser, web_app_dir, base::UTF8ToUTF16(extension->name())).value(), prop_var.get().pwszVal); prop_var.Reset(); - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void PostValidationTaskToUIThread(const base::Closure& validation_task) { diff --git a/chrome/browser/ui/views/keyboard_access_browsertest.cc b/chrome/browser/ui/views/keyboard_access_browsertest.cc index eaa5b47..deb8050 100644 --- a/chrome/browser/ui/views/keyboard_access_browsertest.cc +++ b/chrome/browser/ui/views/keyboard_access_browsertest.cc @@ -68,8 +68,8 @@ class ViewFocusChangeWaiter : public views::FocusChangeListener { void OnDidChangeFocus(views::View* focused_before, views::View* focused_now) override { if (focused_now && focused_now->id() != previous_view_id_) { - base::MessageLoop::current()->PostTask(FROM_HERE, - base::MessageLoop::QuitClosure()); + base::MessageLoop::current()->PostTask( + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); } } @@ -113,8 +113,7 @@ class SendKeysMenuListener : public views::MenuListener { } else { SendKeyPress(browser_, ui::VKEY_ESCAPE); base::MessageLoop::current()->PostDelayedTask( - FROM_HERE, - base::MessageLoop::QuitClosure(), + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), base::TimeDelta::FromMilliseconds(200)); } } diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc index 36bca05..337e07b 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc @@ -96,7 +96,7 @@ class QuitDraggingObserver : public content::NotificationObserver { const content::NotificationSource& source, const content::NotificationDetails& details) override { DCHECK_EQ(chrome::NOTIFICATION_TAB_DRAG_LOOP_DONE, type); - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); delete this; } diff --git a/chrome/browser/ui/views/web_dialog_view_browsertest.cc b/chrome/browser/ui/views/web_dialog_view_browsertest.cc index 286bcd8..d14883e 100644 --- a/chrome/browser/ui/views/web_dialog_view_browsertest.cc +++ b/chrome/browser/ui/views/web_dialog_view_browsertest.cc @@ -57,7 +57,7 @@ class TestWebDialogView : public views::WebDialogView { // loop. base::MessageLoop::current()->task_runner()->PostTask( FROM_HERE, - base::Bind(&base::MessageLoop::Quit, + base::Bind(&base::MessageLoop::QuitWhenIdle, base::Unretained(base::MessageLoop::current()))); } diff --git a/chrome/browser/ui/website_settings/mock_permission_bubble_view.cc b/chrome/browser/ui/website_settings/mock_permission_bubble_view.cc index 7406d13..f4436d6 100644 --- a/chrome/browser/ui/website_settings/mock_permission_bubble_view.cc +++ b/chrome/browser/ui/website_settings/mock_permission_bubble_view.cc @@ -54,7 +54,7 @@ void MockPermissionBubbleView::Show( permission_requests_ = requests; permission_states_ = accept_state; if (browser_test_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); } void MockPermissionBubbleView::Hide() { diff --git a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc index 522c3e6..cb83a4d 100644 --- a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc +++ b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc @@ -69,10 +69,9 @@ void ReloadLocaleResourcesOnIOThread(const std::string& new_locale) { // crbug.com/95425, crbug.com/132752 void ReloadLocaleResources(const std::string& new_locale) { content::BrowserThread::PostTaskAndReply( - content::BrowserThread::IO, - FROM_HERE, + content::BrowserThread::IO, FROM_HERE, base::Bind(&ReloadLocaleResourcesOnIOThread, base::ConstRef(new_locale)), - base::MessageLoop::QuitClosure()); + base::MessageLoop::QuitWhenIdleClosure()); content::RunMessageLoop(); } diff --git a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc index 33ebfa96..08fec2d 100644 --- a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc +++ b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc @@ -77,7 +77,7 @@ class ConstrainedWebDialogBrowserTest : public InProcessBrowserTest { } base::MessageLoop::current()->task_runner()->PostDelayedTask( - FROM_HERE, base::MessageLoop::QuitClosure(), + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), base::TimeDelta::FromMilliseconds(20)); content::RunMessageLoop(); } diff --git a/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc b/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc index 4eb030b..7c8dcf5 100644 --- a/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc +++ b/chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc @@ -91,18 +91,18 @@ class MockDownloadsDOMHandler : public DownloadsDOMHandler { void CallUpdateAll(const base::ListValue& list) override { downloads_list_.reset(list.DeepCopy()); if (waiting_list_) { - content::BrowserThread::PostTask(content::BrowserThread::UI, - FROM_HERE, - base::MessageLoop::QuitClosure()); + content::BrowserThread::PostTask( + content::BrowserThread::UI, FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); } } void CallUpdateItem(const base::DictionaryValue& item) override { download_updated_.reset(item.DeepCopy()); if (waiting_updated_) { - content::BrowserThread::PostTask(content::BrowserThread::UI, - FROM_HERE, - base::MessageLoop::QuitClosure()); + content::BrowserThread::PostTask( + content::BrowserThread::UI, FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); } } diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc index f08f5fe..17e53b8 100644 --- a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc +++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc @@ -289,7 +289,7 @@ class TestMessageLoopCondition { void Signal() { signaled_ = true; if (waiting_) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } // Pause execution and recursively run the message loop until |Signal()| is @@ -437,9 +437,9 @@ class LocalDiscoveryUITest : public WebUIBrowserTest { } void RunFor(base::TimeDelta time_period) { - base::CancelableCallback<void()> callback(base::Bind( - &base::MessageLoop::Quit, base::Unretained( - base::MessageLoop::current()))); + base::CancelableCallback<void()> callback( + base::Bind(&base::MessageLoop::QuitWhenIdle, + base::Unretained(base::MessageLoop::current()))); base::MessageLoop::current()->task_runner()->PostDelayedTask( FROM_HERE, callback.callback(), time_period); diff --git a/chrome/browser/ui/webui/web_ui_test_handler.cc b/chrome/browser/ui/webui/web_ui_test_handler.cc index d4e03aa..a249c1e 100644 --- a/chrome/browser/ui/webui/web_ui_test_handler.cc +++ b/chrome/browser/ui/webui/web_ui_test_handler.cc @@ -61,7 +61,7 @@ void WebUITestHandler::HandleTestResult(const base::ListValue* test_result) { // Quit the message loop if |is_waiting_| so waiting process can get result or // error. To ensure this gets done, do this before ASSERT* calls. if (is_waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); SCOPED_TRACE("WebUITestHandler::HandleTestResult"); @@ -81,7 +81,7 @@ void WebUITestHandler::JavaScriptComplete(const base::Value* result) { // Quit the message loop if |is_waiting_| so waiting process can get result or // error. To ensure this gets done, do this before ASSERT* calls. if (is_waiting_) - base::MessageLoopForUI::current()->Quit(); + base::MessageLoopForUI::current()->QuitWhenIdle(); SCOPED_TRACE("WebUITestHandler::JavaScriptComplete"); diff --git a/chrome/common/local_discovery/local_domain_resolver_unittest.cc b/chrome/common/local_discovery/local_domain_resolver_unittest.cc index f55783e..f34ff2db 100644 --- a/chrome/common/local_discovery/local_domain_resolver_unittest.cc +++ b/chrome/common/local_discovery/local_domain_resolver_unittest.cc @@ -81,9 +81,9 @@ class LocalDomainResolverTest : public testing::Test { } void RunFor(base::TimeDelta time_period) { - base::CancelableCallback<void()> callback(base::Bind( - &base::MessageLoop::Quit, - base::Unretained(base::MessageLoop::current()))); + base::CancelableCallback<void()> callback( + base::Bind(&base::MessageLoop::QuitWhenIdle, + base::Unretained(base::MessageLoop::current()))); base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, callback.callback(), time_period); diff --git a/chrome/common/local_discovery/service_discovery_client_unittest.cc b/chrome/common/local_discovery/service_discovery_client_unittest.cc index ed6db5c..0b77410 100644 --- a/chrome/common/local_discovery/service_discovery_client_unittest.cc +++ b/chrome/common/local_discovery/service_discovery_client_unittest.cc @@ -223,9 +223,7 @@ class ServiceDiscoveryTest : public ::testing::Test { callback.Cancel(); } - void Stop() { - base::MessageLoop::current()->Quit(); - } + void Stop() { base::MessageLoop::current()->QuitWhenIdle(); } net::MockMDnsSocketFactory socket_factory_; net::MDnsClientImpl mdns_client_; diff --git a/chrome/common/mac/mock_launchd.cc b/chrome/common/mac/mock_launchd.cc index b4e80ec..3af8aef 100644 --- a/chrome/common/mac/mock_launchd.cc +++ b/chrome/common/mac/mock_launchd.cc @@ -226,7 +226,7 @@ CFDictionaryRef MockLaunchd::CopyDictionaryByCheckingIn(CFErrorRef* error) { bool MockLaunchd::RemoveJob(CFStringRef label, CFErrorRef* error) { remove_called_ = true; - message_loop_->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); + message_loop_->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); return true; } @@ -235,7 +235,7 @@ bool MockLaunchd::RestartJob(Domain domain, CFStringRef name, CFStringRef session_type) { restart_called_ = true; - message_loop_->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); + message_loop_->PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); return true; } diff --git a/chrome/common/service_process_util_unittest.cc b/chrome/common/service_process_util_unittest.cc index 8844f91..1ed68ef 100644 --- a/chrome/common/service_process_util_unittest.cc +++ b/chrome/common/service_process_util_unittest.cc @@ -54,7 +54,8 @@ void ShutdownTask(base::MessageLoop* loop) { // Quit the main message loop. ASSERT_FALSE(g_good_shutdown); g_good_shutdown = true; - loop->task_runner()->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); + loop->task_runner()->PostTask(FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); } } // namespace @@ -235,7 +236,7 @@ MULTIPROCESS_TEST_MAIN(ServiceProcessStateTestShutdown) { io_thread_.task_runner().get(), base::Bind(&ShutdownTask, base::MessageLoop::current()))); message_loop.task_runner()->PostDelayedTask( - FROM_HERE, base::MessageLoop::QuitClosure(), + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), TestTimeouts::action_max_timeout()); EXPECT_FALSE(g_good_shutdown); message_loop.Run(); @@ -279,8 +280,7 @@ class ServiceProcessStateFileManipulationTest : public ::testing::Test { ASSERT_TRUE(service_process_state_.Initialize()); ASSERT_TRUE(service_process_state_.SignalReady( io_thread_.task_runner().get(), base::Closure())); - loop_.PostDelayedTask(FROM_HERE, - base::MessageLoop::QuitClosure(), + loop_.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), TestTimeouts::action_max_timeout()); } diff --git a/chrome/common/worker_thread_ticker_unittest.cc b/chrome/common/worker_thread_ticker_unittest.cc index dbb2e01..5722030 100644 --- a/chrome/common/worker_thread_ticker_unittest.cc +++ b/chrome/common/worker_thread_ticker_unittest.cc @@ -21,8 +21,8 @@ class TestCallback : public WorkerThreadTicker::Callback { counter_++; // Finish the test faster. - message_loop_->task_runner()->PostTask(FROM_HERE, - base::MessageLoop::QuitClosure()); + message_loop_->task_runner()->PostTask( + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); } int counter() const { return counter_; } @@ -41,7 +41,7 @@ class LongCallback : public WorkerThreadTicker::Callback { void RunMessageLoopForAWhile() { base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, base::MessageLoop::QuitClosure(), + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), base::TimeDelta::FromMilliseconds(500)); base::MessageLoop::current()->Run(); } diff --git a/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc b/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc index 7896758..b5a9979 100644 --- a/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc +++ b/chrome/renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc @@ -121,12 +121,12 @@ class PhishingTermFeatureExtractorTest : public ::testing::Test { // Completion callback for feature extraction. void ExtractionDone(bool success) { success_ = success; - msg_loop_.Quit(); + msg_loop_.QuitWhenIdle(); } void QuitExtraction() { extractor_->CancelPendingExtraction(); - msg_loop_.Quit(); + msg_loop_.QuitWhenIdle(); } base::MessageLoop msg_loop_; diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc index 7d7c657..6bc7b37 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc +++ b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc @@ -255,7 +255,8 @@ CloudPrintURLFetcherBasicTest::HandleRawResponse( if (handle_raw_response_) { // If the current message loop is not the IO loop, it will be shut down when // the main loop returns and this thread subsequently goes out of scope. - io_task_runner()->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); + io_task_runner()->PostTask(FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); return CloudPrintURLFetcher::STOP_PROCESSING; } return CloudPrintURLFetcher::CONTINUE_PROCESSING; @@ -269,7 +270,8 @@ CloudPrintURLFetcherBasicTest::HandleRawData( // We should never get here if we returned true in HandleRawResponse EXPECT_FALSE(handle_raw_response_); if (handle_raw_data_) { - io_task_runner()->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); + io_task_runner()->PostTask(FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); return CloudPrintURLFetcher::STOP_PROCESSING; } return CloudPrintURLFetcher::CONTINUE_PROCESSING; @@ -284,7 +286,8 @@ CloudPrintURLFetcherBasicTest::HandleJSONData( // We should never get here if we returned true in one of the above methods. EXPECT_FALSE(handle_raw_response_); EXPECT_FALSE(handle_raw_data_); - io_task_runner()->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); + io_task_runner()->PostTask(FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); return CloudPrintURLFetcher::STOP_PROCESSING; } @@ -302,7 +305,8 @@ CloudPrintURLFetcherOverloadTest::HandleRawData( // We have already sent 20 requests continuously. And we expect that // it takes more than 1 second due to the overload protection settings. EXPECT_TRUE(Time::Now() - start_time_ >= one_second); - io_task_runner()->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); + io_task_runner()->PostTask(FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); } return CloudPrintURLFetcher::STOP_PROCESSING; } @@ -321,7 +325,8 @@ CloudPrintURLFetcherRetryBackoffTest::HandleRawData( void CloudPrintURLFetcherRetryBackoffTest::OnRequestGiveUp() { // It takes more than 200 ms to finish all 11 requests. EXPECT_TRUE(Time::Now() - start_time_ >= TimeDelta::FromMilliseconds(200)); - io_task_runner()->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); + io_task_runner()->PostTask(FROM_HERE, + base::MessageLoop::QuitWhenIdleClosure()); } TEST_F(CloudPrintURLFetcherBasicTest, HandleRawResponse) { diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index 0725a54..b2d99dd 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc @@ -264,8 +264,8 @@ void ServiceProcess::Shutdown() { } void ServiceProcess::Terminate() { - main_message_loop_->task_runner()->PostTask(FROM_HERE, - base::MessageLoop::QuitClosure()); + main_message_loop_->task_runner()->PostTask( + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); } void ServiceProcess::OnShutdown() { diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc index b184e31..97c46ec 100644 --- a/chrome/test/base/browser_with_test_window_test.cc +++ b/chrome/test/base/browser_with_test_window_test.cc @@ -105,7 +105,7 @@ void BrowserWithTestWindowTest::TearDown() { // A Task is leaked if we don't destroy everything, then run the message // loop. base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); base::MessageLoop::current()->Run(); } diff --git a/chrome/test/base/in_process_browser_test.h b/chrome/test/base/in_process_browser_test.h index 9192ec2..06c0b61 100644 --- a/chrome/test/base/in_process_browser_test.h +++ b/chrome/test/base/in_process_browser_test.h @@ -51,8 +51,8 @@ class ContentRendererClient; // state changes you'll need to run the message loop from your test method. // For example, if you need to wait till a find bar has completely been shown // you'll need to invoke content::RunMessageLoop. When the message bar is -// shown, invoke MessageLoop::current()->Quit() to return control back to your -// test method. +// shown, invoke MessageLoop::current()->QuitWhenIdle() to return control back +// to your test method. // . If you subclass and override SetUp, be sure and invoke // InProcessBrowserTest::SetUp. (But see also SetUpOnMainThread, // SetUpInProcessBrowserTestFixture and other related hook methods for a diff --git a/chrome/test/base/interactive_test_utils_mac.mm b/chrome/test/base/interactive_test_utils_mac.mm index 17fa8e8..c1c3b10 100644 --- a/chrome/test/base/interactive_test_utils_mac.mm +++ b/chrome/test/base/interactive_test_utils_mac.mm @@ -83,7 +83,7 @@ void ClickOnView(const Browser* browser, ViewID vid) { view, ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP, - base::MessageLoop::QuitClosure()); + base::MessageLoop::QuitWhenIdleClosure()); content::RunMessageLoop(); } diff --git a/chrome/test/base/interactive_test_utils_views.cc b/chrome/test/base/interactive_test_utils_views.cc index ac5047f..584ffb8 100644 --- a/chrome/test/base/interactive_test_utils_views.cc +++ b/chrome/test/base/interactive_test_utils_views.cc @@ -36,10 +36,9 @@ void ClickOnView(const Browser* browser, ViewID vid) { views::View* view = BrowserView::GetBrowserViewForBrowser(browser)->GetViewByID(vid); DCHECK(view); - MoveMouseToCenterAndPress(view, - ui_controls::LEFT, + MoveMouseToCenterAndPress(view, ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP, - base::MessageLoop::QuitClosure()); + base::MessageLoop::QuitWhenIdleClosure()); content::RunMessageLoop(); } diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index f196614..2bef2be 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -141,7 +141,9 @@ class QuittingHistoryDBTask : public history::HistoryDBTask { return true; } - void DoneRunOnMainThread() override { base::MessageLoop::current()->Quit(); } + void DoneRunOnMainThread() override { + base::MessageLoop::current()->QuitWhenIdle(); + } private: ~QuittingHistoryDBTask() override {} @@ -560,7 +562,8 @@ void TestingProfile::DestroyHistoryService() { return; history_service->ClearCachedDataForContextID(0); - history_service->SetOnBackendDestroyTask(base::MessageLoop::QuitClosure()); + history_service->SetOnBackendDestroyTask( + base::MessageLoop::QuitWhenIdleClosure()); history_service->Cleanup(); HistoryServiceFactory::ShutdownForProfile(this); @@ -573,7 +576,7 @@ void TestingProfile::DestroyHistoryService() { // Make sure we don't have any event pending that could disrupt the next // test. base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::MessageLoop::QuitClosure()); + FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); base::MessageLoop::current()->Run(); } diff --git a/chrome/test/chromedriver/net/websocket_unittest.cc b/chrome/test/chromedriver/net/websocket_unittest.cc index 2922c7f..4405939 100644 --- a/chrome/test/chromedriver/net/websocket_unittest.cc +++ b/chrome/test/chromedriver/net/websocket_unittest.cc @@ -46,7 +46,7 @@ class Listener : public WebSocketListener { EXPECT_EQ(messages_[0], message); messages_.erase(messages_.begin()); if (messages_.empty()) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void OnClose() override { EXPECT_TRUE(false); } diff --git a/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc b/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc index a1b1c04..445f9df 100644 --- a/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc +++ b/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc @@ -78,14 +78,14 @@ class FFDecryptorServerChannelListener : public IPC::Listener { DCHECK(!got_result); result_bool = result; got_result = true; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void OnDecryptedTextResponse(const base::string16& decrypted_text) { DCHECK(!got_result); result_string = decrypted_text; got_result = true; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void OnParseSignonsResponse( @@ -93,7 +93,7 @@ class FFDecryptorServerChannelListener : public IPC::Listener { DCHECK(!got_result); result_vector = parsed_vector; got_result = true; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } void QuitClient() { @@ -115,7 +115,7 @@ class FFDecryptorServerChannelListener : public IPC::Listener { // If an error occured, just kill the message Loop. void OnChannelError() override { got_result = false; - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } // Results of IPC calls. @@ -164,7 +164,7 @@ class CancellableQuitMsgLoop : public base::RefCounted<CancellableQuitMsgLoop> { CancellableQuitMsgLoop() : cancelled_(false) {} void QuitNow() { if (!cancelled_) - base::MessageLoop::current()->Quit(); + base::MessageLoop::current()->QuitWhenIdle(); } bool cancelled_; @@ -256,9 +256,7 @@ class FFDecryptorClientChannelListener : public IPC::Listener { sender_->Send(new Msg_ParseSignons_Response(forms)); } - void OnQuitRequest() { - base::MessageLoop::current()->Quit(); - } + void OnQuitRequest() { base::MessageLoop::current()->QuitWhenIdle(); } bool OnMessageReceived(const IPC::Message& msg) override { bool handled = true; @@ -272,7 +270,9 @@ class FFDecryptorClientChannelListener : public IPC::Listener { return handled; } - void OnChannelError() override { base::MessageLoop::current()->Quit(); } + void OnChannelError() override { + base::MessageLoop::current()->QuitWhenIdle(); + } private: NSSDecryptor decryptor_; |