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

Side by Side Diff: ppapi/shared_impl/ppb_network_list_private_shared.cc

Issue 10828023: PPAPI/NaCl: Make NaClIPCAdapter transfer handles more generally (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-add gyp files Created 8 years, 3 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
« no previous file with comments | « ppapi/shared_impl/ppb_input_event_shared.cc ('k') | ppapi/shared_impl/var.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/shared_impl/ppb_network_list_private_shared.h" 9 #include "ppapi/shared_impl/ppb_network_list_private_shared.h"
10 #include "ppapi/shared_impl/var.h" 10 #include "ppapi/shared_impl/var.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 ::ppapi::thunk::PPB_NetworkList_Private_API* 51 ::ppapi::thunk::PPB_NetworkList_Private_API*
52 PPB_NetworkList_Private_Shared::AsPPB_NetworkList_Private_API() { 52 PPB_NetworkList_Private_Shared::AsPPB_NetworkList_Private_API() {
53 return this; 53 return this;
54 } 54 }
55 55
56 const NetworkList& PPB_NetworkList_Private_Shared::GetNetworkListData() const { 56 const NetworkList& PPB_NetworkList_Private_Shared::GetNetworkListData() const {
57 return list_->list(); 57 return list_->list();
58 } 58 }
59 59
60 uint32_t PPB_NetworkList_Private_Shared::GetCount() { 60 uint32_t PPB_NetworkList_Private_Shared::GetCount() {
61 return list_->list().size(); 61 return static_cast<uint32_t>(list_->list().size());
62 } 62 }
63 63
64 PP_Var PPB_NetworkList_Private_Shared::GetName(uint32_t index) { 64 PP_Var PPB_NetworkList_Private_Shared::GetName(uint32_t index) {
65 if (index >= list_->list().size()) 65 if (index >= list_->list().size())
66 return PP_MakeUndefined(); 66 return PP_MakeUndefined();
67 return StringVar::StringToPPVar(list_->list().at(index).name); 67 return StringVar::StringToPPVar(list_->list().at(index).name);
68 } 68 }
69 69
70 PP_NetworkListType_Private PPB_NetworkList_Private_Shared::GetType( 70 PP_NetworkListType_Private PPB_NetworkList_Private_Shared::GetType(
71 uint32_t index) { 71 uint32_t index) {
(...skipping 12 matching lines...) Expand all
84 int32_t PPB_NetworkList_Private_Shared::GetIpAddresses( 84 int32_t PPB_NetworkList_Private_Shared::GetIpAddresses(
85 uint32_t index, 85 uint32_t index,
86 struct PP_NetAddress_Private addresses[], 86 struct PP_NetAddress_Private addresses[],
87 uint32_t count) { 87 uint32_t count) {
88 if (index >= list_->list().size()) 88 if (index >= list_->list().size())
89 return PP_ERROR_FAILED; 89 return PP_ERROR_FAILED;
90 count = std::min( 90 count = std::min(
91 count, static_cast<uint32_t>(list_->list().at(index).addresses.size())); 91 count, static_cast<uint32_t>(list_->list().at(index).addresses.size()));
92 memcpy(addresses, &(list_->list().at(index).addresses[0]), 92 memcpy(addresses, &(list_->list().at(index).addresses[0]),
93 sizeof(PP_NetAddress_Private) * count); 93 sizeof(PP_NetAddress_Private) * count);
94 return list_->list().at(index).addresses.size(); 94 return static_cast<int32_t>(list_->list().at(index).addresses.size());
95 } 95 }
96 96
97 PP_Var PPB_NetworkList_Private_Shared::GetDisplayName(uint32_t index) { 97 PP_Var PPB_NetworkList_Private_Shared::GetDisplayName(uint32_t index) {
98 if (index >= list_->list().size()) 98 if (index >= list_->list().size())
99 return PP_MakeUndefined(); 99 return PP_MakeUndefined();
100 return StringVar::StringToPPVar(list_->list().at(index).display_name); 100 return StringVar::StringToPPVar(list_->list().at(index).display_name);
101 } 101 }
102 102
103 uint32_t PPB_NetworkList_Private_Shared::GetMTU(uint32_t index) { 103 uint32_t PPB_NetworkList_Private_Shared::GetMTU(uint32_t index) {
104 if (index >= list_->list().size()) 104 if (index >= list_->list().size())
105 return 0; 105 return 0;
106 return list_->list().at(index).mtu; 106 return list_->list().at(index).mtu;
107 } 107 }
108 108
109 } // namespace thunk 109 } // namespace thunk
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_input_event_shared.cc ('k') | ppapi/shared_impl/var.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698