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

Side by Side Diff: net/proxy/sync_host_resolver_bridge.h

Issue 2945004: Revert 51877, since SpdyNetworkTransactionTest.CorruptFrameSessionError start... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 5 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef NET_PROXY_SYNC_HOST_RESOLVER_BRIDGE_H_ 5 #ifndef NET_PROXY_SYNC_HOST_RESOLVER_BRIDGE_H_
6 #define NET_PROXY_SYNC_HOST_RESOLVER_BRIDGE_H_ 6 #define NET_PROXY_SYNC_HOST_RESOLVER_BRIDGE_H_
7 7
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "net/base/host_resolver.h" 9 #include "net/base/host_resolver.h"
10 #include "net/proxy/single_threaded_proxy_resolver.h"
10 11
11 class MessageLoop; 12 class MessageLoop;
12 13
13 namespace net { 14 namespace net {
14 15
15 // Wrapper around HostResolver to give a sync API while running the resolver 16 // Wrapper around HostResolver to give a sync API while running the resolver
16 // in async mode on |host_resolver_loop|. 17 // in async mode on |host_resolver_loop|.
17 class SyncHostResolverBridge : public HostResolver { 18 class SyncHostResolverBridge : public HostResolver {
18 public: 19 public:
19 SyncHostResolverBridge(HostResolver* host_resolver, 20 SyncHostResolverBridge(HostResolver* host_resolver,
20 MessageLoop* host_resolver_loop); 21 MessageLoop* host_resolver_loop);
21 22
22 virtual ~SyncHostResolverBridge(); 23 virtual ~SyncHostResolverBridge();
23 24
24 // HostResolver methods: 25 // HostResolver methods:
25 virtual int Resolve(const RequestInfo& info, 26 virtual int Resolve(const RequestInfo& info,
26 AddressList* addresses, 27 AddressList* addresses,
27 CompletionCallback* callback, 28 CompletionCallback* callback,
28 RequestHandle* out_req, 29 RequestHandle* out_req,
29 const BoundNetLog& net_log); 30 const BoundNetLog& net_log);
30 virtual void CancelRequest(RequestHandle req); 31 virtual void CancelRequest(RequestHandle req);
31 virtual void AddObserver(Observer* observer); 32 virtual void AddObserver(Observer* observer);
32 virtual void RemoveObserver(Observer* observer); 33 virtual void RemoveObserver(Observer* observer);
33 34
34 // The Shutdown() method should be called prior to destruction, from 35 // The Shutdown() method should be called prior to destruction, from
35 // |host_resolver_loop_|. It aborts any in progress synchronous resolves, to 36 // |host_resolver_loop_|. It aborts any in progress synchronous resolves, to
36 // prevent deadlocks from happening. 37 // prevent deadlocks from happening.
37 virtual void Shutdown(); 38 void Shutdown();
38 39
39 private: 40 private:
40 class Core; 41 class Core;
41 42
42 MessageLoop* const host_resolver_loop_; 43 MessageLoop* const host_resolver_loop_;
43 scoped_refptr<Core> core_; 44 scoped_refptr<Core> core_;
44 }; 45 };
45 46
47 // Subclass of SingleThreadedProxyResolver that additionally calls
48 // |bridged_host_resolver_->Shutdown()| during its destructor.
49 class SingleThreadedProxyResolverUsingBridgedHostResolver
50 : public SingleThreadedProxyResolver {
51 public:
52 SingleThreadedProxyResolverUsingBridgedHostResolver(
53 ProxyResolver* proxy_resolver,
54 SyncHostResolverBridge* bridged_host_resolver);
55
56 virtual ~SingleThreadedProxyResolverUsingBridgedHostResolver();
57
58 private:
59 scoped_refptr<SyncHostResolverBridge> bridged_host_resolver_;
60 };
61
62
46 } // namespace net 63 } // namespace net
47 64
48 #endif // NET_PROXY_SYNC_HOST_RESOLVER_BRIDGE_H_ 65 #endif // NET_PROXY_SYNC_HOST_RESOLVER_BRIDGE_H_
OLDNEW
« no previous file with comments | « net/proxy/single_threaded_proxy_resolver_unittest.cc ('k') | net/proxy/sync_host_resolver_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698