Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: Source/bindings/core/v8/NPV8Object.cpp

Issue 230813002: Make it possible to have <object>'s scriptableObject as a v8 object instead of NPObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed broken layout tests. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/core/v8/NPV8Object.h ('k') | Source/bindings/core/v8/ScriptController.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/NPV8Object.cpp
diff --git a/Source/bindings/core/v8/NPV8Object.cpp b/Source/bindings/core/v8/NPV8Object.cpp
index 03c689b879c7969f73321cb9a9a6e8bfb971aaf8..164f463ef6e14462cc6024689ba2efc0e1e632b8 100644
--- a/Source/bindings/core/v8/NPV8Object.cpp
+++ b/Source/bindings/core/v8/NPV8Object.cpp
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved.
+ * Copyright (C) 2014 Opera Software ASA. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -114,16 +115,22 @@ NPObject* v8ObjectToNPObject(v8::Handle<v8::Object> object)
return reinterpret_cast<NPObject*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
}
-NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, LocalDOMWindow* root, v8::Isolate* isolate)
+bool isWrappedNPObject(v8::Handle<v8::Object> object)
{
- // Check to see if this object is already wrapped.
if (object->InternalFieldCount() == npObjectInternalFieldCount) {
const WrapperTypeInfo* typeInfo = static_cast<const WrapperTypeInfo*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperTypeIndex));
- if (typeInfo == npObjectTypeInfo()) {
- NPObject* returnValue = v8ObjectToNPObject(object);
- _NPN_RetainObject(returnValue);
- return returnValue;
- }
+ return typeInfo == npObjectTypeInfo();
+ }
+ return false;
+}
+
+NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, LocalDOMWindow* root, v8::Isolate* isolate)
+{
+ // Check to see if this object is already wrapped.
+ if (isWrappedNPObject(object)) {
+ NPObject* returnValue = v8ObjectToNPObject(object);
+ _NPN_RetainObject(returnValue);
+ return returnValue;
}
V8NPObjectVector* objectVector = 0;
« no previous file with comments | « Source/bindings/core/v8/NPV8Object.h ('k') | Source/bindings/core/v8/ScriptController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698