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

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

Issue 23548028: Added logging to local discovery code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/utility/local_discovery/service_discovery_message_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if defined(OS_POSIX) 7 #if defined(OS_POSIX)
8 #include "base/file_descriptor_posix.h" 8 #include "base/file_descriptor_posix.h"
9 #endif // OS_POSIX 9 #endif // OS_POSIX
10 10
(...skipping 12 matching lines...) Expand all
23 ServiceWatcherProxy(ServiceDiscoveryHostClient* host, 23 ServiceWatcherProxy(ServiceDiscoveryHostClient* host,
24 const std::string& service_type, 24 const std::string& service_type,
25 const ServiceWatcher::UpdatedCallback& callback) 25 const ServiceWatcher::UpdatedCallback& callback)
26 : host_(host), 26 : host_(host),
27 service_type_(service_type), 27 service_type_(service_type),
28 id_(host_->RegisterWatcherCallback(callback)), 28 id_(host_->RegisterWatcherCallback(callback)),
29 started_(false) { 29 started_(false) {
30 } 30 }
31 31
32 virtual ~ServiceWatcherProxy() { 32 virtual ~ServiceWatcherProxy() {
33 DVLOG(1) << "~ServiceWatcherProxy with id " << id_;
33 host_->UnregisterWatcherCallback(id_); 34 host_->UnregisterWatcherCallback(id_);
34 if (started_) 35 if (started_)
35 host_->Send(new LocalDiscoveryMsg_DestroyWatcher(id_)); 36 host_->Send(new LocalDiscoveryMsg_DestroyWatcher(id_));
36 } 37 }
37 38
38 virtual void Start() OVERRIDE { 39 virtual void Start() OVERRIDE {
40 DVLOG(1) << "ServiceWatcher::Start with id " << id_;
39 DCHECK(!started_); 41 DCHECK(!started_);
40 host_->Send(new LocalDiscoveryMsg_StartWatcher(id_, service_type_)); 42 host_->Send(new LocalDiscoveryMsg_StartWatcher(id_, service_type_));
41 started_ = true; 43 started_ = true;
42 } 44 }
43 45
44 virtual void DiscoverNewServices(bool force_update) OVERRIDE { 46 virtual void DiscoverNewServices(bool force_update) OVERRIDE {
47 DVLOG(1) << "ServiceWatcher::DiscoverNewServices with id "
48 << id_;
45 DCHECK(started_); 49 DCHECK(started_);
46 host_->Send(new LocalDiscoveryMsg_DiscoverServices(id_, force_update)); 50 host_->Send(new LocalDiscoveryMsg_DiscoverServices(id_, force_update));
47 } 51 }
48 52
49 virtual std::string GetServiceType() const OVERRIDE { 53 virtual std::string GetServiceType() const OVERRIDE {
50 return service_type_; 54 return service_type_;
51 } 55 }
52 56
53 private: 57 private:
54 scoped_refptr<ServiceDiscoveryHostClient> host_; 58 scoped_refptr<ServiceDiscoveryHostClient> host_;
55 const std::string service_type_; 59 const std::string service_type_;
56 const uint64 id_; 60 const uint64 id_;
57 bool started_; 61 bool started_;
58 }; 62 };
59 63
60 class ServiceDiscoveryHostClient::ServiceResolverProxy 64 class ServiceDiscoveryHostClient::ServiceResolverProxy
61 : public ServiceResolver { 65 : public ServiceResolver {
62 public: 66 public:
63 ServiceResolverProxy(ServiceDiscoveryHostClient* host, 67 ServiceResolverProxy(ServiceDiscoveryHostClient* host,
64 const std::string& service_name, 68 const std::string& service_name,
65 const ServiceResolver::ResolveCompleteCallback& callback) 69 const ServiceResolver::ResolveCompleteCallback& callback)
66 : host_(host), 70 : host_(host),
67 service_name_(service_name), 71 service_name_(service_name),
68 id_(host->RegisterResolverCallback(callback)), 72 id_(host->RegisterResolverCallback(callback)),
69 started_(false) { 73 started_(false) {
70 } 74 }
71 75
72 virtual ~ServiceResolverProxy() { 76 virtual ~ServiceResolverProxy() {
77 DVLOG(1) << "~ServiceResolverProxy with id " << id_;
73 host_->UnregisterResolverCallback(id_); 78 host_->UnregisterResolverCallback(id_);
74 if (started_) 79 if (started_)
75 host_->Send(new LocalDiscoveryMsg_DestroyResolver(id_)); 80 host_->Send(new LocalDiscoveryMsg_DestroyResolver(id_));
76 } 81 }
77 82
78 virtual void StartResolving() OVERRIDE { 83 virtual void StartResolving() OVERRIDE {
84 DVLOG(1)
85 << "ServiceResolverProxy::StartResolving with id "
86 << id_;
79 DCHECK(!started_); 87 DCHECK(!started_);
80 host_->Send(new LocalDiscoveryMsg_ResolveService(id_, service_name_)); 88 host_->Send(new LocalDiscoveryMsg_ResolveService(id_, service_name_));
81 started_ = true; 89 started_ = true;
82 } 90 }
83 91
84 virtual std::string GetName() const OVERRIDE { 92 virtual std::string GetName() const OVERRIDE {
85 return service_name_; 93 return service_name_;
86 } 94 }
87 95
88 private: 96 private:
(...skipping 11 matching lines...) Expand all
100 net::AddressFamily address_family, 108 net::AddressFamily address_family,
101 const LocalDomainResolver::IPAddressCallback& callback) 109 const LocalDomainResolver::IPAddressCallback& callback)
102 : host_(host), 110 : host_(host),
103 domain_(domain), 111 domain_(domain),
104 address_family_(address_family), 112 address_family_(address_family),
105 id_(host->RegisterLocalDomainResolverCallback(callback)), 113 id_(host->RegisterLocalDomainResolverCallback(callback)),
106 started_(false) { 114 started_(false) {
107 } 115 }
108 116
109 virtual ~LocalDomainResolverProxy() { 117 virtual ~LocalDomainResolverProxy() {
118 DVLOG(1) << "~LocalDomainResolverProxy with id "
119 << id_;
110 host_->UnregisterLocalDomainResolverCallback(id_); 120 host_->UnregisterLocalDomainResolverCallback(id_);
111 if (started_) 121 if (started_)
112 host_->Send(new LocalDiscoveryMsg_DestroyLocalDomainResolver(id_)); 122 host_->Send(new LocalDiscoveryMsg_DestroyLocalDomainResolver(id_));
113 } 123 }
114 124
115 virtual void Start() OVERRIDE { 125 virtual void Start() OVERRIDE {
126 DVLOG(1) << "LocalDomainResolverProxy::Start with id "
127 << id_;
116 DCHECK(!started_); 128 DCHECK(!started_);
117 host_->Send(new LocalDiscoveryMsg_ResolveLocalDomain(id_, domain_, 129 host_->Send(new LocalDiscoveryMsg_ResolveLocalDomain(id_, domain_,
118 address_family_)); 130 address_family_));
119 started_ = true; 131 started_ = true;
120 } 132 }
121 133
122 private: 134 private:
123 scoped_refptr<ServiceDiscoveryHostClient> host_; 135 scoped_refptr<ServiceDiscoveryHostClient> host_;
124 std::string domain_; 136 std::string domain_;
125 net::AddressFamily address_family_; 137 net::AddressFamily address_family_;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 void ServiceDiscoveryHostClientFactory::ReleaseClientInternal() { 426 void ServiceDiscoveryHostClientFactory::ReleaseClientInternal() {
415 DCHECK(CalledOnValidThread()); 427 DCHECK(CalledOnValidThread());
416 references_--; 428 references_--;
417 if (references_ == 0) { 429 if (references_ == 0) {
418 instance_->Shutdown(); 430 instance_->Shutdown();
419 instance_ = NULL; 431 instance_ = NULL;
420 } 432 }
421 } 433 }
422 434
423 } // namespace local_discovery 435 } // namespace local_discovery
OLDNEW
« no previous file with comments | « no previous file | chrome/utility/local_discovery/service_discovery_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698