Chromium Code Reviews| 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..cb5569cb5c107d7eb587e029c6be30b6c5facac0 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,25 @@ 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(); |
| + |
| + // Might be a XXXConstructor::wrapperTypeInfo instead of an |
| + // XXX::wrapperTypeInfo. These will both have the same object de-ref |
| + // functions, though, so use that as the basis of the check. |
| + RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(typeInfo()->derefObjectFunction == wrapperType->derefObjectFunction); |
|
haraken
2014/08/29 05:24:04
Do we need to check this? I guess we can drop this
Yuki
2014/09/01 06:06:39
Done.
|
| + |
| + 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, WrapperConfiguration::Dependent); |
|
haraken
2014/08/29 05:24:04
It looks wrong to always use WrapperConfiguration:
Yuki
2014/09/01 06:06:39
Nice catch! Thanks for pointing this out. As you
|
| + return wrapper; |
| +} |
| + |
| } // namespace blink |