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

Side by Side Diff: net/dns/mdns_client_impl.cc

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « net/dns/mdns_client_impl.h ('k') | net/docs/bug-triage.txt » ('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 "net/dns/mdns_client_impl.h" 5 #include "net/dns/mdns_client_impl.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 void MDnsConnection::OnDatagramReceived( 189 void MDnsConnection::OnDatagramReceived(
190 DnsResponse* response, 190 DnsResponse* response,
191 const IPEndPoint& recv_addr, 191 const IPEndPoint& recv_addr,
192 int bytes_read) { 192 int bytes_read) {
193 // TODO(noamsml): More sophisticated error handling. 193 // TODO(noamsml): More sophisticated error handling.
194 DCHECK_GT(bytes_read, 0); 194 DCHECK_GT(bytes_read, 0);
195 delegate_->HandlePacket(response, bytes_read); 195 delegate_->HandlePacket(response, bytes_read);
196 } 196 }
197 197
198 MDnsClientImpl::Core::Core(MDnsClientImpl* client) 198 MDnsClientImpl::Core::Core() : connection_(new MDnsConnection(this)) {
199 : client_(client), connection_(new MDnsConnection(this)) {
200 } 199 }
201 200
202 MDnsClientImpl::Core::~Core() { 201 MDnsClientImpl::Core::~Core() {
203 STLDeleteValues(&listeners_); 202 STLDeleteValues(&listeners_);
204 } 203 }
205 204
206 bool MDnsClientImpl::Core::Init(MDnsSocketFactory* socket_factory) { 205 bool MDnsClientImpl::Core::Init(MDnsSocketFactory* socket_factory) {
207 return connection_->Init(socket_factory); 206 return connection_->Init(socket_factory);
208 } 207 }
209 208
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } 416 }
418 417
419 MDnsClientImpl::MDnsClientImpl() { 418 MDnsClientImpl::MDnsClientImpl() {
420 } 419 }
421 420
422 MDnsClientImpl::~MDnsClientImpl() { 421 MDnsClientImpl::~MDnsClientImpl() {
423 } 422 }
424 423
425 bool MDnsClientImpl::StartListening(MDnsSocketFactory* socket_factory) { 424 bool MDnsClientImpl::StartListening(MDnsSocketFactory* socket_factory) {
426 DCHECK(!core_.get()); 425 DCHECK(!core_.get());
427 core_.reset(new Core(this)); 426 core_.reset(new Core());
428 if (!core_->Init(socket_factory)) { 427 if (!core_->Init(socket_factory)) {
429 core_.reset(); 428 core_.reset();
430 return false; 429 return false;
431 } 430 }
432 return true; 431 return true;
433 } 432 }
434 433
435 void MDnsClientImpl::StopListening() { 434 void MDnsClientImpl::StopListening() {
436 core_.reset(); 435 core_.reset();
437 } 436 }
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 726
728 void MDnsTransactionImpl::OnNsecRecord(const std::string& name, unsigned type) { 727 void MDnsTransactionImpl::OnNsecRecord(const std::string& name, unsigned type) {
729 TriggerCallback(RESULT_NSEC, NULL); 728 TriggerCallback(RESULT_NSEC, NULL);
730 } 729 }
731 730
732 void MDnsTransactionImpl::OnCachePurged() { 731 void MDnsTransactionImpl::OnCachePurged() {
733 // TODO(noamsml): Cache purge situations not yet implemented 732 // TODO(noamsml): Cache purge situations not yet implemented
734 } 733 }
735 734
736 } // namespace net 735 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/mdns_client_impl.h ('k') | net/docs/bug-triage.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698