diff options
author | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 20:51:34 +0000 |
---|---|---|
committer | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 20:51:34 +0000 |
commit | 2da659e6279cf515940eb8a091e09e27281a97d6 (patch) | |
tree | a34e2eeea8194a16603e24149ae634cb54ddab62 /net/proxy | |
parent | 954f56f3aceed29573f841648168b91c1fd43074 (diff) | |
download | chromium_src-2da659e6279cf515940eb8a091e09e27281a97d6.zip chromium_src-2da659e6279cf515940eb8a091e09e27281a97d6.tar.gz chromium_src-2da659e6279cf515940eb8a091e09e27281a97d6.tar.bz2 |
net: Use base::MessageLoop.
BUG=236029
R=agl@chromium.org
Review URL: https://chromiumcodereview.appspot.com/14021017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201882 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r-- | net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc | 8 | ||||
-rw-r--r-- | net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc | 12 | ||||
-rw-r--r-- | net/proxy/mock_proxy_resolver.cc | 31 | ||||
-rw-r--r-- | net/proxy/mock_proxy_script_fetcher.cc | 4 | ||||
-rw-r--r-- | net/proxy/multi_threaded_proxy_resolver_unittest.cc | 10 | ||||
-rw-r--r-- | net/proxy/network_delegate_error_observer_unittest.cc | 4 | ||||
-rw-r--r-- | net/proxy/proxy_config_service_android_unittest.cc | 13 | ||||
-rw-r--r-- | net/proxy/proxy_config_service_linux.cc | 25 | ||||
-rw-r--r-- | net/proxy/proxy_config_service_linux_unittest.cc | 15 | ||||
-rw-r--r-- | net/proxy/proxy_resolver_v8_tracing.cc | 4 | ||||
-rw-r--r-- | net/proxy/proxy_resolver_v8_tracing_unittest.cc | 6 | ||||
-rw-r--r-- | net/proxy/proxy_script_decider_unittest.cc | 4 | ||||
-rw-r--r-- | net/proxy/proxy_script_fetcher_impl.cc | 5 | ||||
-rw-r--r-- | net/proxy/proxy_service.cc | 39 | ||||
-rw-r--r-- | net/proxy/proxy_service_unittest.cc | 12 |
15 files changed, 98 insertions, 94 deletions
diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc index 8c81cce..a8240c8 100644 --- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc +++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc @@ -146,7 +146,7 @@ class FetcherClient { void FinishTestAllowCleanup() { fetcher_->FinishTest(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } TestCompletionCallback callback_; @@ -203,7 +203,7 @@ TEST(DhcpProxyScriptAdapterFetcher, CancelWhileDhcp) { FetcherClient client; client.RunTest(); client.fetcher_->Cancel(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_FALSE(client.fetcher_->DidFinish()); ASSERT_TRUE(client.fetcher_->WasCancelled()); EXPECT_EQ(ERR_ABORTED, client.fetcher_->GetResult()); @@ -221,10 +221,10 @@ TEST(DhcpProxyScriptAdapterFetcher, CancelWhileFetcher) { int max_loops = 4; while (!client.fetcher_->IsWaitingForFetcher() && max_loops--) { base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(10)); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } client.fetcher_->Cancel(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_FALSE(client.fetcher_->DidFinish()); ASSERT_TRUE(client.fetcher_->WasCancelled()); EXPECT_EQ(ERR_ABORTED, client.fetcher_->GetResult()); diff --git a/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc b/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc index 6e54559..d5b68c8 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc +++ b/net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc @@ -99,9 +99,9 @@ class RealFetchTester { void WaitUntilDone() { while (!finished_) { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } // Attempts to give worker threads time to finish. This is currently @@ -145,7 +145,7 @@ TEST(DhcpProxyScriptFetcherWin, RealFetchWithCancel) { // exercises the code without stubbing out dependencies. RealFetchTester fetcher; fetcher.RunTestWithCancel(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Attempt to avoid Valgrind leak reports in case worker thread is // still running. @@ -389,16 +389,16 @@ public: void RunMessageLoopUntilComplete() { while (!finished_) { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } void RunMessageLoopUntilWorkerDone() { DCHECK(fetcher_.adapter_query_.get()); while (!fetcher_.worker_finished_event_.TimedWait( base::TimeDelta::FromMilliseconds(10))) { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } } diff --git a/net/proxy/mock_proxy_resolver.cc b/net/proxy/mock_proxy_resolver.cc index c50f7d4..6878d24 100644 --- a/net/proxy/mock_proxy_resolver.cc +++ b/net/proxy/mock_proxy_resolver.cc @@ -10,14 +10,15 @@ namespace net { MockAsyncProxyResolverBase::Request::Request( - MockAsyncProxyResolverBase* resolver, const GURL& url, ProxyInfo* results, + MockAsyncProxyResolverBase* resolver, + const GURL& url, + ProxyInfo* results, const CompletionCallback& callback) - : resolver_(resolver), - url_(url), - results_(results), - callback_(callback), - origin_loop_(MessageLoop::current()) { - } + : resolver_(resolver), + url_(url), + results_(results), + callback_(callback), + origin_loop_(base::MessageLoop::current()) {} void MockAsyncProxyResolverBase::Request::CompleteNow(int rv) { CompletionCallback callback = callback_; @@ -30,16 +31,14 @@ MockAsyncProxyResolverBase::Request::Request( MockAsyncProxyResolverBase::Request::~Request() {} - MockAsyncProxyResolverBase::SetPacScriptRequest::SetPacScriptRequest( - MockAsyncProxyResolverBase* resolver, - const scoped_refptr<ProxyResolverScriptData>& script_data, - const CompletionCallback& callback) - : resolver_(resolver), - script_data_(script_data), - callback_(callback), - origin_loop_(MessageLoop::current()) { - } + MockAsyncProxyResolverBase* resolver, + const scoped_refptr<ProxyResolverScriptData>& script_data, + const CompletionCallback& callback) + : resolver_(resolver), + script_data_(script_data), + callback_(callback), + origin_loop_(base::MessageLoop::current()) {} MockAsyncProxyResolverBase::SetPacScriptRequest::~SetPacScriptRequest() {} diff --git a/net/proxy/mock_proxy_script_fetcher.cc b/net/proxy/mock_proxy_script_fetcher.cc index de4245b..ef1ff83 100644 --- a/net/proxy/mock_proxy_script_fetcher.cc +++ b/net/proxy/mock_proxy_script_fetcher.cc @@ -30,7 +30,7 @@ int MockProxyScriptFetcher::Fetch(const GURL& url, base::string16* text, pending_request_text_ = text; if (waiting_for_fetch_) - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); return ERR_IO_PENDING; } @@ -62,7 +62,7 @@ bool MockProxyScriptFetcher::has_pending_request() const { void MockProxyScriptFetcher::WaitUntilFetch() { DCHECK(!has_pending_request()); waiting_for_fetch_ = true; - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); waiting_for_fetch_ = false; } diff --git a/net/proxy/multi_threaded_proxy_resolver_unittest.cc b/net/proxy/multi_threaded_proxy_resolver_unittest.cc index 2eb42be..21ae9bc 100644 --- a/net/proxy/multi_threaded_proxy_resolver_unittest.cc +++ b/net/proxy/multi_threaded_proxy_resolver_unittest.cc @@ -30,7 +30,7 @@ class MockProxyResolver : public ProxyResolver { public: MockProxyResolver() : ProxyResolver(true /*expects_pac_bytes*/), - wrong_loop_(MessageLoop::current()), + wrong_loop_(base::MessageLoop::current()), request_count_(0), purge_count_(0) {} @@ -100,10 +100,10 @@ class MockProxyResolver : public ProxyResolver { // message loop of MultiThreadedProxyResolver's worker thread, we do // know that it is going to be distinct from the loop running the // test, so at least make sure it isn't the main loop. - EXPECT_NE(MessageLoop::current(), wrong_loop_); + EXPECT_NE(base::MessageLoop::current(), wrong_loop_); } - MessageLoop* wrong_loop_; + base::MessageLoop* wrong_loop_; int request_count_; int purge_count_; scoped_refptr<ProxyResolverScriptData> last_script_data_; @@ -561,7 +561,7 @@ TEST(MultiThreadedProxyResolverTest, SingleThread_CancelRequestByDeleting) { resolver.reset(); // Give any posted tasks a chance to run (in case there is badness). - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Check that none of the outstanding requests were completed. EXPECT_FALSE(callback0.have_result()); @@ -645,7 +645,7 @@ TEST(MultiThreadedProxyResolverTest, ThreeThreads_Basic) { ASSERT_EQ(1u, factory->resolvers().size()); EXPECT_EQ(1, factory->resolvers()[0]->request_count()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // We now start 8 requests in parallel -- this will cause the maximum of // three threads to be provisioned (an additional two from what we already diff --git a/net/proxy/network_delegate_error_observer_unittest.cc b/net/proxy/network_delegate_error_observer_unittest.cc index 2517291..a786a4c 100644 --- a/net/proxy/network_delegate_error_observer_unittest.cc +++ b/net/proxy/network_delegate_error_observer_unittest.cc @@ -107,7 +107,7 @@ TEST(NetworkDelegateErrorObserverTest, CallOnThread) { base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, base::Unretained(&observer), 42, base::string16())); thread.Stop(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_TRUE(network_delegate.got_pac_error()); } @@ -122,7 +122,7 @@ TEST(NetworkDelegateErrorObserverTest, NoDelegate) { base::Bind(&NetworkDelegateErrorObserver::OnPACScriptError, base::Unretained(&observer), 42, base::string16())); thread.Stop(); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Shouldn't have crashed until here... } diff --git a/net/proxy/proxy_config_service_android_unittest.cc b/net/proxy/proxy_config_service_android_unittest.cc index faa9fd1..cb8fa7a 100644 --- a/net/proxy/proxy_config_service_android_unittest.cc +++ b/net/proxy/proxy_config_service_android_unittest.cc @@ -53,12 +53,11 @@ class ProxyConfigServiceAndroidTestBase : public testing::Test { // suite (see net/test/net_test_suite.cc). ProxyConfigServiceAndroidTestBase(const StringMap& initial_configuration) : configuration_(initial_configuration), - message_loop_(MessageLoop::current()), - service_( - message_loop_->message_loop_proxy(), - message_loop_->message_loop_proxy(), - base::Bind(&ProxyConfigServiceAndroidTestBase::GetProperty, - base::Unretained(this))) {} + message_loop_(base::MessageLoop::current()), + service_(message_loop_->message_loop_proxy(), + message_loop_->message_loop_proxy(), + base::Bind(&ProxyConfigServiceAndroidTestBase::GetProperty, + base::Unretained(this))) {} virtual ~ProxyConfigServiceAndroidTestBase() {} @@ -104,7 +103,7 @@ class ProxyConfigServiceAndroidTestBase : public testing::Test { StringMap configuration_; TestObserver observer_; - MessageLoop* const message_loop_; + base::MessageLoop* const message_loop_; ProxyConfigServiceAndroid service_; }; diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc index b1dda52..b735a92 100644 --- a/net/proxy/proxy_config_service_linux.cc +++ b/net/proxy/proxy_config_service_linux.cc @@ -231,7 +231,7 @@ class SettingGetterImplGConf : public ProxyConfigServiceLinux::SettingGetter { } virtual bool Init(base::SingleThreadTaskRunner* glib_thread_task_runner, - MessageLoopForIO* file_loop) OVERRIDE { + base::MessageLoopForIO* file_loop) OVERRIDE { DCHECK(glib_thread_task_runner->BelongsToCurrentThread()); DCHECK(!client_); DCHECK(!task_runner_); @@ -559,7 +559,7 @@ class SettingGetterImplGSettings bool LoadAndCheckVersion(base::Environment* env); virtual bool Init(base::SingleThreadTaskRunner* glib_thread_task_runner, - MessageLoopForIO* file_loop) OVERRIDE { + base::MessageLoopForIO* file_loop) OVERRIDE { DCHECK(glib_thread_task_runner->BelongsToCurrentThread()); DCHECK(!client_); DCHECK(!task_runner_); @@ -917,7 +917,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, } virtual bool Init(base::SingleThreadTaskRunner* glib_thread_task_runner, - MessageLoopForIO* file_loop) OVERRIDE { + base::MessageLoopForIO* file_loop) OVERRIDE { // This has to be called on the UI thread (http://crbug.com/69057). base::ThreadRestrictions::ScopedAllowIO allow_io; DCHECK(inotify_fd_ < 0); @@ -952,7 +952,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, virtual bool SetUpNotifications( ProxyConfigServiceLinux::Delegate* delegate) OVERRIDE { DCHECK(inotify_fd_ >= 0); - DCHECK(MessageLoop::current() == file_loop_); + DCHECK(base::MessageLoop::current() == file_loop_); // We can't just watch the kioslaverc file directly, since KDE will write // a new copy of it and then rename it whenever settings are changed and // inotify watches inodes (so we'll be watching the old deleted file after @@ -962,8 +962,11 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, IN_MODIFY | IN_MOVED_TO) < 0) return false; notify_delegate_ = delegate; - if (!file_loop_->WatchFileDescriptor(inotify_fd_, true, - MessageLoopForIO::WATCH_READ, &inotify_watcher_, this)) + if (!file_loop_->WatchFileDescriptor(inotify_fd_, + true, + base::MessageLoopForIO::WATCH_READ, + &inotify_watcher_, + this)) return false; // Simulate a change to avoid possibly losing updates before this point. OnChangeNotification(); @@ -977,7 +980,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, // Implement base::MessagePumpLibevent::Watcher. virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE { DCHECK_EQ(fd, inotify_fd_); - DCHECK(MessageLoop::current() == file_loop_); + DCHECK(base::MessageLoop::current() == file_loop_); OnChangeNotification(); } virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE { @@ -1243,7 +1246,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, // This is the callback from the debounce timer. void OnDebouncedNotification() { - DCHECK(MessageLoop::current() == file_loop_); + DCHECK(base::MessageLoop::current() == file_loop_); VLOG(1) << "inotify change notification for kioslaverc"; UpdateCachedSettings(); CHECK(notify_delegate_); @@ -1256,7 +1259,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, // an event for kioslaverc is seen. void OnChangeNotification() { DCHECK_GE(inotify_fd_, 0); - DCHECK(MessageLoop::current() == file_loop_); + DCHECK(base::MessageLoop::current() == file_loop_); char event_buf[(sizeof(inotify_event) + NAME_MAX + 1) * 4]; bool kioslaverc_touched = false; ssize_t r; @@ -1329,7 +1332,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, // Message loop of the file thread, for reading kioslaverc. If NULL, // just read it directly (for testing). We also handle inotify events // on this thread. - MessageLoopForIO* file_loop_; + base::MessageLoopForIO* file_loop_; DISALLOW_COPY_AND_ASSIGN(SettingGetterImplKDE); }; @@ -1548,7 +1551,7 @@ ProxyConfigServiceLinux::Delegate::Delegate( void ProxyConfigServiceLinux::Delegate::SetUpAndFetchInitialConfig( base::SingleThreadTaskRunner* glib_thread_task_runner, base::SingleThreadTaskRunner* io_thread_task_runner, - MessageLoopForIO* file_loop) { + base::MessageLoopForIO* file_loop) { // We should be running on the default glib main loop thread right // now. gconf can only be accessed from this thread. DCHECK(glib_thread_task_runner->BelongsToCurrentThread()); diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc index 4e9409f..75c5cf1 100644 --- a/net/proxy/proxy_config_service_linux_unittest.cc +++ b/net/proxy/proxy_config_service_linux_unittest.cc @@ -176,7 +176,7 @@ class MockSettingGetter } virtual bool Init(base::SingleThreadTaskRunner* glib_thread_task_runner, - MessageLoopForIO* file_loop) OVERRIDE { + base::MessageLoopForIO* file_loop) OVERRIDE { return true; } @@ -265,7 +265,7 @@ class SynchConfigGetter { config_service_(config_service) { // Start an IO thread. base::Thread::Options options; - options.message_loop_type = MessageLoop::TYPE_IO; + options.message_loop_type = base::MessageLoop::TYPE_IO; io_thread_.StartWithOptions(options); // Make sure the thread started. @@ -288,12 +288,13 @@ class SynchConfigGetter { // all on the calling thread (meant to be the thread with the // default glib main loop, which is the UI thread). void SetupAndInitialFetch() { - MessageLoop* file_loop = io_thread_.message_loop(); - DCHECK_EQ(MessageLoop::TYPE_IO, file_loop->type()); + base::MessageLoop* file_loop = io_thread_.message_loop(); + DCHECK_EQ(base::MessageLoop::TYPE_IO, file_loop->type()); // We pass the mock IO thread as both the IO and file threads. config_service_->SetupAndFetchInitialConfig( - base::MessageLoopProxy::current(), io_thread_.message_loop_proxy(), - static_cast<MessageLoopForIO*>(file_loop)); + base::MessageLoopProxy::current(), + io_thread_.message_loop_proxy(), + static_cast<base::MessageLoopForIO*>(file_loop)); } // Synchronously gets the proxy config. net::ProxyConfigService::ConfigAvailability SyncGetLatestProxyConfig( @@ -322,7 +323,7 @@ class SynchConfigGetter { // [Runs on |io_thread_|] Signals |event_| on cleanup completion. void CleanUp() { - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); event_.Signal(); } diff --git a/net/proxy/proxy_resolver_v8_tracing.cc b/net/proxy/proxy_resolver_v8_tracing.cc index ddd82a5..63e94d9 100644 --- a/net/proxy/proxy_resolver_v8_tracing.cc +++ b/net/proxy/proxy_resolver_v8_tracing.cc @@ -134,7 +134,7 @@ class ProxyResolverV8Tracing::Job void ReleaseCallback(); ProxyResolverV8* v8_resolver(); - MessageLoop* worker_loop(); + base::MessageLoop* worker_loop(); HostResolver* host_resolver(); ProxyResolverErrorObserver* error_observer(); NetLog* net_log(); @@ -441,7 +441,7 @@ ProxyResolverV8Tracing::Job::~Job() { } void ProxyResolverV8Tracing::Job::CheckIsOnWorkerThread() const { - DCHECK_EQ(MessageLoop::current(), parent_->thread_->message_loop()); + DCHECK_EQ(base::MessageLoop::current(), parent_->thread_->message_loop()); } void ProxyResolverV8Tracing::Job::CheckIsOnOriginThread() const { diff --git a/net/proxy/proxy_resolver_v8_tracing_unittest.cc b/net/proxy/proxy_resolver_v8_tracing_unittest.cc index 2c5ee2b..a4214bd 100644 --- a/net/proxy/proxy_resolver_v8_tracing_unittest.cc +++ b/net/proxy/proxy_resolver_v8_tracing_unittest.cc @@ -35,7 +35,7 @@ class ProxyResolverV8TracingTest : public testing::Test { // Drain any pending messages, which may be left over from cancellation. // This way they get reliably run as part of the current test, rather than // spilling into the next test's execution. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } }; @@ -776,7 +776,7 @@ class BlockableHostResolver : public HostResolver { // Indicate to the caller that a request was received. EXPECT_TRUE(waiting_for_resolve_); - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); // This line is intentionally after action_.Run(), since one of the // tests does a cancellation inside of Resolve(), and it is more @@ -807,7 +807,7 @@ class BlockableHostResolver : public HostResolver { // Waits until Resolve() has been called. void WaitUntilRequestIsReceived() { waiting_for_resolve_ = true; - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); DCHECK(waiting_for_resolve_); waiting_for_resolve_ = false; } diff --git a/net/proxy/proxy_script_decider_unittest.cc b/net/proxy/proxy_script_decider_unittest.cc index 1517596..24808c1 100644 --- a/net/proxy/proxy_script_decider_unittest.cc +++ b/net/proxy/proxy_script_decider_unittest.cc @@ -542,7 +542,7 @@ class AsyncFailDhcpFetcher virtual int Fetch(base::string16* utf16_text, const CompletionCallback& callback) OVERRIDE { callback_ = callback; - MessageLoop::current()->PostTask( + base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&AsyncFailDhcpFetcher::CallbackWithFailure, AsWeakPtr())); return ERR_IO_PENDING; @@ -592,7 +592,7 @@ TEST(ProxyScriptDeciderTest, DhcpCancelledByDestructor) { // back. Before the fix linked to above, this would try to invoke on // the callback object provided by ProxyScriptDecider after it was // no longer valid. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); } } // namespace diff --git a/net/proxy/proxy_script_fetcher_impl.cc b/net/proxy/proxy_script_fetcher_impl.cc index d13fc46..4338a67 100644 --- a/net/proxy/proxy_script_fetcher_impl.cc +++ b/net/proxy/proxy_script_fetcher_impl.cc @@ -157,9 +157,10 @@ int ProxyScriptFetcherImpl::Fetch( // Post a task to timeout this request if it takes too long. cur_request_id_ = ++next_id_; - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, - base::Bind(&ProxyScriptFetcherImpl::OnTimeout, weak_factory_.GetWeakPtr(), + base::Bind(&ProxyScriptFetcherImpl::OnTimeout, + weak_factory_.GetWeakPtr(), cur_request_id_), max_duration_); diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index 7dd9435..c28c11d 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -591,7 +591,7 @@ class ProxyService::ProxyScriptDeciderPoller { void StartPollTimer() { DCHECK(!decider_.get()); - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&ProxyScriptDeciderPoller::DoPoll, weak_factory_.GetWeakPtr()), @@ -638,14 +638,13 @@ class ProxyService::ProxyScriptDeciderPoller { // rather than calling it directly -- this is done to avoid an ugly // destruction sequence, since |this| might be destroyed as a result of // the notification. - MessageLoop::current()->PostTask( - FROM_HERE, - base::Bind( - &ProxyScriptDeciderPoller::NotifyProxyServiceOfChange, - weak_factory_.GetWeakPtr(), - result, - make_scoped_refptr(decider_->script_data()), - decider_->effective_config())); + base::MessageLoop::current()->PostTask( + FROM_HERE, + base::Bind(&ProxyScriptDeciderPoller::NotifyProxyServiceOfChange, + weak_factory_.GetWeakPtr(), + result, + make_scoped_refptr(decider_->script_data()), + decider_->effective_config())); return; } @@ -1336,7 +1335,7 @@ void ProxyService::ForceReloadProxyConfig() { // static ProxyConfigService* ProxyService::CreateSystemProxyConfigService( base::SingleThreadTaskRunner* io_thread_task_runner, - MessageLoop* file_loop) { + base::MessageLoop* file_loop) { #if defined(OS_WIN) return new ProxyConfigServiceWin(); #elif defined(OS_IOS) @@ -1359,21 +1358,22 @@ ProxyConfigService* ProxyService::CreateSystemProxyConfigService( base::ThreadTaskRunnerHandle::Get(); // The file loop should be a MessageLoopForIO on Linux. - DCHECK_EQ(MessageLoop::TYPE_IO, file_loop->type()); + DCHECK_EQ(base::MessageLoop::TYPE_IO, file_loop->type()); // Synchronously fetch the current proxy config (since we are // running on glib_default_loop). Additionally register for // notifications (delivered in either |glib_default_loop| or // |file_loop|) to keep us updated when the proxy config changes. linux_config_service->SetupAndFetchInitialConfig( - glib_thread_task_runner, io_thread_task_runner, - static_cast<MessageLoopForIO*>(file_loop)); + glib_thread_task_runner, + io_thread_task_runner, + static_cast<base::MessageLoopForIO*>(file_loop)); return linux_config_service; #elif defined(OS_ANDROID) return new ProxyConfigServiceAndroid( io_thread_task_runner, - MessageLoop::current()->message_loop_proxy()); + base::MessageLoop::current()->message_loop_proxy()); #else LOG(WARNING) << "Failed to choose a system proxy settings fetcher " "for this platform."; @@ -1502,20 +1502,21 @@ void ProxyService::OnDNSChanged() { OnIPAddressChanged(); } -SyncProxyServiceHelper::SyncProxyServiceHelper(MessageLoop* io_message_loop, - ProxyService* proxy_service) +SyncProxyServiceHelper::SyncProxyServiceHelper( + base::MessageLoop* io_message_loop, + ProxyService* proxy_service) : io_message_loop_(io_message_loop), proxy_service_(proxy_service), event_(false, false), callback_(base::Bind(&SyncProxyServiceHelper::OnCompletion, base::Unretained(this))) { - DCHECK(io_message_loop_ != MessageLoop::current()); + DCHECK(io_message_loop_ != base::MessageLoop::current()); } int SyncProxyServiceHelper::ResolveProxy(const GURL& url, ProxyInfo* proxy_info, const BoundNetLog& net_log) { - DCHECK(io_message_loop_ != MessageLoop::current()); + DCHECK(io_message_loop_ != base::MessageLoop::current()); io_message_loop_->PostTask( FROM_HERE, @@ -1532,7 +1533,7 @@ int SyncProxyServiceHelper::ResolveProxy(const GURL& url, int SyncProxyServiceHelper::ReconsiderProxyAfterError( const GURL& url, ProxyInfo* proxy_info, const BoundNetLog& net_log) { - DCHECK(io_message_loop_ != MessageLoop::current()); + DCHECK(io_message_loop_ != base::MessageLoop::current()); io_message_loop_->PostTask( FROM_HERE, diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc index 53cc326..e9abcee 100644 --- a/net/proxy/proxy_service_unittest.cc +++ b/net/proxy/proxy_service_unittest.cc @@ -2156,7 +2156,7 @@ TEST_F(ProxyServiceTest, NetworkChangeTriggersPacRefetch) { // going to return the same PAC URL as before, but this URL needs to be // refetched on the new network. NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); - MessageLoop::current()->RunUntilIdle(); // Notification happens async. + base::MessageLoop::current()->RunUntilIdle(); // Notification happens async. // Start a second request. ProxyInfo info2; @@ -2278,7 +2278,7 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterFailure) { EXPECT_EQ(GURL("http://foopy/proxy.pac"), fetcher->pending_request_url()); fetcher->NotifyFetchCompletion(OK, kValidPacScript1); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Now that the PAC script is downloaded, it should be used to initialize the // ProxyResolver. Simulate a successful parse. @@ -2390,7 +2390,7 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterContentChange) { EXPECT_EQ(GURL("http://foopy/proxy.pac"), fetcher->pending_request_url()); fetcher->NotifyFetchCompletion(OK, kValidPacScript2); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Now that the PAC script is downloaded, it should be used to initialize the // ProxyResolver. Simulate a successful parse. @@ -2500,7 +2500,7 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterContentUnchanged) { EXPECT_EQ(GURL("http://foopy/proxy.pac"), fetcher->pending_request_url()); fetcher->NotifyFetchCompletion(OK, kValidPacScript1); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); ASSERT_FALSE(resolver->has_pending_set_pac_script_request()); @@ -2606,7 +2606,7 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterSuccess) { EXPECT_EQ(GURL("http://foopy/proxy.pac"), fetcher->pending_request_url()); fetcher->NotifyFetchCompletion(ERR_FAILED, std::string()); - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // At this point the ProxyService should have re-configured itself to use // DIRECT connections rather than the given proxy resolver. @@ -2775,7 +2775,7 @@ TEST_F(ProxyServiceTest, PACScriptRefetchAfterActivity) { // Drain the message loop, so ProxyService is notified of the change // and has a chance to re-configure itself. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); // Start a third request -- this time we expect to get a direct connection // since the PAC script poller experienced a failure. |