Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorVerifier.h |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorVerifier.h b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorVerifier.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d64bacacfa5b5b6f3e86c1a44ccff6893c61998a |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorVerifier.h |
| @@ -0,0 +1,61 @@ |
| +// 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. |
| + |
| +#ifndef ScriptWrappableVisitorVerifier_h |
| +#define ScriptWrappableVisitorVerifier_h |
| + |
| +#include "bindings/core/v8/ScriptWrappableVisitor.h" |
| +#include "bindings/core/v8/V8AbstractEventListener.h" |
| +#include "core/dom/DocumentStyleSheetCollection.h" |
| +#include "core/dom/ElementRareData.h" |
| +#include "core/dom/NodeListsNodeData.h" |
| +#include "core/dom/NodeRareData.h" |
| +#include "core/dom/StyleEngine.h" |
| +#include "core/dom/shadow/ElementShadow.h" |
| +#include "core/html/imports/HTMLImportsController.h" |
|
haraken
2016/06/22 15:43:12
Remove unnecessary header includes.
Marcel Hlopko
2016/06/23 09:09:13
All are requried because of WRAPPER_VISITOR_SPECIA
|
| + |
| +namespace blink { |
| + |
| +class ScriptWrappableVisitorVerifier : public WrapperVisitor { |
| +public: |
| + void dispatchTraceWrappers(const ScriptWrappable* t) const override { t->traceWrappers(this); } |
| +#define DECLARE_DISPATCH_TRACE_WRAPPERS(className) \ |
| + void dispatchTraceWrappers(const className* t) const override { t->traceWrappers(this); } |
| + |
| + WRAPPER_VISITOR_SPECIAL_CLASSES(DECLARE_DISPATCH_TRACE_WRAPPERS); |
| + |
| +#undef DECLARE_DISPATCH_TRACE_WRAPPERS |
| + void dispatchTraceWrappers(const void*) const override {} |
| + |
| + void traceWrappers(const ScopedPersistent<v8::Value>*) const override {} |
| + void traceWrappers(const ScopedPersistent<v8::Object>*) const override {} |
| + void markWrapper(const v8::PersistentBase<v8::Object>*) const override {} |
| + |
| + void pushToMarkingDeque( |
| + void (*traceWrappersCallback)(const WrapperVisitor*, const void*), |
| + HeapObjectHeader* (*heapObjectHeaderCallback)(const void*), |
| + const void* object) const override |
| + { |
| + if (!heapObjectHeaderCallback(object)->isWrapperHeaderMarked()) { |
| + NOTREACHED(); |
|
haraken
2016/06/22 15:43:12
Add a comment and explain what this is checking.
Marcel Hlopko
2016/06/23 09:09:13
Done.
|
| + } |
| + traceWrappersCallback(this, object); |
| + } |
| + |
| + bool markWrapperHeader(HeapObjectHeader* header) const override |
| + { |
| + if (!m_visitedHeaders.contains(header)) { |
| + m_visitedHeaders.add(header); |
| + return true; |
| + } |
| + return false; |
| + } |
| + void markWrappersInAllWorlds(const ScriptWrappable*) const override {} |
| + void markWrappersInAllWorlds(const void*) const override {} |
| +private: |
| + mutable WTF::HashSet<HeapObjectHeader*> m_visitedHeaders; |
| +}; |
| + |
| +} |
| +#endif |