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/threading/thread.h" | 7 #include "base/threading/thread.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "net/base/address_list.h" | 9 #include "net/base/address_list.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // has been received. The resolve requests it receives will never be completed. | 25 // has been received. The resolve requests it receives will never be completed. |
26 class BlockableHostResolver : public HostResolver { | 26 class BlockableHostResolver : public HostResolver { |
27 public: | 27 public: |
28 BlockableHostResolver() | 28 BlockableHostResolver() |
29 : event_(true, false), | 29 : event_(true, false), |
30 was_request_cancelled_(false) { | 30 was_request_cancelled_(false) { |
31 } | 31 } |
32 | 32 |
33 virtual int Resolve(const RequestInfo& info, | 33 virtual int Resolve(const RequestInfo& info, |
34 AddressList* addresses, | 34 AddressList* addresses, |
35 OldCompletionCallback* callback, | 35 const CompletionCallback& callback, |
36 RequestHandle* out_req, | 36 RequestHandle* out_req, |
37 const BoundNetLog& net_log) OVERRIDE { | 37 const BoundNetLog& net_log) OVERRIDE { |
38 EXPECT_TRUE(callback); | 38 EXPECT_FALSE(callback.is_null()); |
39 EXPECT_TRUE(out_req); | 39 EXPECT_TRUE(out_req); |
40 *out_req = reinterpret_cast<RequestHandle*>(1); // Magic value. | 40 *out_req = reinterpret_cast<RequestHandle*>(1); // Magic value. |
41 | 41 |
42 // Indicate to the caller that a request was received. | 42 // Indicate to the caller that a request was received. |
43 event_.Signal(); | 43 event_.Signal(); |
44 | 44 |
45 // We return ERR_IO_PENDING, as this request will NEVER be completed. | 45 // We return ERR_IO_PENDING, as this request will NEVER be completed. |
46 // Expectation is for the caller to later cancel the request. | 46 // Expectation is for the caller to later cancel the request. |
47 return ERR_IO_PENDING; | 47 return ERR_IO_PENDING; |
48 } | 48 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // stop the IOThread, which will in turn delete the | 234 // stop the IOThread, which will in turn delete the |
235 // SingleThreadedProxyResolver, which in turn will stop its internal | 235 // SingleThreadedProxyResolver, which in turn will stop its internal |
236 // PAC thread (which is currently blocked waiting on the host resolve which | 236 // PAC thread (which is currently blocked waiting on the host resolve which |
237 // is running on IOThread). The IOThread::Cleanup() will verify that after | 237 // is running on IOThread). The IOThread::Cleanup() will verify that after |
238 // the PAC thread is stopped, it cancels the request on the HostResolver. | 238 // the PAC thread is stopped, it cancels the request on the HostResolver. |
239 } | 239 } |
240 | 240 |
241 } // namespace | 241 } // namespace |
242 | 242 |
243 } // namespace net | 243 } // namespace net |
OLD | NEW |