OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/local_discovery/service_discovery_host_client.h" | 5 #include "chrome/browser/local_discovery/service_discovery_host_client.h" |
6 | 6 |
| 7 #include "base/location.h" |
| 8 #include "base/single_thread_task_runner.h" |
7 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
8 #include "chrome/common/local_discovery/local_discovery_messages.h" | 10 #include "chrome/common/local_discovery/local_discovery_messages.h" |
9 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
10 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
11 #include "content/public/browser/utility_process_host.h" | 13 #include "content/public/browser/utility_process_host.h" |
12 #include "net/dns/mdns_client.h" | 14 #include "net/dns/mdns_client.h" |
13 #include "net/socket/socket_descriptor.h" | 15 #include "net/socket/socket_descriptor.h" |
14 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
15 | 17 |
16 #if defined(OS_POSIX) | 18 #if defined(OS_POSIX) |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 169 |
168 private: | 170 private: |
169 scoped_refptr<ServiceDiscoveryHostClient> host_; | 171 scoped_refptr<ServiceDiscoveryHostClient> host_; |
170 std::string domain_; | 172 std::string domain_; |
171 net::AddressFamily address_family_; | 173 net::AddressFamily address_family_; |
172 const uint64 id_; | 174 const uint64 id_; |
173 bool started_; | 175 bool started_; |
174 }; | 176 }; |
175 | 177 |
176 ServiceDiscoveryHostClient::ServiceDiscoveryHostClient() : current_id_(0) { | 178 ServiceDiscoveryHostClient::ServiceDiscoveryHostClient() : current_id_(0) { |
177 callback_runner_ = base::MessageLoop::current()->message_loop_proxy(); | 179 callback_runner_ = base::MessageLoop::current()->task_runner(); |
178 io_runner_ = BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 180 io_runner_ = BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
179 } | 181 } |
180 | 182 |
181 ServiceDiscoveryHostClient::~ServiceDiscoveryHostClient() { | 183 ServiceDiscoveryHostClient::~ServiceDiscoveryHostClient() { |
182 DCHECK(service_watcher_callbacks_.empty()); | 184 DCHECK(service_watcher_callbacks_.empty()); |
183 DCHECK(service_resolver_callbacks_.empty()); | 185 DCHECK(service_resolver_callbacks_.empty()); |
184 DCHECK(domain_resolver_callbacks_.empty()); | 186 DCHECK(domain_resolver_callbacks_.empty()); |
185 } | 187 } |
186 | 188 |
187 scoped_ptr<ServiceWatcher> ServiceDiscoveryHostClient::CreateServiceWatcher( | 189 scoped_ptr<ServiceWatcher> ServiceDiscoveryHostClient::CreateServiceWatcher( |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 bool success, | 448 bool success, |
447 const net::IPAddressNumber& ip_address_ipv4, | 449 const net::IPAddressNumber& ip_address_ipv4, |
448 const net::IPAddressNumber& ip_address_ipv6) { | 450 const net::IPAddressNumber& ip_address_ipv6) { |
449 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 451 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
450 DomainResolverCallbacks::iterator it = domain_resolver_callbacks_.find(id); | 452 DomainResolverCallbacks::iterator it = domain_resolver_callbacks_.find(id); |
451 if (it != domain_resolver_callbacks_.end() && !it->second.is_null()) | 453 if (it != domain_resolver_callbacks_.end() && !it->second.is_null()) |
452 it->second.Run(success, ip_address_ipv4, ip_address_ipv6); | 454 it->second.Run(success, ip_address_ipv4, ip_address_ipv6); |
453 } | 455 } |
454 | 456 |
455 } // namespace local_discovery | 457 } // namespace local_discovery |
OLD | NEW |