Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp

Issue 2045453002: Refactor WrapperTypeInfo.traceWrappers to WrapperTypeInfo.getHeader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use nicer name Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 124538fb9115200fc5e0eb1a21dfe713e96ea003..81e5e4e8064bb8f6407c6ff0bc92382ef2daddf6 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp
@@ -31,8 +31,9 @@ void ScriptWrappableVisitor::TracePrologue()
void ScriptWrappableVisitor::TraceEpilogue()
{
- for (auto header : m_headersToUnmark)
+ for (auto header : m_headersToUnmark) {
header->unmarkWrapperHeader();
+ }
m_headersToUnmark.clear();
m_tracingInProgress = false;
@@ -58,34 +59,36 @@ void ScriptWrappableVisitor::traceWrappersFrom(std::pair<void*, void*> internalF
ASSERT(wrapperTypeInfo->wrapperClassId == WrapperTypeInfo::NodeClassId
|| wrapperTypeInfo->wrapperClassId == WrapperTypeInfo::ObjectClassId);
- wrapperTypeInfo->traceWrappers(this, scriptWrappable);
+ scriptWrappable->traceWrappers(this);
}
-bool ScriptWrappableVisitor::markWrapperHeader(const void* garbageCollected, const void* objectTopPointer) const
+bool ScriptWrappableVisitor::markWrapperHeader(HeapObjectHeader* header) const
{
- HeapObjectHeader* header = HeapObjectHeader::fromPayload(objectTopPointer);
if (header->isWrapperHeaderMarked())
return false;
header->markWrapperHeader();
- addHeaderToUnmark(header);
+ m_headersToUnmark.append(header);
return true;
}
-bool ScriptWrappableVisitor::markWrapperHeader(const ScriptWrappable* scriptWrappable, const void* objectTopPointer) const
+bool ScriptWrappableVisitor::markWrapperHeader(const void* garbageCollected) const
+{
+ HeapObjectHeader* header = HeapObjectHeader::fromPayload(garbageCollected);
+ return markWrapperHeader(header);
+}
+
+bool ScriptWrappableVisitor::markWrapperHeader(const ScriptWrappable* scriptWrappable) const
{
- if (!markWrapperHeader(objectTopPointer, objectTopPointer))
+ if (!markWrapperHeader(scriptWrappable->wrapperTypeInfo()->
+ getHeader(const_cast<ScriptWrappable*>(scriptWrappable)))) {
return false;
+ }
markWrappersInAllWorlds(scriptWrappable, m_isolate);
return true;
}
-void ScriptWrappableVisitor::addHeaderToUnmark(HeapObjectHeader* header) const
-{
- m_headersToUnmark.append(header);
-}
-
void ScriptWrappableVisitor::markWrappersInAllWorlds(const ScriptWrappable* scriptWrappable, v8::Isolate* isolate)
{
DOMWrapperWorld::markWrappersInAllWorlds(const_cast<ScriptWrappable*>(scriptWrappable), isolate);

Powered by Google App Engine
This is Rietveld 408576698