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

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

Issue 478243002: bindings: Adds virtual ScriptWrappable::wrap method. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 years, 3 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/ScriptWrappable.h ('k') | Source/bindings/core/v8/custom/V8DataViewCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/ScriptWrappable.cpp
diff --git a/Source/bindings/core/v8/ScriptWrappable.cpp b/Source/bindings/core/v8/ScriptWrappable.cpp
index 3ce578564aac0e62fd935f36a04e97bf0a0c291a..faf703310325bcc36daa3a3bf80fd83a5e427bf9 100644
--- a/Source/bindings/core/v8/ScriptWrappable.cpp
+++ b/Source/bindings/core/v8/ScriptWrappable.cpp
@@ -5,6 +5,9 @@
#include "config.h"
#include "bindings/core/v8/ScriptWrappable.h"
+#include "bindings/core/v8/DOMDataStore.h"
+#include "bindings/core/v8/V8DOMWrapper.h"
+
namespace blink {
#if COMPILER(MSVC)
@@ -21,4 +24,20 @@ struct SameSizeAsScriptWrappable : public ScriptWrappableBase {
COMPILE_ASSERT(sizeof(ScriptWrappable) <= sizeof(SameSizeAsScriptWrappable), ScriptWrappable_should_stay_small);
+v8::Handle<v8::Object> ScriptWrappable::wrap(v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ ASSERT(!DOMDataStore::containsWrapperNonTemplate(this, isolate));
+
+ const WrapperTypeInfo* wrapperType = wrapperTypeInfo();
+
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, wrapperType, toInternalPointer(), isolate);
+ if (UNLIKELY(wrapper.IsEmpty()))
+ return wrapper;
+
+ wrapperType->installConditionallyEnabledProperties(wrapper, isolate);
+ wrapperType->refObject(toInternalPointer());
+ V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapper, isolate);
+ return wrapper;
+}
+
} // namespace blink
« no previous file with comments | « Source/bindings/core/v8/ScriptWrappable.h ('k') | Source/bindings/core/v8/custom/V8DataViewCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698