| 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 "ppapi/shared_impl/host_resource.h" | 7 #include "ppapi/shared_impl/host_resource.h" |
| 8 #include "ppapi/shared_impl/var.h" | 8 #include "ppapi/shared_impl/var.h" |
| 9 | 9 |
| 10 using ppapi::thunk::PPB_DeviceRef_API; | 10 using ppapi::thunk::PPB_DeviceRef_API; |
| 11 | 11 |
| 12 namespace ppapi { | 12 namespace ppapi { |
| 13 | 13 |
| 14 DeviceRefData::DeviceRefData() | 14 DeviceRefData::DeviceRefData() |
| 15 : type(PP_DEVICETYPE_DEV_INVALID) { | 15 : type(PP_DEVICETYPE_DEV_INVALID) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 PPB_DeviceRef_Shared::PPB_DeviceRef_Shared(const InitAsImpl&, | 18 PPB_DeviceRef_Shared::PPB_DeviceRef_Shared(ResourceObjectType type, |
| 19 PP_Instance instance, | 19 PP_Instance instance, |
| 20 const DeviceRefData& data) | 20 const DeviceRefData& data) |
| 21 : Resource(instance), | 21 : Resource(type, instance), |
| 22 data_(data) { | 22 data_(data) { |
| 23 } | 23 } |
| 24 | 24 |
| 25 PPB_DeviceRef_Shared::PPB_DeviceRef_Shared(const InitAsProxy&, | |
| 26 PP_Instance instance, | |
| 27 const DeviceRefData& data) | |
| 28 : Resource(HostResource::MakeInstanceOnly(instance)), | |
| 29 data_(data) { | |
| 30 } | |
| 31 | |
| 32 PPB_DeviceRef_API* PPB_DeviceRef_Shared::AsPPB_DeviceRef_API() { | 25 PPB_DeviceRef_API* PPB_DeviceRef_Shared::AsPPB_DeviceRef_API() { |
| 33 return this; | 26 return this; |
| 34 } | 27 } |
| 35 | 28 |
| 36 const DeviceRefData& PPB_DeviceRef_Shared::GetDeviceRefData() const { | 29 const DeviceRefData& PPB_DeviceRef_Shared::GetDeviceRefData() const { |
| 37 return data_; | 30 return data_; |
| 38 } | 31 } |
| 39 | 32 |
| 40 PP_DeviceType_Dev PPB_DeviceRef_Shared::GetType() { | 33 PP_DeviceType_Dev PPB_DeviceRef_Shared::GetType() { |
| 41 return data_.type; | 34 return data_.type; |
| 42 } | 35 } |
| 43 | 36 |
| 44 PP_Var PPB_DeviceRef_Shared::GetName() { | 37 PP_Var PPB_DeviceRef_Shared::GetName() { |
| 45 return StringVar::StringToPPVar(data_.name); | 38 return StringVar::StringToPPVar(data_.name); |
| 46 } | 39 } |
| 47 | 40 |
| 48 } // namespace ppapi | 41 } // namespace ppapi |
| OLD | NEW |