OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/dns/dns_api.h" | 5 #include "extensions/browser/api/dns/dns_api.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // Yes, we are passing zero as the port. There are some interesting but not | 52 // Yes, we are passing zero as the port. There are some interesting but not |
53 // presently relevant reasons why HostResolver asks for the port of the | 53 // presently relevant reasons why HostResolver asks for the port of the |
54 // hostname you'd like to resolve, even though it doesn't use that value in | 54 // hostname you'd like to resolve, even though it doesn't use that value in |
55 // determining its answer. | 55 // determining its answer. |
56 net::HostPortPair host_port_pair(hostname_, 0); | 56 net::HostPortPair host_port_pair(hostname_, 0); |
57 | 57 |
58 net::HostResolver::RequestInfo request_info(host_port_pair); | 58 net::HostResolver::RequestInfo request_info(host_port_pair); |
59 int resolve_result = host_resolver->Resolve( | 59 int resolve_result = host_resolver->Resolve( |
60 request_info, net::DEFAULT_PRIORITY, addresses_.get(), | 60 request_info, net::DEFAULT_PRIORITY, addresses_.get(), |
61 base::Bind(&DnsResolveFunction::OnLookupFinished, this), &request_, | 61 base::Bind(&DnsResolveFunction::OnLookupFinished, this), &request_, |
62 net::BoundNetLog()); | 62 net::NetLogWithSource()); |
63 | 63 |
64 // Balanced in OnLookupFinished. | 64 // Balanced in OnLookupFinished. |
65 AddRef(); | 65 AddRef(); |
66 | 66 |
67 if (resolve_result != net::ERR_IO_PENDING) | 67 if (resolve_result != net::ERR_IO_PENDING) |
68 OnLookupFinished(resolve_result); | 68 OnLookupFinished(resolve_result); |
69 } | 69 } |
70 | 70 |
71 void DnsResolveFunction::RespondOnUIThread() { | 71 void DnsResolveFunction::RespondOnUIThread() { |
72 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 72 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 15 matching lines...) Expand all Loading... |
88 bool post_task_result = BrowserThread::PostTask( | 88 bool post_task_result = BrowserThread::PostTask( |
89 BrowserThread::UI, | 89 BrowserThread::UI, |
90 FROM_HERE, | 90 FROM_HERE, |
91 base::Bind(&DnsResolveFunction::RespondOnUIThread, this)); | 91 base::Bind(&DnsResolveFunction::RespondOnUIThread, this)); |
92 DCHECK(post_task_result); | 92 DCHECK(post_task_result); |
93 | 93 |
94 Release(); // Added in WorkOnIOThread(). | 94 Release(); // Added in WorkOnIOThread(). |
95 } | 95 } |
96 | 96 |
97 } // namespace extensions | 97 } // namespace extensions |
OLD | NEW |