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

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: Revert to traceActiveScriptWrappables - C++ is happier 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
18 * its garbage collection. At the beginning, it will call TraceRoots, then
19 * repeatedly (as v8 discovers more wrappers) it will call TraceWrappableFrom,
20 * and at the end it will call ClearTracingMarks.
21 */
22 class ScriptWrappableHeapTracer : public v8::EmbedderHeapTracer {
23 public:
24 ~ScriptWrappableHeapTracer() override;
25 void TraceRoots(v8::Isolate*) override;
26 void TraceWrappableFrom(v8::Isolate*, const std::vector<std::pair<void*, voi d*>>& internalFieldsOfPotentialWrappers) override;
27 void TraceWrappableFrom(v8::Isolate*, v8::Persistent<v8::Object>* wrapper);
28 void AddHeaderToUnmark(HeapObjectHeader*);
29 void ClearTracingMarks(v8::Isolate*) override;
30 static void markWrapper(const ScriptWrappable*, v8::Isolate*);
31 static void markWrapper(const v8::Persistent<v8::Object>& handle, v8::Isolat e*);
32 private:
33 class ExternalReferenceRegisteringVisitor : public DOMWrapperWorldVisitor {
34 STACK_ALLOCATED();
35 public:
36 ExternalReferenceRegisteringVisitor(ScriptWrappable* scriptWrappable, v8 ::Isolate* isolate)
37 : m_scriptWrappable(scriptWrappable)
38 , m_isolate(isolate)
39 {}
40 void visit(DOMWrapperWorld&) override;
41 private:
42 ScriptWrappable* m_scriptWrappable;
43 v8::Isolate* m_isolate;
44 };
45 void TraceWrappableFrom(v8::Isolate*, std::pair<void*, void*> internalFields );
46 bool m_tracingInProgress = false;
47 std::vector<HeapObjectHeader*> m_headersToUnmark;
haraken 2016/04/18 04:35:42 std::vector is not allowed in Blink. Use WTF::Vect
haraken 2016/04/18 04:35:42 Add a comment why it's safe to hold raw pointers t
Marcel Hlopko 2016/04/18 11:45:35 Done.
48 };
49
50 } // namespace blink
51
52 #endif // ScriptWrappableHeapTracer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698