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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..aa02d6cacea164056b8da0c96bacad9442c7ddea |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "bindings/core/v8/ScriptWrappableVisitor.h" |
| + |
| +#include "bindings/core/v8/ScriptWrappable.h" |
| +#include "bindings/core/v8/ScriptWrappableHeapTracer.h" |
| +#include "core/dom/NodeRareData.h" |
| +#include "core/events/EventListenerMap.h" |
| +#include "core/events/EventTarget.h" |
| +#include "platform/heap/HeapPage.h" |
| + |
| +namespace blink { |
| + |
| +bool ScriptWrappableVisitor::isMarked(const void* garbageCollected) const |
| +{ |
| + return HeapObjectHeader::fromPayload(garbageCollected)->isWrappableMarked(); |
| +} |
| + |
| +void ScriptWrappableVisitor::mark(const ScriptWrappable* scriptWrappable) const |
| +{ |
| + mark(static_cast<const void*>(scriptWrappable)); |
| + |
| + scriptWrappable->markWrapper(m_isolate); |
| +} |
| + |
| +void ScriptWrappableVisitor::mark(const void* garbageCollected) const |
| +{ |
| + HeapObjectHeader* header = HeapObjectHeader::fromPayload(garbageCollected); |
| + header->markWrappable(); |
| + m_tracer->AddHeaderToUnmark(header); |
| +} |
| + |
| +void ScriptWrappableVisitor::traceWrappers(const ScriptWrappable* wrappable) const |
| +{ |
| + if (wrappable && !isMarked(wrappable)) { |
| + mark(wrappable); |
| + wrappable->traceWrappers(this); |
| + } |
| +} |
| + |
| +void ScriptWrappableVisitor::traceWrappers(const ScriptWrappable& wrappable) const |
|
haraken
2016/04/18 04:35:42
Is this method needed?
Marcel Hlopko
2016/04/18 11:45:35
Will be.
|
| +{ |
| + traceWrappers(&wrappable); |
| +} |
| + |
| +void ScriptWrappableVisitor::traceWrappers(const NodeRareData* data) const |
| +{ |
| + if (data && !isMarked(data)) { |
| + mark(data); |
| + data->traceWrappers(this); |
| + } |
| +} |
| + |
| +} // namespace blink |