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/ppb_device_ref_shared.h" | 5 #include "ppapi/shared_impl/ppb_device_ref_shared.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "ppapi/shared_impl/host_resource.h" | 8 #include "ppapi/shared_impl/host_resource.h" |
9 #include "ppapi/shared_impl/ppapi_globals.h" | 9 #include "ppapi/shared_impl/ppapi_globals.h" |
10 #include "ppapi/shared_impl/ppb_resource_array_shared.h" | 10 #include "ppapi/shared_impl/ppb_resource_array_shared.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 size_t size = devices.size(); | 51 size_t size = devices.size(); |
52 if (size > 0) { | 52 if (size > 0) { |
53 elements.reset(new PP_Resource[size]); | 53 elements.reset(new PP_Resource[size]); |
54 for (size_t index = 0; index < size; ++index) { | 54 for (size_t index = 0; index < size; ++index) { |
55 PPB_DeviceRef_Shared* device_object = | 55 PPB_DeviceRef_Shared* device_object = |
56 new PPB_DeviceRef_Shared(type, instance, devices[index]); | 56 new PPB_DeviceRef_Shared(type, instance, devices[index]); |
57 elements[index] = device_object->GetReference(); | 57 elements[index] = device_object->GetReference(); |
58 } | 58 } |
59 } | 59 } |
60 PPB_ResourceArray_Shared* array_object = | 60 PPB_ResourceArray_Shared* array_object = |
61 new PPB_ResourceArray_Shared(type, instance, elements.get(), size); | 61 new PPB_ResourceArray_Shared(type, instance, elements.get(), |
| 62 static_cast<uint32_t>(size)); |
62 | 63 |
63 for (size_t index = 0; index < size; ++index) | 64 for (size_t index = 0; index < size; ++index) |
64 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(elements[index]); | 65 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(elements[index]); |
65 | 66 |
66 return array_object->GetReference(); | 67 return array_object->GetReference(); |
67 } | 68 } |
68 | 69 |
69 } // namespace ppapi | 70 } // namespace ppapi |
OLD | NEW |