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

Side by Side Diff: ppapi/proxy/device_enumeration_resource_helper.cc

Issue 915403003: Enable size_t to int truncation warnings in PPAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ppapi_unittests win x64 Created 5 years, 10 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
« no previous file with comments | « ppapi/proxy/audio_input_resource.cc ('k') | ppapi/proxy/file_ref_resource.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 "ppapi/proxy/device_enumeration_resource_helper.h" 5 #include "ppapi/proxy/device_enumeration_resource_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "ipc/ipc_message.h" 10 #include "ipc/ipc_message.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 uint32_t callback_id, 139 uint32_t callback_id,
140 const std::vector<DeviceRefData>& devices) { 140 const std::vector<DeviceRefData>& devices) {
141 if (monitor_callback_id_ != callback_id) { 141 if (monitor_callback_id_ != callback_id) {
142 // A new callback or NULL has been set. 142 // A new callback or NULL has been set.
143 return; 143 return;
144 } 144 }
145 145
146 CHECK(monitor_callback_.get()); 146 CHECK(monitor_callback_.get());
147 147
148 scoped_ptr<PP_Resource[]> elements; 148 scoped_ptr<PP_Resource[]> elements;
149 uint32_t size = devices.size(); 149 uint32_t size = static_cast<uint32_t>(devices.size());
150 if (size > 0) { 150 if (size > 0) {
151 elements.reset(new PP_Resource[size]); 151 elements.reset(new PP_Resource[size]);
152 for (size_t index = 0; index < size; ++index) { 152 for (size_t index = 0; index < size; ++index) {
153 PPB_DeviceRef_Shared* device_object = new PPB_DeviceRef_Shared( 153 PPB_DeviceRef_Shared* device_object = new PPB_DeviceRef_Shared(
154 OBJECT_IS_PROXY, owner_->pp_instance(), devices[index]); 154 OBJECT_IS_PROXY, owner_->pp_instance(), devices[index]);
155 elements[index] = device_object->GetReference(); 155 elements[index] = device_object->GetReference();
156 } 156 }
157 } 157 }
158 158
159 monitor_callback_->RunOnTargetThread(monitor_user_data_, size, 159 monitor_callback_->RunOnTargetThread(monitor_user_data_, size,
(...skipping 15 matching lines...) Expand all
175 OBJECT_IS_PROXY, owner_->pp_instance(), devices[i])); 175 OBJECT_IS_PROXY, owner_->pp_instance(), devices[i]));
176 } 176 }
177 if (!writer.StoreResourceVector(device_resources)) 177 if (!writer.StoreResourceVector(device_resources))
178 return PP_ERROR_FAILED; 178 return PP_ERROR_FAILED;
179 179
180 return PP_OK; 180 return PP_OK;
181 } 181 }
182 182
183 } // namespace proxy 183 } // namespace proxy
184 } // namespace ppapi 184 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/audio_input_resource.cc ('k') | ppapi/proxy/file_ref_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698