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

Side by Side Diff: chrome/browser/net/dns_master.cc

Issue 125107: * Move the global "DnsResolutionObserver" code depended on by DNS prefetcher,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Address jar's comments Created 11 years, 6 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/browser/net/dns_global.cc ('k') | chrome/browser/net/dns_master_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) 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 "chrome/browser/net/dns_master.h" 5 #include "chrome/browser/net/dns_master.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 17 matching lines...) Expand all
28 net::HostResolver* host_resolver, 28 net::HostResolver* host_resolver,
29 const std::string& hostname) 29 const std::string& hostname)
30 : ALLOW_THIS_IN_INITIALIZER_LIST( 30 : ALLOW_THIS_IN_INITIALIZER_LIST(
31 net_callback_(this, &LookupRequest::OnLookupFinished)), 31 net_callback_(this, &LookupRequest::OnLookupFinished)),
32 master_(master), 32 master_(master),
33 hostname_(hostname), 33 hostname_(hostname),
34 resolver_(host_resolver) { 34 resolver_(host_resolver) {
35 } 35 }
36 36
37 bool Start() { 37 bool Start() {
38 const int result = resolver_.Resolve(hostname_, 80, &addresses_, 38 // Port doesn't really matter.
39 &net_callback_); 39 net::HostResolver::RequestInfo resolve_info(hostname_, 80);
40
41 // Make a note that this is a speculative resolve request. This allows us
42 // to separate it from real navigations in the observer's callback, and
43 // lets the HostResolver know it can de-prioritize it.
44 resolve_info.set_is_speculative(true);
45
46 const int result = resolver_.Resolve(
47 resolve_info, &addresses_, &net_callback_);
40 return (result == net::ERR_IO_PENDING); 48 return (result == net::ERR_IO_PENDING);
41 } 49 }
42 50
43 private: 51 private:
44 void OnLookupFinished(int result) { 52 void OnLookupFinished(int result) {
45 master_->OnLookupFinished(this, hostname_, result == net::OK); 53 master_->OnLookupFinished(this, hostname_, result == net::OK);
46 } 54 }
47 55
48 // HostResolver will call us using this callback when resolution is complete. 56 // HostResolver will call us using this callback when resolution is complete.
49 net::CompletionCallbackImpl<LookupRequest> net_callback_; 57 net::CompletionCallbackImpl<LookupRequest> net_callback_;
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 std::string hostname(rush_queue_.front()); 599 std::string hostname(rush_queue_.front());
592 rush_queue_.pop(); 600 rush_queue_.pop();
593 return hostname; 601 return hostname;
594 } 602 }
595 std::string hostname(background_queue_.front()); 603 std::string hostname(background_queue_.front());
596 background_queue_.pop(); 604 background_queue_.pop();
597 return hostname; 605 return hostname;
598 } 606 }
599 607
600 } // namespace chrome_browser_net 608 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/net/dns_global.cc ('k') | chrome/browser/net/dns_master_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698