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