Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.h |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.h b/third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.h |
| index 81bc0b8438cf548b54be93acf59dd97091a54bec..d5f3f2e4f122c0f55792262d425902201ed5cff4 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.h |
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.h |
| @@ -57,7 +57,7 @@ public: |
| // The caller should always use the returned value rather than |wrapper|. |
| static v8::Local<v8::Object> associateObjectWithWrapper(v8::Isolate*, ScriptWrappable*, const WrapperTypeInfo*, v8::Local<v8::Object> wrapper) WARN_UNUSED_RETURN; |
| static v8::Local<v8::Object> associateObjectWithWrapper(v8::Isolate*, Node*, const WrapperTypeInfo*, v8::Local<v8::Object> wrapper) WARN_UNUSED_RETURN; |
| - static void setNativeInfo(v8::Local<v8::Object>, const WrapperTypeInfo*, ScriptWrappable*); |
| + static void setNativeInfo(v8::Isolate*, v8::Local<v8::Object>, const WrapperTypeInfo*, ScriptWrappable*); |
| // hasInternalFieldsSet only checks if the value has the internal fields for |
| // wrapper obejct and type, and does not check if it's valid or not. The |
| // value may not be a Blink's wrapper object. In order to make sure of it, |
| @@ -65,20 +65,26 @@ public: |
| CORE_EXPORT static bool hasInternalFieldsSet(v8::Local<v8::Value>); |
| }; |
| -inline void V8DOMWrapper::setNativeInfo(v8::Local<v8::Object> wrapper, const WrapperTypeInfo* wrapperTypeInfo, ScriptWrappable* scriptWrappable) |
| +inline void V8DOMWrapper::setNativeInfo(v8::Isolate* isolate, v8::Local<v8::Object> wrapper, const WrapperTypeInfo* wrapperTypeInfo, ScriptWrappable* scriptWrappable) |
| { |
| ASSERT(wrapper->InternalFieldCount() >= 2); |
| ASSERT(scriptWrappable); |
| ASSERT(wrapperTypeInfo); |
| wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, scriptWrappable); |
| wrapper->SetAlignedPointerInInternalField(v8DOMWrapperTypeIndex, const_cast<WrapperTypeInfo*>(wrapperTypeInfo)); |
| + if (RuntimeEnabledFeatures::traceWrappablesEnabled()) { |
| + auto perIsolateData = V8PerIsolateData::from(isolate); |
|
haraken
2016/06/08 08:56:07
Add a comment about what this is doing.
haraken
2016/06/08 08:56:07
I guess this will regress performance of wrapper c
|
| + perIsolateData->scriptWrappableVisitor() |
| + ->RegisterV8Reference(std::make_pair( |
| + const_cast<WrapperTypeInfo*>(wrapperTypeInfo), scriptWrappable)); |
| + } |
| } |
| inline v8::Local<v8::Object> V8DOMWrapper::associateObjectWithWrapper(v8::Isolate* isolate, ScriptWrappable* impl, const WrapperTypeInfo* wrapperTypeInfo, v8::Local<v8::Object> wrapper) |
| { |
| if (DOMDataStore::setWrapper(isolate, impl, wrapperTypeInfo, wrapper)) { |
| wrapperTypeInfo->wrapperCreated(); |
| - setNativeInfo(wrapper, wrapperTypeInfo, impl); |
| + setNativeInfo(isolate, wrapper, wrapperTypeInfo, impl); |
| ASSERT(hasInternalFieldsSet(wrapper)); |
| } |
| SECURITY_CHECK(toScriptWrappable(wrapper) == impl); |
| @@ -89,7 +95,7 @@ inline v8::Local<v8::Object> V8DOMWrapper::associateObjectWithWrapper(v8::Isolat |
| { |
| if (DOMDataStore::setWrapper(isolate, node, wrapperTypeInfo, wrapper)) { |
| wrapperTypeInfo->wrapperCreated(); |
| - setNativeInfo(wrapper, wrapperTypeInfo, ScriptWrappable::fromNode(node)); |
| + setNativeInfo(isolate, wrapper, wrapperTypeInfo, ScriptWrappable::fromNode(node)); |
| ASSERT(hasInternalFieldsSet(wrapper)); |
| } |
| SECURITY_CHECK(toScriptWrappable(wrapper) == ScriptWrappable::fromNode(node)); |