| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |