Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "ppapi/shared_impl/private/ppb_host_resolver_shared.h" | 5 #include "ppapi/shared_impl/private/ppb_host_resolver_shared.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #if !defined(OS_NACL) | |
| 11 #include "net/base/address_list.h" | 12 #include "net/base/address_list.h" |
| 13 #endif | |
| 12 #include "ppapi/c/pp_errors.h" | 14 #include "ppapi/c/pp_errors.h" |
| 13 #include "ppapi/shared_impl/private/net_address_private_impl.h" | 15 #include "ppapi/shared_impl/private/net_address_private_impl.h" |
| 14 #include "ppapi/shared_impl/var.h" | 16 #include "ppapi/shared_impl/var.h" |
| 15 #include "ppapi/thunk/thunk.h" | 17 #include "ppapi/thunk/thunk.h" |
| 16 | 18 |
| 17 namespace ppapi { | 19 namespace ppapi { |
| 18 | 20 |
| 21 #if !defined(OS_NACL) | |
| 19 NetAddressList* CreateNetAddressListFromAddressList( | 22 NetAddressList* CreateNetAddressListFromAddressList( |
|
dmichael (off chromium)
2012/08/31 16:48:40
Maybe it would be good to ifdef this out from the
bbudge
2012/08/31 19:34:59
Done.
| |
| 20 const net::AddressList& list) { | 23 const net::AddressList& list) { |
| 21 scoped_ptr<NetAddressList> net_address_list(new NetAddressList()); | 24 scoped_ptr<NetAddressList> net_address_list(new NetAddressList()); |
| 22 PP_NetAddress_Private address; | 25 PP_NetAddress_Private address; |
| 23 | 26 |
| 24 for (size_t i = 0; i < list.size(); ++i) { | 27 for (size_t i = 0; i < list.size(); ++i) { |
| 25 if (!NetAddressPrivateImpl::IPEndPointToNetAddress(list[i], &address)) | 28 if (!NetAddressPrivateImpl::IPEndPointToNetAddress(list[i], &address)) |
| 26 return NULL; | 29 return NULL; |
| 27 net_address_list->push_back(address); | 30 net_address_list->push_back(address); |
| 28 } | 31 } |
| 29 | 32 |
| 30 return net_address_list.release(); | 33 return net_address_list.release(); |
| 31 } | 34 } |
| 35 #endif // !defined(OS_NACL) | |
| 32 | 36 |
| 33 PPB_HostResolver_Shared::PPB_HostResolver_Shared(PP_Instance instance) | 37 PPB_HostResolver_Shared::PPB_HostResolver_Shared(PP_Instance instance) |
| 34 : Resource(OBJECT_IS_IMPL, instance), | 38 : Resource(OBJECT_IS_IMPL, instance), |
| 35 host_resolver_id_(GenerateHostResolverID()) { | 39 host_resolver_id_(GenerateHostResolverID()) { |
| 36 } | 40 } |
| 37 | 41 |
| 38 PPB_HostResolver_Shared::PPB_HostResolver_Shared( | 42 PPB_HostResolver_Shared::PPB_HostResolver_Shared( |
| 39 const HostResource& resource) | 43 const HostResource& resource) |
| 40 : Resource(OBJECT_IS_PROXY, resource), | 44 : Resource(OBJECT_IS_PROXY, resource), |
| 41 host_resolver_id_(GenerateHostResolverID()) { | 45 host_resolver_id_(GenerateHostResolverID()) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 uint32 PPB_HostResolver_Shared::GenerateHostResolverID() { | 110 uint32 PPB_HostResolver_Shared::GenerateHostResolverID() { |
| 107 static uint32 host_resolver_id = 0; | 111 static uint32 host_resolver_id = 0; |
| 108 return host_resolver_id++; | 112 return host_resolver_id++; |
| 109 } | 113 } |
| 110 | 114 |
| 111 bool PPB_HostResolver_Shared::ResolveInProgress() const { | 115 bool PPB_HostResolver_Shared::ResolveInProgress() const { |
| 112 return TrackedCallback::IsPending(resolve_callback_); | 116 return TrackedCallback::IsPending(resolve_callback_); |
| 113 } | 117 } |
| 114 | 118 |
| 115 } // namespace ppapi | 119 } // namespace ppapi |
| OLD | NEW |