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" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 const std::string& canonical_name, | 77 const std::string& canonical_name, |
78 const std::vector<PP_NetAddress_Private>& net_address_list) { | 78 const std::vector<PP_NetAddress_Private>& net_address_list) { |
79 if (succeeded) { | 79 if (succeeded) { |
80 canonical_name_ = canonical_name; | 80 canonical_name_ = canonical_name; |
81 net_address_list_ = net_address_list; | 81 net_address_list_ = net_address_list; |
82 } else { | 82 } else { |
83 canonical_name_.clear(); | 83 canonical_name_.clear(); |
84 net_address_list_.clear(); | 84 net_address_list_.clear(); |
85 } | 85 } |
86 | 86 |
87 TrackedCallback::ClearAndRun(&resolve_callback_, | 87 resolve_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED); |
88 succeeded ? PP_OK : PP_ERROR_FAILED); | |
89 } | 88 } |
90 | 89 |
91 uint32 PPB_HostResolver_Shared::GenerateHostResolverID() { | 90 uint32 PPB_HostResolver_Shared::GenerateHostResolverID() { |
92 static uint32 host_resolver_id = 0; | 91 static uint32 host_resolver_id = 0; |
93 return host_resolver_id++; | 92 return host_resolver_id++; |
94 } | 93 } |
95 | 94 |
96 bool PPB_HostResolver_Shared::ResolveInProgress() const { | 95 bool PPB_HostResolver_Shared::ResolveInProgress() const { |
97 return TrackedCallback::IsPending(resolve_callback_); | 96 return TrackedCallback::IsPending(resolve_callback_); |
98 } | 97 } |
99 | 98 |
100 } // namespace ppapi | 99 } // namespace ppapi |
OLD | NEW |