Chromium Code Reviews| 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/shared_impl/ppb_device_ref_shared.h" | |
| 6 | |
| 7 #include "ppapi/shared_impl/host_resource.h" | |
| 8 #include "ppapi/shared_impl/var.h" | |
| 9 | |
| 10 using ppapi::thunk::PPB_DeviceRef_API; | |
| 11 | |
| 12 namespace ppapi { | |
| 13 | |
| 14 DeviceRefData::DeviceRefData() | |
| 15 : type(PP_DEVICETYPE_INVALID) { | |
| 16 } | |
| 17 | |
| 18 PPB_DeviceRef_Shared::PPB_DeviceRef_Shared(const InitAsImpl&, | |
| 19 PP_Instance instance, | |
| 20 const DeviceRefData& data) | |
| 21 : Resource(instance), | |
| 22 data_(data) { | |
| 23 } | |
| 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() { | |
| 33 return this; | |
| 34 } | |
| 35 | |
| 36 const DeviceRefData& PPB_DeviceRef_Shared::GetDeviceRefData() const { | |
| 37 return data_; | |
| 38 } | |
| 39 | |
| 40 PP_DeviceType_Dev PPB_DeviceRef_Shared::GetType() { | |
| 41 return data_.type; | |
| 42 } | |
| 43 | |
| 44 PP_Var PPB_DeviceRef_Shared::GetName() { | |
| 45 // TODO(yzshen): follow the code to learn the ref counting behind it. | |
|
viettrungluu
2012/01/20 18:30:59
See Var::GetOrCreateVarID()?
yzshen1
2012/01/20 19:24:49
Oops, I used TODO to remind me of more reading. Bu
| |
| 46 return StringVar::StringToPPVar(data_.name); | |
| 47 } | |
| 48 | |
| 49 } // namespace ppapi | |
| OLD | NEW |