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..7e2307abd6e0ecf98f9d7ad60649cadc3ad252ac |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp |
| @@ -0,0 +1,48 @@ |
| +// 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::isHeaderMarked(const void* garbageCollected) const |
|
haraken
2016/04/19 04:58:31
If you think that the tracing performance really m
Marcel Hlopko
2016/04/19 12:40:29
Done for private methods. I'll measure the impact
haraken
2016/04/19 12:51:05
Sounds like a plan :)
|
| +{ |
| + return HeapObjectHeader::fromPayload(garbageCollected)->isWrapperMarked(); |
| +} |
| + |
| +void ScriptWrappableVisitor::markHeader(const ScriptWrappable* scriptWrappable) const |
| +{ |
| + markHeader(static_cast<const void*>(scriptWrappable)); |
| + |
| + ScriptWrappableHeapTracer::markWrappersInAllWorlds(scriptWrappable, m_isolate); |
| +} |
| + |
| +void ScriptWrappableVisitor::markHeader(const void* garbageCollected) const |
| +{ |
| + HeapObjectHeader* header = HeapObjectHeader::fromPayload(garbageCollected); |
| + header->markWrapper(); |
|
haraken
2016/04/19 04:58:31
It looks a bit confusing that markHeader calls mar
Marcel Hlopko
2016/04/19 12:40:29
Done.
|
| + m_tracer->AddHeaderToUnmark(header); |
| +} |
| + |
| +void ScriptWrappableVisitor::traceWrappers(const ScriptWrappable* wrappable) const |
| +{ |
| + if (wrappable && !isHeaderMarked(wrappable)) { |
| + markHeader(wrappable); |
| + wrappable->traceWrappers(this); |
| + } |
| +} |
| + |
| +void ScriptWrappableVisitor::traceWrappers(const ScriptWrappable& wrappable) const |
| +{ |
| + traceWrappers(&wrappable); |
| +} |
| + |
| +} // namespace blink |