OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ScriptWrappableVisitorVerifier_h | 5 // This file has been moved to |
6 #define ScriptWrappableVisitorVerifier_h | 6 // platform/bindings/ScriptWrappableVisitorVerifier.h. |
7 | 7 // TODO(adithyas): Remove this file. |
8 #include "bindings/core/v8/ScriptWrappableVisitor.h" | 8 #include "platform/bindings/ScriptWrappableVisitorVerifier.h" |
9 | |
10 namespace blink { | |
11 | |
12 class ScriptWrappableVisitorVerifier : public WrapperVisitor { | |
13 public: | |
14 void DispatchTraceWrappers(const TraceWrapperBase* t) const override { | |
15 t->TraceWrappers(this); | |
16 } | |
17 | |
18 void TraceWrappers(const TraceWrapperV8Reference<v8::Value>&) const override { | |
19 } | |
20 void MarkWrapper(const v8::PersistentBase<v8::Value>*) const override {} | |
21 | |
22 bool PushToMarkingDeque( | |
23 void (*trace_wrappers_callback)(const WrapperVisitor*, const void*), | |
24 HeapObjectHeader* (*heap_object_header_callback)(const void*), | |
25 void (*missed_write_barrier_callback)(void), | |
26 const void* object) const override { | |
27 if (!heap_object_header_callback(object)->IsWrapperHeaderMarked()) { | |
28 // If this branch is hit, it means that a white (not discovered by | |
29 // traceWrappers) object was assigned as a member to a black object | |
30 // (already processed by traceWrappers). Black object will not be | |
31 // processed anymore so White object will remain undetected and | |
32 // therefore its wrapper and all wrappers reachable from it would be | |
33 // collected. | |
34 | |
35 // This means there is a write barrier missing somewhere. Check the | |
36 // backtrace to see which types are causing this and review all the | |
37 // places where white object is set to a black object. | |
38 missed_write_barrier_callback(); | |
39 NOTREACHED(); | |
40 } | |
41 trace_wrappers_callback(this, object); | |
42 return true; | |
43 } | |
44 | |
45 bool MarkWrapperHeader(HeapObjectHeader* header) const override { | |
46 if (!visited_headers_.Contains(header)) { | |
47 visited_headers_.insert(header); | |
48 return true; | |
49 } | |
50 return false; | |
51 } | |
52 void MarkWrappersInAllWorlds(const ScriptWrappable*) const override {} | |
53 | |
54 private: | |
55 mutable WTF::HashSet<HeapObjectHeader*> visited_headers_; | |
56 }; | |
57 } | |
58 #endif | |
OLD | NEW |