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

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

Issue 2351513002: net: rename BoundNetLog to NetLogWithSource (Closed)
Patch Set: one more fix, content bound_net_log_ Created 4 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/host_resolver_mojo.h" 5 #include "net/dns/host_resolver_mojo.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "mojo/public/cpp/bindings/binding.h" 10 #include "mojo/public/cpp/bindings/binding.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 host_cache_weak_factory_(host_cache_.get()) { 70 host_cache_weak_factory_(host_cache_.get()) {
71 } 71 }
72 72
73 HostResolverMojo::~HostResolverMojo() = default; 73 HostResolverMojo::~HostResolverMojo() = default;
74 74
75 int HostResolverMojo::Resolve(const RequestInfo& info, 75 int HostResolverMojo::Resolve(const RequestInfo& info,
76 RequestPriority priority, 76 RequestPriority priority,
77 AddressList* addresses, 77 AddressList* addresses,
78 const CompletionCallback& callback, 78 const CompletionCallback& callback,
79 std::unique_ptr<Request>* request, 79 std::unique_ptr<Request>* request,
80 const BoundNetLog& source_net_log) { 80 const NetLogWithSource& source_net_log) {
81 DCHECK(thread_checker_.CalledOnValidThread()); 81 DCHECK(thread_checker_.CalledOnValidThread());
82 DCHECK(request); 82 DCHECK(request);
83 DVLOG(1) << "Resolve " << info.host_port_pair().ToString(); 83 DVLOG(1) << "Resolve " << info.host_port_pair().ToString();
84 84
85 HostCache::Key key = CacheKeyForRequest(info); 85 HostCache::Key key = CacheKeyForRequest(info);
86 int cached_result = ResolveFromCacheInternal(info, key, addresses); 86 int cached_result = ResolveFromCacheInternal(info, key, addresses);
87 if (cached_result != ERR_DNS_CACHE_MISS) { 87 if (cached_result != ERR_DNS_CACHE_MISS) {
88 DVLOG(1) << "Resolved " << info.host_port_pair().ToString() 88 DVLOG(1) << "Resolved " << info.host_port_pair().ToString()
89 << " from cache"; 89 << " from cache";
90 return cached_result; 90 return cached_result;
91 } 91 }
92 92
93 interfaces::HostResolverRequestClientPtr handle; 93 interfaces::HostResolverRequestClientPtr handle;
94 std::unique_ptr<Job> job(new Job(key, addresses, callback, 94 std::unique_ptr<Job> job(new Job(key, addresses, callback,
95 mojo::GetProxy(&handle), 95 mojo::GetProxy(&handle),
96 host_cache_weak_factory_.GetWeakPtr())); 96 host_cache_weak_factory_.GetWeakPtr()));
97 request->reset(new RequestImpl(std::move(job))); 97 request->reset(new RequestImpl(std::move(job)));
98 98
99 impl_->ResolveDns(interfaces::HostResolverRequestInfo::From(info), 99 impl_->ResolveDns(interfaces::HostResolverRequestInfo::From(info),
100 std::move(handle)); 100 std::move(handle));
101 return ERR_IO_PENDING; 101 return ERR_IO_PENDING;
102 } 102 }
103 103
104 int HostResolverMojo::ResolveFromCache(const RequestInfo& info, 104 int HostResolverMojo::ResolveFromCache(const RequestInfo& info,
105 AddressList* addresses, 105 AddressList* addresses,
106 const BoundNetLog& source_net_log) { 106 const NetLogWithSource& source_net_log) {
107 DCHECK(thread_checker_.CalledOnValidThread()); 107 DCHECK(thread_checker_.CalledOnValidThread());
108 DVLOG(1) << "ResolveFromCache " << info.host_port_pair().ToString(); 108 DVLOG(1) << "ResolveFromCache " << info.host_port_pair().ToString();
109 return ResolveFromCacheInternal(info, CacheKeyForRequest(info), addresses); 109 return ResolveFromCacheInternal(info, CacheKeyForRequest(info), addresses);
110 } 110 }
111 111
112 HostCache* HostResolverMojo::GetHostCache() { 112 HostCache* HostResolverMojo::GetHostCache() {
113 return host_cache_.get(); 113 return host_cache_.get();
114 } 114 }
115 115
116 int HostResolverMojo::ResolveFromCacheInternal(const RequestInfo& info, 116 int HostResolverMojo::ResolveFromCacheInternal(const RequestInfo& info,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 if (binding_.is_bound()) 157 if (binding_.is_bound())
158 binding_.Close(); 158 binding_.Close();
159 base::ResetAndReturn(&callback_).Run(error); 159 base::ResetAndReturn(&callback_).Run(error);
160 } 160 }
161 161
162 void HostResolverMojo::Job::OnConnectionError() { 162 void HostResolverMojo::Job::OnConnectionError() {
163 ReportResult(ERR_FAILED, interfaces::AddressListPtr()); 163 ReportResult(ERR_FAILED, interfaces::AddressListPtr());
164 } 164 }
165 165
166 } // namespace net 166 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698