OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ppapi/cpp/dev/resource_array_dev.h" |
| 6 |
| 7 #include "ppapi/c/dev/ppb_resource_array_dev.h" |
| 8 #include "ppapi/cpp/instance.h" |
| 9 #include "ppapi/cpp/module_impl.h" |
| 10 |
| 11 namespace pp { |
| 12 |
| 13 namespace { |
| 14 |
| 15 template <> const char* interface_name<PPB_ResourceArray_Dev>() { |
| 16 return PPB_RESOURCEARRAY_DEV_INTERFACE; |
| 17 } |
| 18 |
| 19 } // namespace |
| 20 |
| 21 ResourceArray_Dev::ResourceArray_Dev() { |
| 22 } |
| 23 |
| 24 ResourceArray_Dev::ResourceArray_Dev(PassRef, PP_Resource resource) { |
| 25 PassRefFromConstructor(resource); |
| 26 } |
| 27 |
| 28 ResourceArray_Dev::ResourceArray_Dev(const ResourceArray_Dev& other) |
| 29 : Resource(other) { |
| 30 } |
| 31 |
| 32 ResourceArray_Dev::ResourceArray_Dev(Instance* instance, |
| 33 const PP_Resource elements[], |
| 34 uint32_t size) { |
| 35 if (has_interface<PPB_ResourceArray_Dev>() && instance) { |
| 36 PassRefFromConstructor(get_interface<PPB_ResourceArray_Dev>()->Create( |
| 37 instance->pp_instance(), elements, size)); |
| 38 } |
| 39 } |
| 40 |
| 41 ResourceArray_Dev::~ResourceArray_Dev() { |
| 42 } |
| 43 |
| 44 ResourceArray_Dev& ResourceArray_Dev::operator=( |
| 45 const ResourceArray_Dev& other) { |
| 46 Resource::operator=(other); |
| 47 return *this; |
| 48 } |
| 49 |
| 50 uint32_t ResourceArray_Dev::size() const { |
| 51 if (!has_interface<PPB_ResourceArray_Dev>()) |
| 52 return 0; |
| 53 return get_interface<PPB_ResourceArray_Dev>()->GetSize(pp_resource()); |
| 54 } |
| 55 |
| 56 PP_Resource ResourceArray_Dev::operator[](uint32_t index) const { |
| 57 if (!has_interface<PPB_ResourceArray_Dev>()) |
| 58 return 0; |
| 59 return get_interface<PPB_ResourceArray_Dev>()->GetAt(pp_resource(), index); |
| 60 } |
| 61 |
| 62 } // namespace pp |
OLD | NEW |