1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_PROXY_SYNC_HOST_RESOLVER_BRIDGE_H_
6 #define NET_PROXY_SYNC_HOST_RESOLVER_BRIDGE_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h"
10 #include "net/proxy/sync_host_resolver.h"
16 // Wrapper around HostResolver to give a sync API while running the resolver
17 // in async mode on |host_resolver_loop|.
18 class NET_EXPORT_PRIVATE SyncHostResolverBridge
: public SyncHostResolver
{
20 SyncHostResolverBridge(HostResolver
* host_resolver
,
21 MessageLoop
* host_resolver_loop
);
23 virtual ~SyncHostResolverBridge();
25 // SyncHostResolver methods:
26 virtual int Resolve(const HostResolver::RequestInfo
& info
,
27 AddressList
* addresses
,
28 const BoundNetLog
& net_log
) OVERRIDE
;
30 // The Shutdown() method should be called prior to destruction, from
31 // |host_resolver_loop_|. It aborts any in progress synchronous resolves, to
32 // prevent deadlocks from happening.
33 virtual void Shutdown() OVERRIDE
;
38 MessageLoop
* const host_resolver_loop_
;
39 scoped_refptr
<Core
> core_
;
40 DISALLOW_COPY_AND_ASSIGN(SyncHostResolverBridge
);
45 #endif // NET_PROXY_SYNC_HOST_RESOLVER_BRIDGE_H_