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

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

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 | « net/base/host_resolver.h ('k') | net/base/host_resolver_impl.h » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/base/host_resolver.h" 5 #include "net/base/host_resolver.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 10
11 namespace net { 11 namespace net {
12 12
13 SingleRequestHostResolver::SingleRequestHostResolver(HostResolver* resolver) 13 SingleRequestHostResolver::SingleRequestHostResolver(HostResolver* resolver)
14 : resolver_(resolver), 14 : resolver_(resolver),
15 cur_request_(NULL), 15 cur_request_(NULL),
16 cur_request_callback_(NULL), 16 cur_request_callback_(NULL),
17 ALLOW_THIS_IN_INITIALIZER_LIST( 17 ALLOW_THIS_IN_INITIALIZER_LIST(
18 callback_(this, &SingleRequestHostResolver::OnResolveCompletion)) { 18 callback_(this, &SingleRequestHostResolver::OnResolveCompletion)) {
19 DCHECK(resolver_ != NULL); 19 DCHECK(resolver_ != NULL);
20 } 20 }
21 21
22 SingleRequestHostResolver::~SingleRequestHostResolver() { 22 SingleRequestHostResolver::~SingleRequestHostResolver() {
23 Cancel(); 23 Cancel();
24 } 24 }
25 25
26 int SingleRequestHostResolver::Resolve(const HostResolver::RequestInfo& info, 26 int SingleRequestHostResolver::Resolve(const HostResolver::RequestInfo& info,
27 AddressList* addresses, 27 AddressList* addresses,
28 CompletionCallback* callback, 28 CompletionCallback* callback,
29 LoadLog* load_log) { 29 const BoundNetLog& net_log) {
30 DCHECK(!cur_request_ && !cur_request_callback_) << "resolver already in use"; 30 DCHECK(!cur_request_ && !cur_request_callback_) << "resolver already in use";
31 31
32 HostResolver::RequestHandle request = NULL; 32 HostResolver::RequestHandle request = NULL;
33 33
34 // We need to be notified of completion before |callback| is called, so that 34 // We need to be notified of completion before |callback| is called, so that
35 // we can clear out |cur_request_*|. 35 // we can clear out |cur_request_*|.
36 CompletionCallback* transient_callback = callback ? &callback_ : NULL; 36 CompletionCallback* transient_callback = callback ? &callback_ : NULL;
37 37
38 int rv = resolver_->Resolve( 38 int rv = resolver_->Resolve(
39 info, addresses, transient_callback, &request, load_log); 39 info, addresses, transient_callback, &request, net_log);
40 40
41 if (rv == ERR_IO_PENDING) { 41 if (rv == ERR_IO_PENDING) {
42 // Cleared in OnResolveCompletion(). 42 // Cleared in OnResolveCompletion().
43 cur_request_ = request; 43 cur_request_ = request;
44 cur_request_callback_ = callback; 44 cur_request_callback_ = callback;
45 } 45 }
46 46
47 return rv; 47 return rv;
48 } 48 }
49 49
(...skipping 11 matching lines...) Expand all
61 61
62 // Clear the outstanding request information. 62 // Clear the outstanding request information.
63 cur_request_ = NULL; 63 cur_request_ = NULL;
64 cur_request_callback_ = NULL; 64 cur_request_callback_ = NULL;
65 65
66 // Call the user's original callback. 66 // Call the user's original callback.
67 callback->Run(result); 67 callback->Run(result);
68 } 68 }
69 69
70 } // namespace net 70 } // namespace net
OLDNEW
« no previous file with comments | « net/base/host_resolver.h ('k') | net/base/host_resolver_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698