| OLD | NEW |
| 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_BASE_HOST_RESOLVER_PROC_H_ | 5 #ifndef NET_BASE_HOST_RESOLVER_PROC_H_ |
| 6 #define NET_BASE_HOST_RESOLVER_PROC_H_ | 6 #define NET_BASE_HOST_RESOLVER_PROC_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // the HostResolver implementation using them can be multi-threaded. | 23 // the HostResolver implementation using them can be multi-threaded. |
| 24 class HostResolverProc : public base::RefCountedThreadSafe<HostResolverProc> { | 24 class HostResolverProc : public base::RefCountedThreadSafe<HostResolverProc> { |
| 25 public: | 25 public: |
| 26 explicit HostResolverProc(HostResolverProc* previous); | 26 explicit HostResolverProc(HostResolverProc* previous); |
| 27 | 27 |
| 28 // Resolves |host| to an address list, restricting the results to addresses | 28 // Resolves |host| to an address list, restricting the results to addresses |
| 29 // in |address_family|. If successful returns OK and fills |addrlist| with | 29 // in |address_family|. If successful returns OK and fills |addrlist| with |
| 30 // a list of socket addresses. Otherwise returns a network error code. | 30 // a list of socket addresses. Otherwise returns a network error code. |
| 31 virtual int Resolve(const std::string& host, | 31 virtual int Resolve(const std::string& host, |
| 32 AddressFamily address_family, | 32 AddressFamily address_family, |
| 33 HostResolverFlags host_resolver_flags, |
| 33 AddressList* addrlist) = 0; | 34 AddressList* addrlist) = 0; |
| 34 | 35 |
| 35 protected: | 36 protected: |
| 36 friend class base::RefCountedThreadSafe<HostResolverProc>; | 37 friend class base::RefCountedThreadSafe<HostResolverProc>; |
| 37 | 38 |
| 38 virtual ~HostResolverProc() {} | 39 virtual ~HostResolverProc() {} |
| 39 | 40 |
| 40 // Asks the fallback procedure (if set) to do the resolve. | 41 // Asks the fallback procedure (if set) to do the resolve. |
| 41 int ResolveUsingPrevious(const std::string& host, | 42 int ResolveUsingPrevious(const std::string& host, |
| 42 AddressFamily address_family, | 43 AddressFamily address_family, |
| 44 HostResolverFlags host_resolver_flags, |
| 43 AddressList* addrlist); | 45 AddressList* addrlist); |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 friend class HostResolverImpl; | 48 friend class HostResolverImpl; |
| 47 friend class MockHostResolverBase; | 49 friend class MockHostResolverBase; |
| 48 friend class ScopedDefaultHostResolverProc; | 50 friend class ScopedDefaultHostResolverProc; |
| 49 | 51 |
| 50 // Sets the previous procedure in the chain. Aborts if this would result in a | 52 // Sets the previous procedure in the chain. Aborts if this would result in a |
| 51 // cycle. | 53 // cycle. |
| 52 void SetPreviousProc(HostResolverProc* proc); | 54 void SetPreviousProc(HostResolverProc* proc); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 71 | 73 |
| 72 DISALLOW_COPY_AND_ASSIGN(HostResolverProc); | 74 DISALLOW_COPY_AND_ASSIGN(HostResolverProc); |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 // Resolves |host| to an address list, using the system's default host resolver. | 77 // Resolves |host| to an address list, using the system's default host resolver. |
| 76 // (i.e. this calls out to getaddrinfo()). If successful returns OK and fills | 78 // (i.e. this calls out to getaddrinfo()). If successful returns OK and fills |
| 77 // |addrlist| with a list of socket addresses. Otherwise returns a | 79 // |addrlist| with a list of socket addresses. Otherwise returns a |
| 78 // network error code. | 80 // network error code. |
| 79 int SystemHostResolverProc(const std::string& host, | 81 int SystemHostResolverProc(const std::string& host, |
| 80 AddressFamily address_family, | 82 AddressFamily address_family, |
| 83 HostResolverFlags host_resolver_flags, |
| 81 AddressList* addrlist); | 84 AddressList* addrlist); |
| 82 | 85 |
| 83 } // namespace net | 86 } // namespace net |
| 84 | 87 |
| 85 #endif // NET_BASE_HOST_RESOLVER_PROC_H_ | 88 #endif // NET_BASE_HOST_RESOLVER_PROC_H_ |
| OLD | NEW |