diff options
author | Steve Block <steveblock@google.com> | 2010-02-02 14:57:50 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-04 15:06:55 +0000 |
commit | d0825bca7fe65beaee391d30da42e937db621564 (patch) | |
tree | 7461c49eb5844ffd1f35d1ba2c8b7584c1620823 /WebCore/bindings/v8/NPV8Object.cpp | |
parent | 3db770bd97c5a59b6c7574ca80a39e5a51c1defd (diff) | |
download | external_webkit-d0825bca7fe65beaee391d30da42e937db621564.zip external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.gz external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.bz2 |
Merge webkit.org at r54127 : Initial merge by git
Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82
Diffstat (limited to 'WebCore/bindings/v8/NPV8Object.cpp')
-rw-r--r-- | WebCore/bindings/v8/NPV8Object.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/WebCore/bindings/v8/NPV8Object.cpp b/WebCore/bindings/v8/NPV8Object.cpp index e222ecd..258f579 100644 --- a/WebCore/bindings/v8/NPV8Object.cpp +++ b/WebCore/bindings/v8/NPV8Object.cpp @@ -37,6 +37,7 @@ #include "V8CustomBinding.h" #include "V8GCController.h" #include "V8Helpers.h" +#include "V8Index.h" #include "V8NPUtils.h" #include "V8Proxy.h" #include "npruntime_impl.h" @@ -46,6 +47,7 @@ #include <v8.h> #include <wtf/StringExtras.h> +using WebCore::npObjectInternalFieldCount; using WebCore::toV8Context; using WebCore::toV8Proxy; using WebCore::V8ClassIndex; @@ -92,6 +94,11 @@ static v8::Local<v8::String> npIdentifierToV8Identifier(NPIdentifier name) return v8::String::New(buffer); } +NPObject* v8ObjectToNPObject(v8::Handle<v8::Object> object) +{ + return reinterpret_cast<NPObject*>(object->GetPointerFromInternalField(WebCore::v8DOMWrapperObjectIndex)); +} + static NPClass V8NPObjectClass = { NP_CLASS_STRUCT_VERSION, allocV8NPObject, freeV8NPObject, @@ -103,11 +110,11 @@ NPClass* npScriptObjectClass = &V8NPObjectClass; NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, WebCore::DOMWindow* root) { // Check to see if this object is already wrapped. - if (object->InternalFieldCount() == V8Custom::kNPObjectInternalFieldCount) { - v8::Local<v8::Value> typeIndex = object->GetInternalField(V8Custom::kDOMWrapperTypeIndex); + if (object->InternalFieldCount() == npObjectInternalFieldCount) { + v8::Local<v8::Value> typeIndex = object->GetInternalField(WebCore::v8DOMWrapperTypeIndex); if (typeIndex->IsNumber() && typeIndex->Uint32Value() == V8ClassIndex::NPOBJECT) { - NPObject* returnValue = V8DOMWrapper::convertToNativeObject<NPObject>(V8ClassIndex::NPOBJECT, object); + NPObject* returnValue = v8ObjectToNPObject(object); _NPN_RetainObject(returnValue); return returnValue; } |