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

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

Issue 1864293002: Convert //ppapi to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more nullptr Created 4 years, 8 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/device_enumeration_resource_helper.h ('k') | ppapi/proxy/dispatcher.h » ('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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ipc/ipc_message.h" 13 #include "ipc/ipc_message.h"
13 #include "ipc/ipc_message_macros.h" 14 #include "ipc/ipc_message_macros.h"
14 #include "ppapi/c/pp_array_output.h" 15 #include "ppapi/c/pp_array_output.h"
15 #include "ppapi/c/pp_errors.h" 16 #include "ppapi/c/pp_errors.h"
16 #include "ppapi/proxy/dispatch_reply_message.h" 17 #include "ppapi/proxy/dispatch_reply_message.h"
17 #include "ppapi/proxy/plugin_resource.h" 18 #include "ppapi/proxy/plugin_resource.h"
18 #include "ppapi/proxy/ppapi_messages.h" 19 #include "ppapi/proxy/ppapi_messages.h"
19 #include "ppapi/proxy/resource_message_params.h" 20 #include "ppapi/proxy/resource_message_params.h"
20 #include "ppapi/shared_impl/array_writer.h" 21 #include "ppapi/shared_impl/array_writer.h"
21 #include "ppapi/shared_impl/ppapi_globals.h" 22 #include "ppapi/shared_impl/ppapi_globals.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 const ResourceMessageReplyParams& /* params */, 141 const ResourceMessageReplyParams& /* params */,
141 uint32_t callback_id, 142 uint32_t callback_id,
142 const std::vector<DeviceRefData>& devices) { 143 const std::vector<DeviceRefData>& devices) {
143 if (monitor_callback_id_ != callback_id) { 144 if (monitor_callback_id_ != callback_id) {
144 // A new callback or NULL has been set. 145 // A new callback or NULL has been set.
145 return; 146 return;
146 } 147 }
147 148
148 CHECK(monitor_callback_.get()); 149 CHECK(monitor_callback_.get());
149 150
150 scoped_ptr<PP_Resource[]> elements; 151 std::unique_ptr<PP_Resource[]> elements;
151 uint32_t size = static_cast<uint32_t>(devices.size()); 152 uint32_t size = static_cast<uint32_t>(devices.size());
152 if (size > 0) { 153 if (size > 0) {
153 elements.reset(new PP_Resource[size]); 154 elements.reset(new PP_Resource[size]);
154 for (size_t index = 0; index < size; ++index) { 155 for (size_t index = 0; index < size; ++index) {
155 PPB_DeviceRef_Shared* device_object = new PPB_DeviceRef_Shared( 156 PPB_DeviceRef_Shared* device_object = new PPB_DeviceRef_Shared(
156 OBJECT_IS_PROXY, owner_->pp_instance(), devices[index]); 157 OBJECT_IS_PROXY, owner_->pp_instance(), devices[index]);
157 elements[index] = device_object->GetReference(); 158 elements[index] = device_object->GetReference();
158 } 159 }
159 } 160 }
160 161
(...skipping 16 matching lines...) Expand all
177 OBJECT_IS_PROXY, owner_->pp_instance(), devices[i])); 178 OBJECT_IS_PROXY, owner_->pp_instance(), devices[i]));
178 } 179 }
179 if (!writer.StoreResourceVector(device_resources)) 180 if (!writer.StoreResourceVector(device_resources))
180 return PP_ERROR_FAILED; 181 return PP_ERROR_FAILED;
181 182
182 return PP_OK; 183 return PP_OK;
183 } 184 }
184 185
185 } // namespace proxy 186 } // namespace proxy
186 } // namespace ppapi 187 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/device_enumeration_resource_helper.h ('k') | ppapi/proxy/dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698