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

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

Issue 9113022: Adds PriorityQueue and PrioritizedDispatcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Applied review. Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef NET_DNS_DNS_TRANSACTION_H_ 5 #ifndef NET_DNS_DNS_TRANSACTION_H_
6 #define NET_DNS_DNS_TRANSACTION_H_ 6 #define NET_DNS_DNS_TRANSACTION_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 const base::StringPiece& qname, 42 const base::StringPiece& qname,
43 uint16 qtype, 43 uint16 qtype,
44 const ResultCallback& callback, 44 const ResultCallback& callback,
45 const BoundNetLog& source_net_log); 45 const BoundNetLog& source_net_log);
46 ~DnsTransaction(); 46 ~DnsTransaction();
47 47
48 const DnsQuery* query() const { return query_.get(); } 48 const DnsQuery* query() const { return query_.get(); }
49 49
50 const DnsResponse* response() const { return response_.get(); } 50 const DnsResponse* response() const { return response_.get(); }
51 51
52 // Starts the resolution process. Will return ERR_IO_PENDING and will 52 // Starts the resolution process. Will return ERR_IO_PENDING and will notify
53 // notify the caller via |delegate|. Should only be called once. 53 // the caller via |delegate|, except when failing synchronously. Should only
54 // be called once.
54 int Start(); 55 int Start();
55 56
56 private: 57 private:
57 enum State { 58 enum State {
58 STATE_CONNECT, 59 STATE_CONNECT,
59 STATE_CONNECT_COMPLETE, 60 STATE_CONNECT_COMPLETE,
60 STATE_SEND_QUERY, 61 STATE_SEND_QUERY,
61 STATE_SEND_QUERY_COMPLETE, 62 STATE_SEND_QUERY_COMPLETE,
62 STATE_READ_RESPONSE, 63 STATE_READ_RESPONSE,
63 STATE_READ_RESPONSE_COMPLETE, 64 STATE_READ_RESPONSE_COMPLETE,
64 STATE_NONE, 65 STATE_NONE,
65 }; 66 };
66 67
68 struct Attempt {
69 scoped_ptr<DnsQuery> query_;
70 scoped_ptr<DnsResponse> response_;
71 scoped_ptr<DatagramClientSocket> socket_;
72 };
73
67 int DoLoop(int result); 74 int DoLoop(int result);
68 void DoCallback(int result); 75 void DoCallback(int result);
69 void OnIOComplete(int result); 76 void OnIOComplete(int result);
70 77
71 int DoConnect(); 78 int DoConnect();
72 int DoConnectComplete(int result); 79 int DoConnectComplete(int result);
73 int DoSendQuery(); 80 int DoSendQuery();
74 int DoSendQueryComplete(int result); 81 int DoSendQueryComplete(int result);
75 int DoReadResponse(); 82 int DoReadResponse();
76 int DoReadResponseComplete(int result); 83 int DoReadResponseComplete(int result);
(...skipping 18 matching lines...) Expand all
95 base::OneShotTimer<DnsTransaction> timer_; 102 base::OneShotTimer<DnsTransaction> timer_;
96 103
97 BoundNetLog net_log_; 104 BoundNetLog net_log_;
98 105
99 DISALLOW_COPY_AND_ASSIGN(DnsTransaction); 106 DISALLOW_COPY_AND_ASSIGN(DnsTransaction);
100 }; 107 };
101 108
102 } // namespace net 109 } // namespace net
103 110
104 #endif // NET_DNS_DNS_TRANSACTION_H_ 111 #endif // NET_DNS_DNS_TRANSACTION_H_
OLDNEW
« net/base/priority_queue.h ('K') | « net/dns/dns_query.h ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698