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

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

Issue 623213004: replace OVERRIDE and FINAL with override and final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo unwanted change in comment Created 6 years, 2 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/dns_test_util.cc ('k') | net/dns/dns_transaction_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/dns_transaction.h" 5 #include "net/dns/dns_transaction.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 DnsUDPAttempt(unsigned server_index, 134 DnsUDPAttempt(unsigned server_index,
135 scoped_ptr<DnsSession::SocketLease> socket_lease, 135 scoped_ptr<DnsSession::SocketLease> socket_lease,
136 scoped_ptr<DnsQuery> query) 136 scoped_ptr<DnsQuery> query)
137 : DnsAttempt(server_index), 137 : DnsAttempt(server_index),
138 next_state_(STATE_NONE), 138 next_state_(STATE_NONE),
139 received_malformed_response_(false), 139 received_malformed_response_(false),
140 socket_lease_(socket_lease.Pass()), 140 socket_lease_(socket_lease.Pass()),
141 query_(query.Pass()) {} 141 query_(query.Pass()) {}
142 142
143 // DnsAttempt: 143 // DnsAttempt:
144 virtual int Start(const CompletionCallback& callback) OVERRIDE { 144 virtual int Start(const CompletionCallback& callback) override {
145 DCHECK_EQ(STATE_NONE, next_state_); 145 DCHECK_EQ(STATE_NONE, next_state_);
146 callback_ = callback; 146 callback_ = callback;
147 start_time_ = base::TimeTicks::Now(); 147 start_time_ = base::TimeTicks::Now();
148 next_state_ = STATE_SEND_QUERY; 148 next_state_ = STATE_SEND_QUERY;
149 return DoLoop(OK); 149 return DoLoop(OK);
150 } 150 }
151 151
152 virtual const DnsQuery* GetQuery() const OVERRIDE { 152 virtual const DnsQuery* GetQuery() const override {
153 return query_.get(); 153 return query_.get();
154 } 154 }
155 155
156 virtual const DnsResponse* GetResponse() const OVERRIDE { 156 virtual const DnsResponse* GetResponse() const override {
157 const DnsResponse* resp = response_.get(); 157 const DnsResponse* resp = response_.get();
158 return (resp != NULL && resp->IsValid()) ? resp : NULL; 158 return (resp != NULL && resp->IsValid()) ? resp : NULL;
159 } 159 }
160 160
161 virtual const BoundNetLog& GetSocketNetLog() const OVERRIDE { 161 virtual const BoundNetLog& GetSocketNetLog() const override {
162 return socket_lease_->socket()->NetLog(); 162 return socket_lease_->socket()->NetLog();
163 } 163 }
164 164
165 private: 165 private:
166 enum State { 166 enum State {
167 STATE_SEND_QUERY, 167 STATE_SEND_QUERY,
168 STATE_SEND_QUERY_COMPLETE, 168 STATE_SEND_QUERY_COMPLETE,
169 STATE_READ_RESPONSE, 169 STATE_READ_RESPONSE,
170 STATE_READ_RESPONSE_COMPLETE, 170 STATE_READ_RESPONSE_COMPLETE,
171 STATE_NONE, 171 STATE_NONE,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 scoped_ptr<StreamSocket> socket, 299 scoped_ptr<StreamSocket> socket,
300 scoped_ptr<DnsQuery> query) 300 scoped_ptr<DnsQuery> query)
301 : DnsAttempt(server_index), 301 : DnsAttempt(server_index),
302 next_state_(STATE_NONE), 302 next_state_(STATE_NONE),
303 socket_(socket.Pass()), 303 socket_(socket.Pass()),
304 query_(query.Pass()), 304 query_(query.Pass()),
305 length_buffer_(new IOBufferWithSize(sizeof(uint16))), 305 length_buffer_(new IOBufferWithSize(sizeof(uint16))),
306 response_length_(0) {} 306 response_length_(0) {}
307 307
308 // DnsAttempt: 308 // DnsAttempt:
309 virtual int Start(const CompletionCallback& callback) OVERRIDE { 309 virtual int Start(const CompletionCallback& callback) override {
310 DCHECK_EQ(STATE_NONE, next_state_); 310 DCHECK_EQ(STATE_NONE, next_state_);
311 callback_ = callback; 311 callback_ = callback;
312 start_time_ = base::TimeTicks::Now(); 312 start_time_ = base::TimeTicks::Now();
313 next_state_ = STATE_CONNECT_COMPLETE; 313 next_state_ = STATE_CONNECT_COMPLETE;
314 int rv = socket_->Connect(base::Bind(&DnsTCPAttempt::OnIOComplete, 314 int rv = socket_->Connect(base::Bind(&DnsTCPAttempt::OnIOComplete,
315 base::Unretained(this))); 315 base::Unretained(this)));
316 if (rv == ERR_IO_PENDING) { 316 if (rv == ERR_IO_PENDING) {
317 set_result(rv); 317 set_result(rv);
318 return rv; 318 return rv;
319 } 319 }
320 return DoLoop(rv); 320 return DoLoop(rv);
321 } 321 }
322 322
323 virtual const DnsQuery* GetQuery() const OVERRIDE { 323 virtual const DnsQuery* GetQuery() const override {
324 return query_.get(); 324 return query_.get();
325 } 325 }
326 326
327 virtual const DnsResponse* GetResponse() const OVERRIDE { 327 virtual const DnsResponse* GetResponse() const override {
328 const DnsResponse* resp = response_.get(); 328 const DnsResponse* resp = response_.get();
329 return (resp != NULL && resp->IsValid()) ? resp : NULL; 329 return (resp != NULL && resp->IsValid()) ? resp : NULL;
330 } 330 }
331 331
332 virtual const BoundNetLog& GetSocketNetLog() const OVERRIDE { 332 virtual const BoundNetLog& GetSocketNetLog() const override {
333 return socket_->NetLog(); 333 return socket_->NetLog();
334 } 334 }
335 335
336 private: 336 private:
337 enum State { 337 enum State {
338 STATE_CONNECT_COMPLETE, 338 STATE_CONNECT_COMPLETE,
339 STATE_SEND_LENGTH, 339 STATE_SEND_LENGTH,
340 STATE_SEND_QUERY, 340 STATE_SEND_QUERY,
341 STATE_READ_LENGTH, 341 STATE_READ_LENGTH,
342 STATE_READ_LENGTH_COMPLETE, 342 STATE_READ_LENGTH_COMPLETE,
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 DCHECK(!IsIPLiteral(hostname_)); 567 DCHECK(!IsIPLiteral(hostname_));
568 } 568 }
569 569
570 virtual ~DnsTransactionImpl() { 570 virtual ~DnsTransactionImpl() {
571 if (!callback_.is_null()) { 571 if (!callback_.is_null()) {
572 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_DNS_TRANSACTION, 572 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_DNS_TRANSACTION,
573 ERR_ABORTED); 573 ERR_ABORTED);
574 } // otherwise logged in DoCallback or Start 574 } // otherwise logged in DoCallback or Start
575 } 575 }
576 576
577 virtual const std::string& GetHostname() const OVERRIDE { 577 virtual const std::string& GetHostname() const override {
578 DCHECK(CalledOnValidThread()); 578 DCHECK(CalledOnValidThread());
579 return hostname_; 579 return hostname_;
580 } 580 }
581 581
582 virtual uint16 GetType() const OVERRIDE { 582 virtual uint16 GetType() const override {
583 DCHECK(CalledOnValidThread()); 583 DCHECK(CalledOnValidThread());
584 return qtype_; 584 return qtype_;
585 } 585 }
586 586
587 virtual void Start() OVERRIDE { 587 virtual void Start() override {
588 DCHECK(!callback_.is_null()); 588 DCHECK(!callback_.is_null());
589 DCHECK(attempts_.empty()); 589 DCHECK(attempts_.empty());
590 net_log_.BeginEvent(NetLog::TYPE_DNS_TRANSACTION, 590 net_log_.BeginEvent(NetLog::TYPE_DNS_TRANSACTION,
591 base::Bind(&NetLogStartCallback, &hostname_, qtype_)); 591 base::Bind(&NetLogStartCallback, &hostname_, qtype_));
592 AttemptResult result(PrepareSearch(), NULL); 592 AttemptResult result(PrepareSearch(), NULL);
593 if (result.rv == OK) { 593 if (result.rv == OK) {
594 qnames_initial_size_ = qnames_.size(); 594 qnames_initial_size_ = qnames_.size();
595 if (qtype_ == dns_protocol::kTypeA) 595 if (qtype_ == dns_protocol::kTypeA)
596 UMA_HISTOGRAM_COUNTS("AsyncDNS.SuffixSearchStart", qnames_.size()); 596 UMA_HISTOGRAM_COUNTS("AsyncDNS.SuffixSearchStart", qnames_.size());
597 result = ProcessAttemptResult(StartQuery()); 597 result = ProcessAttemptResult(StartQuery());
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 class DnsTransactionFactoryImpl : public DnsTransactionFactory { 965 class DnsTransactionFactoryImpl : public DnsTransactionFactory {
966 public: 966 public:
967 explicit DnsTransactionFactoryImpl(DnsSession* session) { 967 explicit DnsTransactionFactoryImpl(DnsSession* session) {
968 session_ = session; 968 session_ = session;
969 } 969 }
970 970
971 virtual scoped_ptr<DnsTransaction> CreateTransaction( 971 virtual scoped_ptr<DnsTransaction> CreateTransaction(
972 const std::string& hostname, 972 const std::string& hostname,
973 uint16 qtype, 973 uint16 qtype,
974 const CallbackType& callback, 974 const CallbackType& callback,
975 const BoundNetLog& net_log) OVERRIDE { 975 const BoundNetLog& net_log) override {
976 return scoped_ptr<DnsTransaction>(new DnsTransactionImpl( 976 return scoped_ptr<DnsTransaction>(new DnsTransactionImpl(
977 session_.get(), hostname, qtype, callback, net_log)); 977 session_.get(), hostname, qtype, callback, net_log));
978 } 978 }
979 979
980 private: 980 private:
981 scoped_refptr<DnsSession> session_; 981 scoped_refptr<DnsSession> session_;
982 }; 982 };
983 983
984 } // namespace 984 } // namespace
985 985
986 // static 986 // static
987 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory( 987 scoped_ptr<DnsTransactionFactory> DnsTransactionFactory::CreateFactory(
988 DnsSession* session) { 988 DnsSession* session) {
989 return scoped_ptr<DnsTransactionFactory>( 989 return scoped_ptr<DnsTransactionFactory>(
990 new DnsTransactionFactoryImpl(session)); 990 new DnsTransactionFactoryImpl(session));
991 } 991 }
992 992
993 } // namespace net 993 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/dns_test_util.cc ('k') | net/dns/dns_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698