OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/proxy/sync_host_resolver_bridge.h" | 5 #include "net/proxy/sync_host_resolver_bridge.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 outstanding_request_(NULL), | 79 outstanding_request_(NULL), |
80 event_(true, false), | 80 event_(true, false), |
81 has_shutdown_(false) {} | 81 has_shutdown_(false) {} |
82 | 82 |
83 int SyncHostResolverBridge::Core::ResolveSynchronously( | 83 int SyncHostResolverBridge::Core::ResolveSynchronously( |
84 const HostResolver::RequestInfo& info, | 84 const HostResolver::RequestInfo& info, |
85 net::AddressList* addresses) { | 85 net::AddressList* addresses) { |
86 // Otherwise start an async resolve on the resolver's thread. | 86 // Otherwise start an async resolve on the resolver's thread. |
87 host_resolver_loop_->PostTask( | 87 host_resolver_loop_->PostTask( |
88 FROM_HERE, | 88 FROM_HERE, |
89 NewRunnableMethod(this, &Core::StartResolve, | 89 base::Bind(&Core::StartResolve, this, info, addresses)); |
90 info, addresses)); | |
91 | 90 |
92 return WaitForResolveCompletion(); | 91 return WaitForResolveCompletion(); |
93 } | 92 } |
94 | 93 |
95 void SyncHostResolverBridge::Core::StartResolve( | 94 void SyncHostResolverBridge::Core::StartResolve( |
96 const HostResolver::RequestInfo& info, | 95 const HostResolver::RequestInfo& info, |
97 net::AddressList* addresses) { | 96 net::AddressList* addresses) { |
98 DCHECK_EQ(MessageLoop::current(), host_resolver_loop_); | 97 DCHECK_EQ(MessageLoop::current(), host_resolver_loop_); |
99 DCHECK(!outstanding_request_); | 98 DCHECK(!outstanding_request_); |
100 | 99 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 AddressList* addresses) { | 162 AddressList* addresses) { |
164 return core_->ResolveSynchronously(info, addresses); | 163 return core_->ResolveSynchronously(info, addresses); |
165 } | 164 } |
166 | 165 |
167 void SyncHostResolverBridge::Shutdown() { | 166 void SyncHostResolverBridge::Shutdown() { |
168 DCHECK_EQ(MessageLoop::current(), host_resolver_loop_); | 167 DCHECK_EQ(MessageLoop::current(), host_resolver_loop_); |
169 core_->Shutdown(); | 168 core_->Shutdown(); |
170 } | 169 } |
171 | 170 |
172 } // namespace net | 171 } // namespace net |
OLD | NEW |