| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2006-2008 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 "o3d/gpu_plugin/np_utils/base_np_object.h" | |
| 6 | |
| 7 namespace o3d { | |
| 8 namespace gpu_plugin { | |
| 9 | |
| 10 BaseNPObject::BaseNPObject(NPP npp) : npp_(npp) { | |
| 11 } | |
| 12 | |
| 13 BaseNPObject::~BaseNPObject() { | |
| 14 } | |
| 15 | |
| 16 // The default implementations of the virtual functions return failure and clear | |
| 17 // the result variant to void if appropriate. | |
| 18 | |
| 19 void BaseNPObject::Invalidate() { | |
| 20 } | |
| 21 | |
| 22 bool BaseNPObject::HasMethod(NPIdentifier name) { | |
| 23 return false; | |
| 24 } | |
| 25 | |
| 26 bool BaseNPObject::Invoke(NPIdentifier name, | |
| 27 const NPVariant* args, | |
| 28 uint32_t num_args, | |
| 29 NPVariant* result) { | |
| 30 VOID_TO_NPVARIANT(*result); | |
| 31 return false; | |
| 32 } | |
| 33 | |
| 34 bool BaseNPObject::InvokeDefault(const NPVariant* args, | |
| 35 uint32_t num_args, | |
| 36 NPVariant* result) { | |
| 37 VOID_TO_NPVARIANT(*result); | |
| 38 return false; | |
| 39 } | |
| 40 | |
| 41 bool BaseNPObject::HasProperty(NPIdentifier name) { | |
| 42 return false; | |
| 43 } | |
| 44 | |
| 45 bool BaseNPObject::GetProperty(NPIdentifier name, NPVariant* result) { | |
| 46 VOID_TO_NPVARIANT(*result); | |
| 47 return false; | |
| 48 } | |
| 49 | |
| 50 bool BaseNPObject::SetProperty(NPIdentifier name, const NPVariant* value) { | |
| 51 return false; | |
| 52 } | |
| 53 | |
| 54 bool BaseNPObject::RemoveProperty(NPIdentifier name) { | |
| 55 return false; | |
| 56 } | |
| 57 | |
| 58 bool BaseNPObject::Enumerate(NPIdentifier** names, uint32_t* count) { | |
| 59 return false; | |
| 60 } | |
| 61 | |
| 62 bool BaseNPObject::Construct(const NPVariant* args, | |
| 63 uint32_t num_args, | |
| 64 NPVariant* result) { | |
| 65 VOID_TO_NPVARIANT(*result); | |
| 66 return false; | |
| 67 } | |
| 68 | |
| 69 // These implementations of the NPClass functions forward to the virtual | |
| 70 // functions in BaseNPObject. | |
| 71 | |
| 72 void BaseNPObject::DeallocateImpl(NPObject* object) { | |
| 73 delete static_cast<BaseNPObject*>(object); | |
| 74 } | |
| 75 | |
| 76 void BaseNPObject::InvalidateImpl(NPObject* object) { | |
| 77 return static_cast<BaseNPObject*>(object)->Invalidate(); | |
| 78 } | |
| 79 | |
| 80 bool BaseNPObject::HasMethodImpl(NPObject* object, NPIdentifier name) { | |
| 81 return static_cast<BaseNPObject*>(object)->HasMethod(name); | |
| 82 } | |
| 83 | |
| 84 bool BaseNPObject::InvokeImpl(NPObject* object, | |
| 85 NPIdentifier name, | |
| 86 const NPVariant* args, | |
| 87 uint32_t num_args, | |
| 88 NPVariant* result) { | |
| 89 return static_cast<BaseNPObject*>(object)->Invoke( | |
| 90 name, args, num_args, result); | |
| 91 } | |
| 92 | |
| 93 bool BaseNPObject::InvokeDefaultImpl(NPObject* object, | |
| 94 const NPVariant* args, | |
| 95 uint32_t num_args, | |
| 96 NPVariant* result) { | |
| 97 return static_cast<BaseNPObject*>(object)->InvokeDefault( | |
| 98 args, num_args, result); | |
| 99 } | |
| 100 | |
| 101 bool BaseNPObject::HasPropertyImpl(NPObject* object, NPIdentifier name) { | |
| 102 return static_cast<BaseNPObject*>(object)->HasProperty(name); | |
| 103 } | |
| 104 | |
| 105 bool BaseNPObject::GetPropertyImpl(NPObject* object, | |
| 106 NPIdentifier name, | |
| 107 NPVariant* result) { | |
| 108 return static_cast<BaseNPObject*>(object)->GetProperty(name, result); | |
| 109 } | |
| 110 | |
| 111 bool BaseNPObject::SetPropertyImpl(NPObject* object, | |
| 112 NPIdentifier name, | |
| 113 const NPVariant* value) { | |
| 114 return static_cast<BaseNPObject*>(object)->SetProperty(name, value); | |
| 115 } | |
| 116 | |
| 117 bool BaseNPObject::RemovePropertyImpl(NPObject* object, NPIdentifier name) { | |
| 118 return static_cast<BaseNPObject*>(object)->RemoveProperty(name); | |
| 119 } | |
| 120 | |
| 121 bool BaseNPObject::EnumerateImpl(NPObject* object, | |
| 122 NPIdentifier** names, | |
| 123 uint32_t* count) { | |
| 124 return static_cast<BaseNPObject*>(object)->Enumerate(names, count); | |
| 125 } | |
| 126 | |
| 127 bool BaseNPObject::ConstructImpl(NPObject* object, | |
| 128 const NPVariant* args, | |
| 129 uint32_t num_args, | |
| 130 NPVariant* result) { | |
| 131 return static_cast<BaseNPObject*>(object)->Construct( | |
| 132 args, num_args, result); | |
| 133 } | |
| 134 | |
| 135 } // namespace gpu_plugin | |
| 136 } // namespace o3d | |
| OLD | NEW |