Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/browser/local_discovery/service_discovery_client_mdns.cc

Issue 1653573003: Revert of Migrate Local Discovery from net::IPAddressNumber to net::IPAddress. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
17 #include "chrome/browser/local_discovery/service_discovery_client_impl.h" 17 #include "chrome/browser/local_discovery/service_discovery_client_impl.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "net/dns/mdns_client.h" 19 #include "net/dns/mdns_client.h"
20 #include "net/udp/datagram_server_socket.h" 20 #include "net/udp/datagram_server_socket.h"
21 21
22 namespace net {
23 class IPAddress;
24 }
25
26 namespace local_discovery { 22 namespace local_discovery {
27 23
28 using content::BrowserThread; 24 using content::BrowserThread;
29 25
30 // Base class for objects returned by ServiceDiscoveryClient implementation. 26 // Base class for objects returned by ServiceDiscoveryClient implementation.
31 // Handles interaction of client code on UI thread end net code on mdns thread. 27 // Handles interaction of client code on UI thread end net code on mdns thread.
32 class ServiceDiscoveryClientMdns::Proxy { 28 class ServiceDiscoveryClientMdns::Proxy {
33 public: 29 public:
34 typedef base::WeakPtr<Proxy> WeakPtr; 30 typedef base::WeakPtr<Proxy> WeakPtr;
35 31
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 if (implementation()) { 301 if (implementation()) {
306 PostToMdnsThread(base::Bind(&LocalDomainResolver::Start, 302 PostToMdnsThread(base::Bind(&LocalDomainResolver::Start,
307 base::Unretained(implementation()))); 303 base::Unretained(implementation())));
308 } 304 }
309 }; 305 };
310 306
311 private: 307 private:
312 static void OnCallback(const WeakPtr& proxy, 308 static void OnCallback(const WeakPtr& proxy,
313 const LocalDomainResolver::IPAddressCallback& callback, 309 const LocalDomainResolver::IPAddressCallback& callback,
314 bool a1, 310 bool a1,
315 const net::IPAddress& a2, 311 const net::IPAddressNumber& a2,
316 const net::IPAddress& a3) { 312 const net::IPAddressNumber& a3) {
317 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); 313 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
318 PostToUIThread(base::Bind(&Base::RunCallback, proxy, 314 PostToUIThread(base::Bind(&Base::RunCallback, proxy,
319 base::Bind(callback, a1, a2, a3))); 315 base::Bind(callback, a1, a2, a3)));
320 } 316 }
321 317
322 DISALLOW_COPY_AND_ASSIGN(LocalDomainResolverProxy); 318 DISALLOW_COPY_AND_ASSIGN(LocalDomainResolverProxy);
323 }; 319 };
324 320
325 } // namespace 321 } // namespace
326 322
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 OnBeforeMdnsDestroy(); 439 OnBeforeMdnsDestroy();
444 // After calling |Proxy::OnMdnsDestroy| all references to client_ and mdns_ 440 // After calling |Proxy::OnMdnsDestroy| all references to client_ and mdns_
445 // should be destroyed. 441 // should be destroyed.
446 if (client_) 442 if (client_)
447 mdns_runner_->DeleteSoon(FROM_HERE, client_.release()); 443 mdns_runner_->DeleteSoon(FROM_HERE, client_.release());
448 if (mdns_) 444 if (mdns_)
449 mdns_runner_->DeleteSoon(FROM_HERE, mdns_.release()); 445 mdns_runner_->DeleteSoon(FROM_HERE, mdns_.release());
450 } 446 }
451 447
452 } // namespace local_discovery 448 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698