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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptWrappableHeapTracer.h

Issue 1876383003: Introduce infrastructure for tracing ScriptWrappables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use newer v8 api Created 4 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ScriptWrappableHeapTracer_h
6 #define ScriptWrappableHeapTracer_h
7
8 #include "bindings/core/v8/DOMWrapperWorld.h"
9 #include <v8.h>
10 #include <vector>
11
12 namespace blink {
13
14 class HeapObjectHeader;
15
16 /**
17 * When this heap tracer is set to the v8::Isolate, the V8 will call it during
Hannes Payer (out of office) 2016/04/19 07:44:33 remove the in "the V8" also below and in other fil
Marcel Hlopko 2016/04/19 12:40:29 Done.
18 * its garbage collection. At the beginning, it will call TraceRoots, then
19 * repeatedly (as v8 discovers more wrappers) it will call TraceWrappersFrom,
20 * and at the end it will call ClearTracingMarks.
21 */
22 class ScriptWrappableHeapTracer : public v8::EmbedderHeapTracer {
23 public:
24 ~ScriptWrappableHeapTracer() override;
25 void TracePrologue(v8::Isolate*) override;
26 void TraceWrappersFrom(v8::Isolate*, const std::vector<std::pair<void*, void *>>& internalFieldsOfPotentialWrappers) override;
27 void TraceWrappersFrom(v8::Isolate*, v8::Persistent<v8::Object>* wrapper);
28 void AddHeaderToUnmark(HeapObjectHeader*);
haraken 2016/04/19 04:58:31 AddHeaderToUnmark => addHeaderToUnmark
Marcel Hlopko 2016/04/19 12:40:29 Done.
29 void TraceEpilogue(v8::Isolate*) override;
30 /**
31 * Mark wrappers in all worlds for the given script wrappable as alive in
32 * the V8.
33 */
34 static void markWrappersInAllWorlds(const ScriptWrappable*, v8::Isolate*);
35 /**
36 * Mark given wrapper as alive in the V8.
37 */
38 static void markWrapper(const v8::Persistent<v8::Object>& handle, v8::Isolat e*);
39 private:
40 void TraceWrappersFrom(v8::Isolate*, std::pair<void*, void*> internalFields) ;
haraken 2016/04/19 04:58:31 TraceWrappersFrom => traceWrappersFrom
Marcel Hlopko 2016/04/19 12:40:29 Done.
41 bool m_tracingInProgress = false;
42 /**
43 * Collection of headers we need to unmark after the tracing finished. We
44 * assume it is safe to hold on to the headers because:
45 * * oilpan objects cannot move
46 * * objects this headers belong to are considered alive by the oilpan
47 * gc (so they cannot be reclaimed). For the oilpan gc, wrappers are
48 * part of the root set and wrapper will keep its ScriptWrappable
49 * alive. Wrapper reachability is a subgraph of oilpan reachability,
50 * therefore anything we find during tracing wrappers will be found by
51 * oilpan gc too.
52 */
53 WTF::Vector<HeapObjectHeader*> m_headersToUnmark;
54 };
55
56 } // namespace blink
57
58 #endif // ScriptWrappableHeapTracer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698