OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_client_mdns.h" | 5 #include "chrome/browser/local_discovery/service_discovery_client_mdns.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 PostToUIThread(base::Bind(&Base::RunCallback, proxy, | 319 PostToUIThread(base::Bind(&Base::RunCallback, proxy, |
320 base::Bind(callback, a1, a2, a3))); | 320 base::Bind(callback, a1, a2, a3))); |
321 } | 321 } |
322 | 322 |
323 DISALLOW_COPY_AND_ASSIGN(LocalDomainResolverProxy); | 323 DISALLOW_COPY_AND_ASSIGN(LocalDomainResolverProxy); |
324 }; | 324 }; |
325 | 325 |
326 } // namespace | 326 } // namespace |
327 | 327 |
328 ServiceDiscoveryClientMdns::ServiceDiscoveryClientMdns() | 328 ServiceDiscoveryClientMdns::ServiceDiscoveryClientMdns() |
329 : mdns_runner_( | 329 : mdns_runner_(BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)), |
330 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)), | |
331 restart_attempts_(0), | 330 restart_attempts_(0), |
332 need_dalay_mdns_tasks_(true), | 331 need_dalay_mdns_tasks_(true), |
333 weak_ptr_factory_(this) { | 332 weak_ptr_factory_(this) { |
334 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 333 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
335 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); | 334 net::NetworkChangeNotifier::AddNetworkChangeObserver(this); |
336 StartNewClient(); | 335 StartNewClient(); |
337 } | 336 } |
338 | 337 |
339 std::unique_ptr<ServiceWatcher> | 338 std::unique_ptr<ServiceWatcher> |
340 ServiceDiscoveryClientMdns::CreateServiceWatcher( | 339 ServiceDiscoveryClientMdns::CreateServiceWatcher( |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 OnBeforeMdnsDestroy(); | 445 OnBeforeMdnsDestroy(); |
447 // After calling |Proxy::OnMdnsDestroy| all references to client_ and mdns_ | 446 // After calling |Proxy::OnMdnsDestroy| all references to client_ and mdns_ |
448 // should be destroyed. | 447 // should be destroyed. |
449 if (client_) | 448 if (client_) |
450 mdns_runner_->DeleteSoon(FROM_HERE, client_.release()); | 449 mdns_runner_->DeleteSoon(FROM_HERE, client_.release()); |
451 if (mdns_) | 450 if (mdns_) |
452 mdns_runner_->DeleteSoon(FROM_HERE, mdns_.release()); | 451 mdns_runner_->DeleteSoon(FROM_HERE, mdns_.release()); |
453 } | 452 } |
454 | 453 |
455 } // namespace local_discovery | 454 } // namespace local_discovery |
OLD | NEW |