blob: 170327b3abc5543f396f43541a5d1492275f1f13 [file] [log] [blame]
// 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 "base/logging.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable_visitor.h"
#include "third_party/blink/renderer/platform/heap/gc_info.h"
namespace blink {
// This visitor should be applied on wrapper members of each marked object
// after marking is complete. The Visit method checks that the given wrapper
// is also marked.
class ScriptWrappableVisitorVerifier final : public ScriptWrappableVisitor {
ScriptWrappableVisitorVerifier(ThreadState* thread_state)
: ScriptWrappableVisitor(thread_state) {}
void Visit(const TraceWrapperV8Reference<v8::Value>&) final {}
void VisitWithWrappers(void* object, TraceDescriptor descriptor) final {
HeapObjectHeader* header =
const char* name = GCInfoTable::Get()
// If this FATAL is hit, it means that a white (not discovered by
// Trace) object was assigned as a member to a black object (already
// processed by Trace). The black object will not be processed anymore
// so white object will remain undetected and therefore its wrapper
// and all wrappers reachable from it would be collected.
// This means there is a write barrier missing somewhere. Check the
// backtrace to see which types are causing this and review all the places
// where white object is set to a black object.
LOG_IF(FATAL, !header->IsWrapperHeaderMarked())
<< "Write barrier missed for " << name;
void Visit(DOMWrapperMap<ScriptWrappable>*,
const ScriptWrappable* key) final {}
void VisitBackingStoreStrongly(void* object,
void** object_slot,
TraceDescriptor desc) final {}
using Visitor::Visit;
} // namespace blink