| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <ws2tcpip.h> | 8 #include <ws2tcpip.h> |
| 9 #else | 9 #else |
| 10 #include <netdb.h> | 10 #include <netdb.h> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // Otherwise start an async resolve on the resolver's thread. | 54 // Otherwise start an async resolve on the resolver's thread. |
| 55 host_resolver_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, | 55 host_resolver_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, |
| 56 &SyncHostResolverBridge::StartResolve, info, addresses)); | 56 &SyncHostResolverBridge::StartResolve, info, addresses)); |
| 57 | 57 |
| 58 // Wait for the resolve to complete in the resolver's thread. | 58 // Wait for the resolve to complete in the resolver's thread. |
| 59 event_.Wait(); | 59 event_.Wait(); |
| 60 return err_; | 60 return err_; |
| 61 } | 61 } |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 friend class base::RefCountedThreadSafe<SyncHostResolverBridge>; |
| 65 |
| 66 ~SyncHostResolverBridge() {} |
| 67 |
| 64 // Called on host_resolver_loop_. | 68 // Called on host_resolver_loop_. |
| 65 void StartResolve(const HostResolver::RequestInfo& info, | 69 void StartResolve(const HostResolver::RequestInfo& info, |
| 66 net::AddressList* addresses) { | 70 net::AddressList* addresses) { |
| 67 DCHECK_EQ(host_resolver_loop_, MessageLoop::current()); | 71 DCHECK_EQ(host_resolver_loop_, MessageLoop::current()); |
| 68 int error = host_resolver_->Resolve( | 72 int error = host_resolver_->Resolve( |
| 69 info, addresses, &callback_, NULL, NULL); | 73 info, addresses, &callback_, NULL, NULL); |
| 70 if (error != ERR_IO_PENDING) | 74 if (error != ERR_IO_PENDING) |
| 71 OnResolveCompletion(error); // Completed synchronously. | 75 OnResolveCompletion(error); // Completed synchronously. |
| 72 } | 76 } |
| 73 | 77 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 184 |
| 181 } // namespace | 185 } // namespace |
| 182 | 186 |
| 183 // static | 187 // static |
| 184 ProxyResolverJSBindings* ProxyResolverJSBindings::CreateDefault( | 188 ProxyResolverJSBindings* ProxyResolverJSBindings::CreateDefault( |
| 185 HostResolver* host_resolver, MessageLoop* host_resolver_loop) { | 189 HostResolver* host_resolver, MessageLoop* host_resolver_loop) { |
| 186 return new DefaultJSBindings(host_resolver, host_resolver_loop); | 190 return new DefaultJSBindings(host_resolver, host_resolver_loop); |
| 187 } | 191 } |
| 188 | 192 |
| 189 } // namespace net | 193 } // namespace net |
| OLD | NEW |