diff options
Diffstat (limited to 'chrome/browser/local_discovery')
11 files changed, 53 insertions, 37 deletions
diff --git a/chrome/browser/local_discovery/gcd_api_flow_unittest.cc b/chrome/browser/local_discovery/gcd_api_flow_unittest.cc index 19a33a6..4434cb1 100644 --- a/chrome/browser/local_discovery/gcd_api_flow_unittest.cc +++ b/chrome/browser/local_discovery/gcd_api_flow_unittest.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/message_loop/message_loop.h" +#include "base/thread_task_runner_handle.h" #include "base/values.h" #include "chrome/browser/local_discovery/gcd_api_flow_impl.h" #include "content/public/test/test_browser_thread.h" @@ -45,7 +46,7 @@ class GCDApiFlowTest : public testing::Test { GCDApiFlowTest() : ui_thread_(content::BrowserThread::UI, &loop_), request_context_(new net::TestURLRequestContextGetter( - base::MessageLoopProxy::current())), + base::ThreadTaskRunnerHandle::Get())), account_id_(kAccountId) {} ~GCDApiFlowTest() override {} diff --git a/chrome/browser/local_discovery/privet_http_unittest.cc b/chrome/browser/local_discovery/privet_http_unittest.cc index c77de5e..f8d5dbe 100644 --- a/chrome/browser/local_discovery/privet_http_unittest.cc +++ b/chrome/browser/local_discovery/privet_http_unittest.cc @@ -6,6 +6,7 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/message_loop/message_loop.h" +#include "base/thread_task_runner_handle.h" #include "chrome/browser/local_discovery/privet_http_impl.h" #include "net/base/host_port_pair.h" #include "net/base/net_errors.h" @@ -244,8 +245,8 @@ class PrivetHTTPTest : public ::testing::Test { PrivetHTTPTest() { PrivetURLFetcher::ResetTokenMapForTests(); - request_context_= new net::TestURLRequestContextGetter( - base::MessageLoopProxy::current()); + request_context_ = new net::TestURLRequestContextGetter( + base::ThreadTaskRunnerHandle::Get()); privet_client_ = PrivetV1HTTPClient::CreateDefault(make_scoped_ptr<PrivetHTTPClient>( new PrivetHTTPClientImpl("sampleDevice._privet._tcp.local", diff --git a/chrome/browser/local_discovery/privet_local_printer_lister_unittest.cc b/chrome/browser/local_discovery/privet_local_printer_lister_unittest.cc index b6893aa..666ffb6 100644 --- a/chrome/browser/local_discovery/privet_local_printer_lister_unittest.cc +++ b/chrome/browser/local_discovery/privet_local_printer_lister_unittest.cc @@ -5,6 +5,7 @@ #include "chrome/browser/local_discovery/privet_local_printer_lister.h" #include "base/run_loop.h" +#include "base/thread_task_runner_handle.h" #include "chrome/browser/local_discovery/test_service_discovery_client.h" #include "content/public/test/test_browser_thread_bundle.h" #include "net/url_request/test_url_fetcher_factory.h" @@ -109,7 +110,7 @@ class PrivetLocalPrinterListerTest : public testing::Test { test_service_discovery_client_ = new TestServiceDiscoveryClient(); test_service_discovery_client_->Start(); url_request_context_ = new net::TestURLRequestContextGetter( - base::MessageLoopProxy::current()); + base::ThreadTaskRunnerHandle::Get()); local_printer_lister_.reset(new PrivetLocalPrinterLister( test_service_discovery_client_.get(), url_request_context_.get(), diff --git a/chrome/browser/local_discovery/privet_notifications_unittest.cc b/chrome/browser/local_discovery/privet_notifications_unittest.cc index 5ee723d..c96a52b 100644 --- a/chrome/browser/local_discovery/privet_notifications_unittest.cc +++ b/chrome/browser/local_discovery/privet_notifications_unittest.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/thread_task_runner_handle.h" #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h" - #include "chrome/browser/local_discovery/privet_http_impl.h" #include "chrome/browser/local_discovery/privet_notifications.h" #include "net/url_request/test_url_fetcher_factory.h" @@ -80,8 +80,9 @@ class MockPrivetHttpFactory : public PrivetHTTPAsynchronousFactory { class PrivetNotificationsListenerTest : public ::testing::Test { public: - PrivetNotificationsListenerTest() : request_context_( - new net::TestURLRequestContextGetter(base::MessageLoopProxy::current())) { + PrivetNotificationsListenerTest() + : request_context_(new net::TestURLRequestContextGetter( + base::ThreadTaskRunnerHandle::Get())) { notification_listener_.reset(new PrivetNotificationsListener( scoped_ptr<PrivetHTTPAsynchronousFactory>( new MockPrivetHttpFactory(request_context_.get())), diff --git a/chrome/browser/local_discovery/privet_url_fetcher_unittest.cc b/chrome/browser/local_discovery/privet_url_fetcher_unittest.cc index 467e1d8..d1b83fd 100644 --- a/chrome/browser/local_discovery/privet_url_fetcher_unittest.cc +++ b/chrome/browser/local_discovery/privet_url_fetcher_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/thread_task_runner_handle.h" #include "chrome/browser/local_discovery/privet_url_fetcher.h" #include "net/url_request/test_url_fetcher_factory.h" #include "net/url_request/url_request_test_util.h" @@ -88,8 +89,8 @@ class MockPrivetURLFetcherDelegate : public PrivetURLFetcher::Delegate { class PrivetURLFetcherTest : public ::testing::Test { public: PrivetURLFetcherTest() { - request_context_= new net::TestURLRequestContextGetter( - base::MessageLoopProxy::current()); + request_context_ = new net::TestURLRequestContextGetter( + base::ThreadTaskRunnerHandle::Get()); privet_urlfetcher_.reset(new PrivetURLFetcher( GURL(kSamplePrivetURL), net::URLFetcher::POST, diff --git a/chrome/browser/local_discovery/privetv3_session_unittest.cc b/chrome/browser/local_discovery/privetv3_session_unittest.cc index 5cf4ff8..398ce18 100644 --- a/chrome/browser/local_discovery/privetv3_session_unittest.cc +++ b/chrome/browser/local_discovery/privetv3_session_unittest.cc @@ -6,6 +6,7 @@ #include "base/base64.h" #include "base/strings/stringprintf.h" +#include "base/thread_task_runner_handle.h" #include "chrome/browser/local_discovery/privet_http.h" #include "content/public/test/test_utils.h" #include "crypto/hmac.h" @@ -40,8 +41,8 @@ const char kInfoResponse[] = class MockPrivetHTTPClient : public PrivetHTTPClient { public: MockPrivetHTTPClient() { - request_context_ = - new net::TestURLRequestContextGetter(base::MessageLoopProxy::current()); + request_context_ = new net::TestURLRequestContextGetter( + base::ThreadTaskRunnerHandle::Get()); } MOCK_METHOD0(GetName, const std::string&()); diff --git a/chrome/browser/local_discovery/service_discovery_client_mac.h b/chrome/browser/local_discovery/service_discovery_client_mac.h index e444d1e..573d630 100644 --- a/chrome/browser/local_discovery/service_discovery_client_mac.h +++ b/chrome/browser/local_discovery/service_discovery_client_mac.h @@ -10,6 +10,8 @@ #include "base/mac/scoped_nsobject.h" #include "base/memory/weak_ptr.h" +#include "base/single_thread_task_runner.h" +#include "base/thread_task_runner_handle.h" #include "chrome/browser/local_discovery/service_discovery_shared_client.h" #include "content/public/browser/browser_thread.h" @@ -61,7 +63,7 @@ class ServiceWatcherImplMac : public ServiceWatcher { NetServiceBrowserContainer( const std::string& service_type, const ServiceWatcher::UpdatedCallback& callback, - scoped_refptr<base::MessageLoopProxy> service_discovery_runner); + scoped_refptr<base::SingleThreadTaskRunner> service_discovery_runner); ~NetServiceBrowserContainer(); void Start(); @@ -77,15 +79,15 @@ class ServiceWatcherImplMac : public ServiceWatcher { void DiscoverOnDiscoveryThread(); bool IsOnServiceDiscoveryThread() { - return base::MessageLoopProxy::current() == + return base::ThreadTaskRunnerHandle::Get() == service_discovery_runner_.get(); } std::string service_type_; ServiceWatcher::UpdatedCallback callback_; - scoped_refptr<base::MessageLoopProxy> callback_runner_; - scoped_refptr<base::MessageLoopProxy> service_discovery_runner_; + scoped_refptr<base::SingleThreadTaskRunner> callback_runner_; + scoped_refptr<base::SingleThreadTaskRunner> service_discovery_runner_; base::scoped_nsobject<id> delegate_; base::scoped_nsobject<NSNetServiceBrowser> browser_; @@ -95,7 +97,7 @@ class ServiceWatcherImplMac : public ServiceWatcher { ServiceWatcherImplMac( const std::string& service_type, const ServiceWatcher::UpdatedCallback& callback, - scoped_refptr<base::MessageLoopProxy> service_discovery_runner); + scoped_refptr<base::SingleThreadTaskRunner> service_discovery_runner); void OnServicesUpdate(ServiceWatcher::UpdateType update, const std::string& service); @@ -127,7 +129,7 @@ class ServiceResolverImplMac : public ServiceResolver { NetServiceContainer( const std::string& service_name, const ServiceResolver::ResolveCompleteCallback& callback, - scoped_refptr<base::MessageLoopProxy> service_discovery_runner); + scoped_refptr<base::SingleThreadTaskRunner> service_discovery_runner); virtual ~NetServiceContainer(); @@ -143,15 +145,15 @@ class ServiceResolverImplMac : public ServiceResolver { void StartResolvingOnDiscoveryThread(); bool IsOnServiceDiscoveryThread() { - return base::MessageLoopProxy::current() == + return base::ThreadTaskRunnerHandle::Get() == service_discovery_runner_.get(); } const std::string service_name_; ServiceResolver::ResolveCompleteCallback callback_; - scoped_refptr<base::MessageLoopProxy> callback_runner_; - scoped_refptr<base::MessageLoopProxy> service_discovery_runner_; + scoped_refptr<base::SingleThreadTaskRunner> callback_runner_; + scoped_refptr<base::SingleThreadTaskRunner> service_discovery_runner_; base::scoped_nsobject<id> delegate_; base::scoped_nsobject<NSNetService> service_; @@ -162,7 +164,7 @@ class ServiceResolverImplMac : public ServiceResolver { ServiceResolverImplMac( const std::string& service_name, const ServiceResolver::ResolveCompleteCallback& callback, - scoped_refptr<base::MessageLoopProxy> service_discovery_runner); + scoped_refptr<base::SingleThreadTaskRunner> service_discovery_runner); // Testing methods. NetServiceContainer* GetContainerForTesting(); diff --git a/chrome/browser/local_discovery/service_discovery_client_mac.mm b/chrome/browser/local_discovery/service_discovery_client_mac.mm index 59c2c81..6047d2f 100644 --- a/chrome/browser/local_discovery/service_discovery_client_mac.mm +++ b/chrome/browser/local_discovery/service_discovery_client_mac.mm @@ -10,6 +10,8 @@ #include "base/memory/singleton.h" #include "base/metrics/histogram.h" +#include "base/single_thread_task_runner.h" +#include "base/thread_task_runner_handle.h" #include "base/threading/thread.h" using local_discovery::ServiceWatcherImplMac; @@ -157,12 +159,13 @@ void ServiceDiscoveryClientMac::StartThreadIfNotStarted() { ServiceWatcherImplMac::NetServiceBrowserContainer::NetServiceBrowserContainer( const std::string& service_type, const ServiceWatcher::UpdatedCallback& callback, - scoped_refptr<base::MessageLoopProxy> service_discovery_runner) + scoped_refptr<base::SingleThreadTaskRunner> service_discovery_runner) : service_type_(service_type), callback_(callback), - callback_runner_(base::MessageLoopProxy::current()), + callback_runner_(base::ThreadTaskRunnerHandle::Get()), service_discovery_runner_(service_discovery_runner), - weak_factory_(this) {} + weak_factory_(this) { +} ServiceWatcherImplMac::NetServiceBrowserContainer:: ~NetServiceBrowserContainer() { @@ -226,7 +229,7 @@ void ServiceWatcherImplMac::NetServiceBrowserContainer::DeleteSoon() { ServiceWatcherImplMac::ServiceWatcherImplMac( const std::string& service_type, const ServiceWatcher::UpdatedCallback& callback, - scoped_refptr<base::MessageLoopProxy> service_discovery_runner) + scoped_refptr<base::SingleThreadTaskRunner> service_discovery_runner) : service_type_(service_type), callback_(callback), started_(false), @@ -273,12 +276,13 @@ void ServiceWatcherImplMac::OnServicesUpdate(ServiceWatcher::UpdateType update, ServiceResolverImplMac::NetServiceContainer::NetServiceContainer( const std::string& service_name, const ServiceResolver::ResolveCompleteCallback& callback, - scoped_refptr<base::MessageLoopProxy> service_discovery_runner) + scoped_refptr<base::SingleThreadTaskRunner> service_discovery_runner) : service_name_(service_name), callback_(callback), - callback_runner_(base::MessageLoopProxy::current()), + callback_runner_(base::ThreadTaskRunnerHandle::Get()), service_discovery_runner_(service_discovery_runner), - weak_factory_(this) {} + weak_factory_(this) { +} ServiceResolverImplMac::NetServiceContainer::~NetServiceContainer() { DCHECK(IsOnServiceDiscoveryThread()); @@ -366,7 +370,7 @@ void ServiceResolverImplMac::NetServiceContainer::SetServiceForTesting( ServiceResolverImplMac::ServiceResolverImplMac( const std::string& service_name, const ServiceResolver::ResolveCompleteCallback& callback, - scoped_refptr<base::MessageLoopProxy> service_discovery_runner) + scoped_refptr<base::SingleThreadTaskRunner> service_discovery_runner) : service_name_(service_name), callback_(callback), has_resolved_(false), diff --git a/chrome/browser/local_discovery/service_discovery_host_client.cc b/chrome/browser/local_discovery/service_discovery_host_client.cc index 3d75a03..dc69d97 100644 --- a/chrome/browser/local_discovery/service_discovery_host_client.cc +++ b/chrome/browser/local_discovery/service_discovery_host_client.cc @@ -4,6 +4,7 @@ #include "chrome/browser/local_discovery/service_discovery_host_client.h" +#include "base/thread_task_runner_handle.h" #include "chrome/common/local_discovery/local_discovery_messages.h" #include "chrome/grit/generated_resources.h" #include "content/public/browser/browser_thread.h" @@ -282,8 +283,9 @@ void ServiceDiscoveryHostClient::StartOnIOThread() { void ServiceDiscoveryHostClient::OnSocketsReady(const SocketInfoList& sockets) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(!utility_host_); - utility_host_ = UtilityProcessHost::Create( - this, base::MessageLoopProxy::current().get())->AsWeakPtr(); + utility_host_ = + UtilityProcessHost::Create( + this, base::ThreadTaskRunnerHandle::Get().get())->AsWeakPtr(); utility_host_->SetName(l10n_util::GetStringUTF16( IDS_UTILITY_PROCESS_SERVICE_DISCOVERY_HANDLER_NAME)); utility_host_->EnableMDns(); @@ -304,8 +306,9 @@ void ServiceDiscoveryHostClient::OnSocketsReady(const SocketInfoList& sockets) { void ServiceDiscoveryHostClient::StartOnIOThread() { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(!utility_host_); - utility_host_ = UtilityProcessHost::Create( - this, base::MessageLoopProxy::current().get())->AsWeakPtr(); + utility_host_ = + UtilityProcessHost::Create( + this, base::ThreadTaskRunnerHandle::Get().get())->AsWeakPtr(); utility_host_->SetName(l10n_util::GetStringUTF16( IDS_UTILITY_PROCESS_SERVICE_DISCOVERY_HANDLER_NAME)); utility_host_->EnableMDns(); diff --git a/chrome/browser/local_discovery/wifi/credential_getter_win.cc b/chrome/browser/local_discovery/wifi/credential_getter_win.cc index 4efdd3a..2730fca 100644 --- a/chrome/browser/local_discovery/wifi/credential_getter_win.cc +++ b/chrome/browser/local_discovery/wifi/credential_getter_win.cc @@ -4,6 +4,7 @@ #include "chrome/browser/local_discovery/wifi/credential_getter_win.h" +#include "base/thread_task_runner_handle.h" #include "chrome/common/extensions/chrome_utility_extensions_messages.h" #include "chrome/grit/generated_resources.h" #include "content/public/browser/browser_thread.h" @@ -21,7 +22,7 @@ void CredentialGetterWin::StartGetCredentials( const std::string& network_guid, const CredentialsCallback& callback) { callback_ = callback; - callback_runner_ = base::MessageLoopProxy::current(); + callback_runner_ = base::ThreadTaskRunnerHandle::Get(); content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, @@ -31,7 +32,7 @@ void CredentialGetterWin::StartGetCredentials( void CredentialGetterWin::StartOnIOThread(const std::string& network_guid) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); content::UtilityProcessHost* host = content::UtilityProcessHost::Create( - this, base::MessageLoopProxy::current()); + this, base::ThreadTaskRunnerHandle::Get()); host->SetName(l10n_util::GetStringUTF16( IDS_UTILITY_PROCESS_WIFI_CREDENTIALS_GETTER_NAME)); host->ElevatePrivileges(); diff --git a/chrome/browser/local_discovery/wifi/credential_getter_win.h b/chrome/browser/local_discovery/wifi/credential_getter_win.h index 4a1bd98..a0f2161 100644 --- a/chrome/browser/local_discovery/wifi/credential_getter_win.h +++ b/chrome/browser/local_discovery/wifi/credential_getter_win.h @@ -7,7 +7,7 @@ #include <string> -#include "base/message_loop/message_loop_proxy.h" +#include "base/single_thread_task_runner.h" #include "content/public/browser/utility_process_host.h" #include "content/public/browser/utility_process_host_client.h" @@ -40,7 +40,7 @@ class CredentialGetterWin : public content::UtilityProcessHostClient { void PostCallback(bool success, const std::string& key_data); CredentialsCallback callback_; - scoped_refptr<base::MessageLoopProxy> callback_runner_; + scoped_refptr<base::SingleThreadTaskRunner> callback_runner_; }; } // namespace wifi |