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

Side by Side Diff: net/base/host_resolver.h

Issue 848006: Generalize the net module's LoadLog facility from a passive container, to an event stream (NetLog). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Split up RequestTracker into ConnectJobTracker+RequestTracker+RequestTrackerBase, address comments Created 10 years, 9 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 | « chrome/chrome_tests.gypi ('k') | net/base/host_resolver.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_BASE_HOST_RESOLVER_H_ 5 #ifndef NET_BASE_HOST_RESOLVER_H_
6 #define NET_BASE_HOST_RESOLVER_H_ 6 #define NET_BASE_HOST_RESOLVER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
11 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
12 #include "net/base/address_family.h" 12 #include "net/base/address_family.h"
13 #include "net/base/completion_callback.h" 13 #include "net/base/completion_callback.h"
14 #include "net/base/request_priority.h" 14 #include "net/base/request_priority.h"
15 15
16 class MessageLoop; 16 class MessageLoop;
17 17
18 namespace net { 18 namespace net {
19 19
20 class AddressList; 20 class AddressList;
21 class BoundNetLog;
21 class HostCache; 22 class HostCache;
22 class HostResolverImpl; 23 class HostResolverImpl;
23 class LoadLog;
24 class NetworkChangeNotifier; 24 class NetworkChangeNotifier;
25 25
26 // This class represents the task of resolving hostnames (or IP address 26 // This class represents the task of resolving hostnames (or IP address
27 // literal) to an AddressList object. 27 // literal) to an AddressList object.
28 // 28 //
29 // HostResolver can handle multiple requests at a time, so when cancelling a 29 // HostResolver can handle multiple requests at a time, so when cancelling a
30 // request the RequestHandle that was returned by Resolve() needs to be 30 // request the RequestHandle that was returned by Resolve() needs to be
31 // given. A simpler alternative for consumers that only have 1 outstanding 31 // given. A simpler alternative for consumers that only have 1 outstanding
32 // request at a time is to create a SingleRequestHostResolver wrapper around 32 // request at a time is to create a SingleRequestHostResolver wrapper around
33 // HostResolver (which will automatically cancel the single request when it 33 // HostResolver (which will automatically cancel the single request when it
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // 130 //
131 // When callback is non-null, the operation may be performed asynchronously. 131 // When callback is non-null, the operation may be performed asynchronously.
132 // If the operation cannnot be completed synchronously, ERR_IO_PENDING will 132 // If the operation cannnot be completed synchronously, ERR_IO_PENDING will
133 // be returned and the real result code will be passed to the completion 133 // be returned and the real result code will be passed to the completion
134 // callback. Otherwise the result code is returned immediately from this 134 // callback. Otherwise the result code is returned immediately from this
135 // call. 135 // call.
136 // If |out_req| is non-NULL, then |*out_req| will be filled with a handle to 136 // If |out_req| is non-NULL, then |*out_req| will be filled with a handle to
137 // the async request. This handle is not valid after the request has 137 // the async request. This handle is not valid after the request has
138 // completed. 138 // completed.
139 // 139 //
140 // Profiling information for the request is saved to |load_log| if non-NULL. 140 // Profiling information for the request is saved to |net_log| if non-NULL.
141 virtual int Resolve(const RequestInfo& info, 141 virtual int Resolve(const RequestInfo& info,
142 AddressList* addresses, 142 AddressList* addresses,
143 CompletionCallback* callback, 143 CompletionCallback* callback,
144 RequestHandle* out_req, 144 RequestHandle* out_req,
145 LoadLog* load_log) = 0; 145 const BoundNetLog& net_log) = 0;
146 146
147 // Cancels the specified request. |req| is the handle returned by Resolve(). 147 // Cancels the specified request. |req| is the handle returned by Resolve().
148 // After a request is cancelled, its completion callback will not be called. 148 // After a request is cancelled, its completion callback will not be called.
149 virtual void CancelRequest(RequestHandle req) = 0; 149 virtual void CancelRequest(RequestHandle req) = 0;
150 150
151 // Adds an observer to this resolver. The observer will be notified of the 151 // Adds an observer to this resolver. The observer will be notified of the
152 // start and completion of all requests (excluding cancellation). |observer| 152 // start and completion of all requests (excluding cancellation). |observer|
153 // must remain valid for the duration of this HostResolver's lifetime. 153 // must remain valid for the duration of this HostResolver's lifetime.
154 virtual void AddObserver(Observer* observer) = 0; 154 virtual void AddObserver(Observer* observer) = 0;
155 155
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // If a completion callback is pending when the resolver is destroyed, the 191 // If a completion callback is pending when the resolver is destroyed, the
192 // host resolution is cancelled, and the completion callback will not be 192 // host resolution is cancelled, and the completion callback will not be
193 // called. 193 // called.
194 ~SingleRequestHostResolver(); 194 ~SingleRequestHostResolver();
195 195
196 // Resolves the given hostname (or IP address literal), filling out the 196 // Resolves the given hostname (or IP address literal), filling out the
197 // |addresses| object upon success. See HostResolver::Resolve() for details. 197 // |addresses| object upon success. See HostResolver::Resolve() for details.
198 int Resolve(const HostResolver::RequestInfo& info, 198 int Resolve(const HostResolver::RequestInfo& info,
199 AddressList* addresses, 199 AddressList* addresses,
200 CompletionCallback* callback, 200 CompletionCallback* callback,
201 LoadLog* load_log); 201 const BoundNetLog& net_log);
202 202
203 // Cancels the in-progress request, if any. This prevents the callback 203 // Cancels the in-progress request, if any. This prevents the callback
204 // from being invoked. Resolve() can be called again after cancelling. 204 // from being invoked. Resolve() can be called again after cancelling.
205 void Cancel(); 205 void Cancel();
206 206
207 private: 207 private:
208 // Callback for when the request to |resolver_| completes, so we dispatch 208 // Callback for when the request to |resolver_| completes, so we dispatch
209 // to the user's callback. 209 // to the user's callback.
210 void OnResolveCompletion(int result); 210 void OnResolveCompletion(int result);
211 211
(...skipping 14 matching lines...) Expand all
226 // (Except if a unit-test has changed the global HostResolverProc using 226 // (Except if a unit-test has changed the global HostResolverProc using
227 // ScopedHostResolverProc to intercept requests to the system). 227 // ScopedHostResolverProc to intercept requests to the system).
228 // |network_change_notifier| must outlive HostResolver. It can optionally be 228 // |network_change_notifier| must outlive HostResolver. It can optionally be
229 // NULL, in which case HostResolver will not respond to network changes. 229 // NULL, in which case HostResolver will not respond to network changes.
230 HostResolver* CreateSystemHostResolver( 230 HostResolver* CreateSystemHostResolver(
231 NetworkChangeNotifier* network_change_notifier); 231 NetworkChangeNotifier* network_change_notifier);
232 232
233 } // namespace net 233 } // namespace net
234 234
235 #endif // NET_BASE_HOST_RESOLVER_H_ 235 #endif // NET_BASE_HOST_RESOLVER_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | net/base/host_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698