Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp |
| index 82a6d73e9c431cc7d6bf916e06120677e6f05d3a..20bf3c1ace3dff5afa6875becaf9ea2e47e4d4cb 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp |
| @@ -6,6 +6,7 @@ |
| #include "bindings/core/v8/ActiveScriptWrappable.h" |
| #include "bindings/core/v8/DOMWrapperWorld.h" |
| +#include "bindings/core/v8/ScopedPersistent.h" |
| #include "bindings/core/v8/ScriptWrappableVisitorVerifier.h" |
| #include "bindings/core/v8/V8AbstractEventListener.h" |
| #include "bindings/core/v8/WrapperTypeInfo.h" |
| @@ -211,16 +212,31 @@ void ScriptWrappableVisitor::markWrappersInAllWorlds( |
| const_cast<ScriptWrappable*>(scriptWrappable), this, m_reporter); |
| } |
| -void ScriptWrappableVisitor::traceWrappers( |
| - const ScopedPersistent<v8::Value>* scopedPersistent) const { |
| - markWrapper( |
| - &(const_cast<ScopedPersistent<v8::Value>*>(scopedPersistent)->get())); |
| +void ScriptWrappableVisitor::writeBarrier( |
| + const void* srcObject, |
| + const TraceWrapperV8Reference<v8::Value>* dstObject) { |
| + if (!RuntimeEnabledFeatures::traceWrappablesEnabled()) { |
| + return; |
| + } |
| + if (!srcObject || !dstObject || dstObject->isEmpty()) { |
| + return; |
| + } |
| + // We only require a write barrier if |srcObject| is already marked. Note |
| + // that this implicitly disables the write barrier when wrapper tracing |
| + // is not active as object will not be marked in this case. |
|
haraken
2016/11/03 14:25:04
Remove 'Note that...'
Michael Lippautz
2016/11/03 14:53:41
Same as above.
|
| + if (!HeapObjectHeader::fromPayload(srcObject)->isWrapperHeaderMarked()) { |
| + return; |
| + } |
| + currentVisitor(ThreadState::current()->isolate()) |
| + ->markWrapper( |
| + &(const_cast<TraceWrapperV8Reference<v8::Value>*>(dstObject)->get())); |
| } |
| void ScriptWrappableVisitor::traceWrappers( |
| - const ScopedPersistent<v8::Object>* scopedPersistent) const { |
| + const TraceWrapperV8Reference<v8::Value>* tracedPersistent) const { |
| markWrapper( |
| - &(const_cast<ScopedPersistent<v8::Object>*>(scopedPersistent)->get())); |
| + &(const_cast<TraceWrapperV8Reference<v8::Value>*>(tracedPersistent) |
| + ->get())); |
| } |
| void ScriptWrappableVisitor::markWrapper( |
| @@ -229,12 +245,6 @@ void ScriptWrappableVisitor::markWrapper( |
| handle->RegisterExternalReference(m_reporter); |
| } |
| -void ScriptWrappableVisitor::markWrapper( |
| - const v8::PersistentBase<v8::Object>* handle) const { |
| - DCHECK(m_reporter); |
| - handle->RegisterExternalReference(m_reporter); |
| -} |
| - |
| void ScriptWrappableVisitor::dispatchTraceWrappers( |
| const TraceWrapperBase* wrapperBase) const { |
| wrapperBase->traceWrappers(this); |