| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved. | 3 * Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved. |
| 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if (identifier->isString) | 115 if (identifier->isString) |
| 116 return v8AtomicString(isolate, static_cast<const char*>(identifier->valu
e.string)); | 116 return v8AtomicString(isolate, static_cast<const char*>(identifier->valu
e.string)); |
| 117 | 117 |
| 118 char buffer[32]; | 118 char buffer[32]; |
| 119 snprintf(buffer, sizeof(buffer), "%d", identifier->value.number); | 119 snprintf(buffer, sizeof(buffer), "%d", identifier->value.number); |
| 120 return v8AtomicString(isolate, buffer); | 120 return v8AtomicString(isolate, buffer); |
| 121 } | 121 } |
| 122 | 122 |
| 123 NPObject* v8ObjectToNPObject(v8::Handle<v8::Object> object) | 123 NPObject* v8ObjectToNPObject(v8::Handle<v8::Object> object) |
| 124 { | 124 { |
| 125 return reinterpret_cast<NPObject*>(toInternalPointer(object)); | 125 return reinterpret_cast<NPObject*>(toScriptWrappableBase(object)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 bool isWrappedNPObject(v8::Handle<v8::Object> object) | 128 bool isWrappedNPObject(v8::Handle<v8::Object> object) |
| 129 { | 129 { |
| 130 if (object->InternalFieldCount() == npObjectInternalFieldCount) { | 130 if (object->InternalFieldCount() == npObjectInternalFieldCount) { |
| 131 const WrapperTypeInfo* typeInfo = static_cast<const WrapperTypeInfo*>(ob
ject->GetAlignedPointerFromInternalField(v8DOMWrapperTypeIndex)); | 131 const WrapperTypeInfo* typeInfo = static_cast<const WrapperTypeInfo*>(ob
ject->GetAlignedPointerFromInternalField(v8DOMWrapperTypeIndex)); |
| 132 return typeInfo == npObjectTypeInfo(); | 132 return typeInfo == npObjectTypeInfo(); |
| 133 } | 133 } |
| 134 return false; | 134 return false; |
| 135 } | 135 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 V8NPObject* npObjectToV8NPObject(NPObject* npObject) | 180 V8NPObject* npObjectToV8NPObject(NPObject* npObject) |
| 181 { | 181 { |
| 182 if (npObject->_class != &V8NPObjectClass) | 182 if (npObject->_class != &V8NPObjectClass) |
| 183 return 0; | 183 return 0; |
| 184 V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); | 184 V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); |
| 185 if (v8NpObject->v8Object.IsEmpty()) | 185 if (v8NpObject->v8Object.IsEmpty()) |
| 186 return 0; | 186 return 0; |
| 187 return v8NpObject; | 187 return v8NpObject; |
| 188 } | 188 } |
| 189 | 189 |
| 190 ScriptWrappableBase* npObjectToInternalPointer(NPObject* npObject) | 190 ScriptWrappableBase* npObjectToScriptWrappableBase(NPObject* npObject) |
| 191 { | 191 { |
| 192 return reinterpret_cast<ScriptWrappableBase*>(npObject); | 192 return reinterpret_cast<ScriptWrappableBase*>(npObject); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void disposeUnderlyingV8Object(NPObject* npObject, v8::Isolate* isolate) | 195 void disposeUnderlyingV8Object(NPObject* npObject, v8::Isolate* isolate) |
| 196 { | 196 { |
| 197 ASSERT(npObject); | 197 ASSERT(npObject); |
| 198 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject); | 198 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject); |
| 199 if (!v8NpObject) | 199 if (!v8NpObject) |
| 200 return; | 200 return; |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 622 |
| 623 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate); | 623 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate); |
| 624 return true; | 624 return true; |
| 625 } | 625 } |
| 626 | 626 |
| 627 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) | 627 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) |
| 628 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); | 628 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); |
| 629 | 629 |
| 630 return false; | 630 return false; |
| 631 } | 631 } |
| OLD | NEW |