Commit 0259835b authored by skyostil's avatar skyostil Committed by Commit bot

chrome/browser: Remove use of MessageLoopProxy and deprecated MessageLoop APIs

This patch was mostly autogenerated with https://codereview.chromium.org/1010073002/.

BUG=465354

Review URL: https://codereview.chromium.org/1143343005

Cr-Commit-Position: refs/heads/master@{#334147}
parent 380bb222
......@@ -9,9 +9,9 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/run_loop.h"
#include "base/task_runner_util.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/thread.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
......
......@@ -26,8 +26,8 @@ class ContextualSearchDelegateTest : public testing::Test {
protected:
void SetUp() override {
request_context_ = new net::TestURLRequestContextGetter(
io_message_loop_.message_loop_proxy());
request_context_ =
new net::TestURLRequestContextGetter(io_message_loop_.task_runner());
template_url_service_.reset(CreateTemplateURLService());
delegate_.reset(new ContextualSearchDelegate(
request_context_.get(), template_url_service_.get(),
......
......@@ -7,7 +7,6 @@
#include <stdio.h>
#include <sys/utsname.h>
#include "base/message_loop/message_loop_proxy.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "content/public/browser/browser_thread.h"
......
......@@ -12,10 +12,10 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/prefs/pref_service.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browsing_data/browsing_data_helper.h"
......
......@@ -65,10 +65,8 @@ TestShimClient::TestShimClient() : io_thread_("TestShimClientIO") {
app_mode::VerifySocketPermissions(socket_path);
IPC::ChannelHandle handle(socket_path.value());
channel_ = IPC::ChannelProxy::Create(handle,
IPC::Channel::MODE_NAMED_CLIENT,
this,
io_thread_.message_loop_proxy().get());
channel_ = IPC::ChannelProxy::Create(handle, IPC::Channel::MODE_NAMED_CLIENT,
this, io_thread_.task_runner().get());
}
TestShimClient::~TestShimClient() {}
......
......@@ -8,9 +8,11 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/apps/drive/drive_app_converter.h"
#include "chrome/browser/apps/drive/drive_app_mapping.h"
#include "chrome/browser/apps/drive/drive_app_uninstall_sync_service.h"
......@@ -74,10 +76,9 @@ void DriveAppProvider::AddUninstalledDriveAppFromSync(
// Decouple the operation because this function could be called during
// sync processing and UpdateDriveApps could trigger another sync change.
// See http://crbug.com/429205
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&DriveAppProvider::UpdateDriveApps,
weak_ptr_factory_.GetWeakPtr()));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&DriveAppProvider::UpdateDriveApps,
weak_ptr_factory_.GetWeakPtr()));
}
void DriveAppProvider::RemoveUninstalledDriveAppFromSync(
......@@ -87,10 +88,9 @@ void DriveAppProvider::RemoveUninstalledDriveAppFromSync(
// Decouple the operation because this function could be called during
// sync processing and UpdateDriveApps could trigger another sync change.
// See http://crbug.com/429205
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&DriveAppProvider::UpdateDriveApps,
weak_ptr_factory_.GetWeakPtr()));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&DriveAppProvider::UpdateDriveApps,
weak_ptr_factory_.GetWeakPtr()));
}
void DriveAppProvider::UpdateMappingAndExtensionSystem(
......@@ -299,11 +299,10 @@ void DriveAppProvider::OnExtensionInstalled(
// Defer the processing because it touches the extensions system and
// it is better to let the current task finish to avoid unexpected
// incomplete status.
base::MessageLoop::current()->PostTask(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&DriveAppProvider::ProcessDeferredOnExtensionInstalled,
weak_ptr_factory_.GetWeakPtr(),
drive_apps_[i].app_id,
weak_ptr_factory_.GetWeakPtr(), drive_apps_[i].app_id,
extension->id()));
return;
}
......
......@@ -6,7 +6,9 @@
#include "apps/app_lifetime_monitor_factory.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/apps/ephemeral_app_service_factory.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_util.h"
......@@ -148,11 +150,9 @@ void EphemeralAppService::OnAppStop(Profile* profile,
if (!extensions::util::IsEphemeralApp(app_id, profile_))
return;
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&EphemeralAppService::DisableEphemeralApp,
weak_ptr_factory_.GetWeakPtr(),
app_id),
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, base::Bind(&EphemeralAppService::DisableEphemeralApp,
weak_ptr_factory_.GetWeakPtr(), app_id),
base::TimeDelta::FromSeconds(disable_idle_app_delay_));
}
......@@ -178,10 +178,9 @@ void EphemeralAppService::Init() {
TriggerGarbageCollect(
base::TimeDelta::FromSeconds(kGarbageCollectAppsStartupDelay));
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&EphemeralAppService::DisableEphemeralAppsOnStartup,
weak_ptr_factory_.GetWeakPtr()),
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, base::Bind(&EphemeralAppService::DisableEphemeralAppsOnStartup,
weak_ptr_factory_.GetWeakPtr()),
base::TimeDelta::FromSeconds(kDisableAppsOnStartupDelay));
}
......
......@@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/location.h"
#include "base/path_service.h"
#include "base/process/process.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/apps/app_browsertest_util.h"
#include "chrome/browser/chrome_content_browser_client.h"
......@@ -147,7 +150,7 @@ class ContextMenuCallCountObserver {
const content::NotificationDetails& details) {
++num_times_shown_;
auto context_menu = content::Source<RenderViewContextMenu>(source).ptr();
base::MessageLoop::current()->PostTask(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&RenderViewContextMenuBase::Cancel,
base::Unretained(context_menu)));
return true;
......@@ -1940,7 +1943,7 @@ static bool ContextMenuNotificationCallback(
const content::NotificationSource& source,
const content::NotificationDetails& details) {
auto context_menu = content::Source<RenderViewContextMenu>(source).ptr();
base::MessageLoop::current()->PostTask(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&RenderViewContextMenuBase::Cancel,
base::Unretained(context_menu)));
return true;
......
......@@ -2,8 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/apps/app_browsertest_util.h"
#include "chrome/browser/chrome_content_browser_client.h"
......@@ -341,7 +344,7 @@ class WebViewInteractiveTest
private:
void ScheduleWait() {
base::MessageLoop::current()->PostDelayedTask(
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::Bind(&PopupCreatedObserver::Wait, base::Unretained(this)),
base::TimeDelta::FromMilliseconds(200));
......@@ -421,10 +424,9 @@ class WebViewInteractiveTest
MoveMouseInsideWindow(gfx::Point(78, 12));
// Now wait a bit before moving mouse to initiate drag/drop.
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&WebViewInteractiveTest::DragTestStep2,
base::Unretained(this)),
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, base::Bind(&WebViewInteractiveTest::DragTestStep2,
base::Unretained(this)),
base::TimeDelta::FromMilliseconds(200));
}
......
......@@ -6,11 +6,14 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/location.h"
#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/autocomplete/autocomplete_controller.h"
#include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
#include "chrome/browser/chrome_notification_types.h"
......@@ -109,7 +112,7 @@ void TestProvider::Start(const AutocompleteInput& input,
if (input.want_asynchronous_matches()) {
done_ = false;
base::MessageLoop::current()->PostTask(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&TestProvider::Run, this));
}
}
......
......@@ -9,9 +9,11 @@
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/location.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
......@@ -667,8 +669,8 @@ void HistoryURLProvider::ExecuteWithDB(HistoryURLProviderParams* params,
}
// Return the results (if any) to the main thread.
params->message_loop->PostTask(FROM_HERE, base::Bind(
&HistoryURLProvider::QueryComplete, this, params));
params->message_loop->task_runner()->PostTask(
FROM_HERE, base::Bind(&HistoryURLProvider::QueryComplete, this, params));
}
HistoryURLProvider::~HistoryURLProvider() {
......
......@@ -9,12 +9,15 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/location.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram_macros.h"
#include "base/prefs/pref_service.h"
#include "base/prefs/scoped_user_pref_update.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/background/background_contents_service_factory.h"
......@@ -87,11 +90,9 @@ void CloseBalloon(const std::string& balloon_id, ProfileID profile_id) {
void ScheduleCloseBalloon(const std::string& extension_id, Profile* profile) {
if (g_disable_close_balloon_for_testing)
return;
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&CloseBalloon,
kNotificationPrefix + extension_id,
NotificationUIManager::GetProfileID(profile)));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&CloseBalloon, kNotificationPrefix + extension_id,
NotificationUIManager::GetProfileID(profile)));
}
// Delegate for the app/extension crash notification balloon. Restarts the
......
......@@ -11,11 +11,14 @@
#include "base/base_paths.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
#include "base/prefs/pref_registry_simple.h"
#include "base/prefs/pref_service.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/background/background_application_list_model.h"
#include "chrome/browser/browser_process.h"
......@@ -623,7 +626,7 @@ void BackgroundModeManager::DecrementKeepAliveCountForStartup() {
// We call this via the message queue to make sure we don't try to end
// keep-alive (which can shutdown Chrome) before the message loop has
// started.
base::MessageLoop::current()->PostTask(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&chrome::DecrementKeepAliveCount));
}
}
......
......@@ -5,9 +5,11 @@
#include "chrome/browser/banners/app_banner_data_fetcher.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/location.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/banners/app_banner_data_fetcher_desktop.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
......@@ -34,13 +36,13 @@ class TestObserver : public AppBannerDataFetcher::Observer {
void OnDecidedWhetherToShow(AppBannerDataFetcher* fetcher,
bool will_show) override {
base::MessageLoop::current()->PostTask(FROM_HERE, quit_closure_);
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_closure_);
ASSERT_FALSE(will_show_.get());
will_show_.reset(new bool(will_show));
}
void OnFetcherDestroyed(AppBannerDataFetcher* fetcher) override {
base::MessageLoop::current()->PostTask(FROM_HERE, quit_closure_);
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_closure_);
fetcher_ = nullptr;
}
......@@ -66,7 +68,7 @@ class AppBannerDataFetcherBrowserTest : public InProcessBrowserTest,
bool HandleNonWebApp(const std::string& platform,
const GURL& url,
const std::string& id) override {
base::MessageLoop::current()->PostTask(FROM_HERE, quit_closure_);
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_closure_);
non_web_platform_ = platform;
return false;
}
......
......@@ -7,9 +7,11 @@
#include <string>
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_util.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/common/chrome_switches.h"
......@@ -106,12 +108,12 @@ bool HandleNonNavigationAboutURL(const GURL& url) {
if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIRestartURL)) {
// Call AttemptRestart after chrome::Navigate() completes to avoid access of
// gtk objects after they are destroyed by BrowserWindowGtk::Close().
base::MessageLoop::current()->PostTask(FROM_HERE,
base::Bind(&chrome::AttemptRestart));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&chrome::AttemptRestart));
return true;
} else if (base::LowerCaseEqualsASCII(spec, chrome::kChromeUIQuitURL)) {
base::MessageLoop::current()->PostTask(FROM_HERE,
base::Bind(&chrome::AttemptExit));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&chrome::AttemptExit));
return true;
}
......
......@@ -5,9 +5,11 @@
#include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h"
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "content/public/browser/browser_thread.h"
#include "net/ssl/channel_id_service.h"
#include "net/url_request/url_request_context.h"
......@@ -192,10 +194,9 @@ void CannedBrowsingDataChannelIDHelper::StartFetching(
return;
// We post a task to emulate async fetching behavior.
completion_callback_ = callback;
base::MessageLoop::current()->PostTask(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&CannedBrowsingDataChannelIDHelper::FinishFetching,
this));
base::Bind(&CannedBrowsingDataChannelIDHelper::FinishFetching, this));
}
void CannedBrowsingDataChannelIDHelper::FinishFetching() {
......
......@@ -8,7 +8,7 @@
#include "base/files/scoped_temp_dir.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/browsing_data/browsing_data_quota_helper_impl.h"
#include "content/public/test/mock_storage_client.h"
#include "content/public/test/test_browser_thread.h"
......
......@@ -6,8 +6,8 @@
#include <vector>
#include "base/message_loop/message_loop_proxy.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
......
......@@ -11,11 +11,13 @@
#include "base/cpu.h"
#include "base/files/file.h"
#include "base/json/json_writer.h"
#include "base/location.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/stringprintf.h"
#include "base/sys_info.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "base/values.h"
......@@ -74,9 +76,8 @@ class TaskManagerDataDumper :
// Some data (for example V8 memory) has not yet arrived, so we wait.
// TODO(cpu): Figure out how to make this reliable.
static base::TimeDelta delay = base::TimeDelta::FromMilliseconds(250);
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&TaskManagerDataDumper::OnDataReadyDelayed, this),
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, base::Bind(&TaskManagerDataDumper::OnDataReadyDelayed, this),
delay);
}
......
......@@ -6,7 +6,9 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/message_loop/message_loop.h"
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/captive_portal/captive_portal_service.h"
#include "chrome/browser/captive_portal/captive_portal_service_factory.h"
#include "content/public/browser/interstitial_page.h"
......@@ -100,10 +102,9 @@ void CaptivePortalTabReloader::OnLoadCommitted(int net_error) {
// If the tab needs to reload, do so asynchronously, to avoid reentrancy
// issues.
if (state_ == STATE_NEEDS_RELOAD) {
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&CaptivePortalTabReloader::ReloadTabIfNeeded,
weak_factory_.GetWeakPtr()));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&CaptivePortalTabReloader::ReloadTabIfNeeded,
weak_factory_.GetWeakPtr()));
}
}
......
......@@ -6,7 +6,9 @@
#include "base/bind.h"
#include "base/debug/debugger.h"
#include "base/message_loop/message_loop.h"
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/common/chrome_result_codes.h"
#include "content/public/browser/browser_thread.h"
......@@ -26,9 +28,8 @@ const int kWaitForUIThreadSeconds = 10;
int BrowserX11ErrorHandler(Display* d, XErrorEvent* error) {
if (!g_in_x11_io_error_handler)
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&ui::LogErrorEventDescription, d, *error));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&ui::LogErrorEventDescription, d, *error));
return 0;
}
......
......@@ -9,6 +9,9 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/common/chrome_utility_messages.h"
#include "chrome/grit/generated_resources.h"
#include "components/component_updater/component_updater_service.h"
......@@ -55,7 +58,7 @@ void PatchHost::StartProcess(scoped_ptr<IPC::Message> message) {
// The DeltaUpdateOpPatchHost is not responsible for deleting the
// UtilityProcessHost object.
content::UtilityProcessHost* host = content::UtilityProcessHost::Create(
this, base::MessageLoopProxy::current().get());
this, base::ThreadTaskRunnerHandle::Get().get());
host->SetName(l10n_util::GetStringUTF16(
IDS_UTILITY_PROCESS_COMPONENT_PATCHER_NAME));
host->DisableSandbox();
......
......@@ -4,10 +4,13 @@
#include "chrome/browser/devtools/device/adb/mock_adb_server.h"
#include "base/location.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/non_thread_safe.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/browser_test.h"
......@@ -314,9 +317,8 @@ void SimpleHttpServer::Connection::OnDataRead(int count) {
}
} while (bytes_processed);
// Posting to avoid deep recursion in case of synchronous IO
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&Connection::ReadData, weak_factory_.GetWeakPtr()));
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&Connection::ReadData, weak_factory_.GetWeakPtr()));
}
void SimpleHttpServer::Connection::WriteData() {
......@@ -348,7 +350,7 @@ void SimpleHttpServer::Connection::OnDataWritten(int count) {
if (bytes_to_write_ != 0)
// Posting to avoid deep recursion in case of synchronous IO
base::MessageLoop::current()->PostTask(
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&Connection::WriteData, weak_factory_.GetWeakPtr()));
else if (read_closed_)
......@@ -362,11 +364,9 @@ void SimpleHttpServer::AcceptConnection() {
base::Bind(&SimpleHttpServer::OnAccepted, base::Unretained(this)));
if (accept_result != net::ERR_IO_PENDING)
base::MessageLoop::current()->PostTask(
FROM_HERE,