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

Unified 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: Incorporate Haraken's wonderful comments 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/ScriptWrappableHeapTracer.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableHeapTracer.h b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableHeapTracer.h
new file mode 100644
index 0000000000000000000000000000000000000000..910c5f4ccfcf384650ad598b282ed166b39099df
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableHeapTracer.h
@@ -0,0 +1,37 @@
+// 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.
+
+#ifndef ScriptWrappableHeapTracer_h
+#define ScriptWrappableHeapTracer_h
+
+#include <v8.h>
+#include <vector>
+
+namespace blink {
+
+class HeapObjectHeader;
+
+/**
+ * When this heap tracer is set to the v8::Isolate, the V8 will call it during
+ * its garbage collection. At the beginning, it will call TraceRoots, then
+ * repeatedly (as v8 discovers more wrappers) it will call TraceWrappableFrom,
+ * and at the end it will call ClearTracingMarks.
+ */
+class ScriptWrappableHeapTracer : public v8::EmbedderHeapTracer {
+public:
+ ~ScriptWrappableHeapTracer() override;
+ void TraceRoots(v8::Isolate*) override;
+ void TraceWrappableFrom(v8::Isolate*, const std::vector<std::pair<void*, void*>>& hiddenFieldsOfPotentialWrappers) override;
+ void TraceWrappableFrom(v8::Isolate*, v8::Persistent<v8::Object>* wrapper);
+ void AddHeaderToUnmark(HeapObjectHeader*);
+ void ClearTracingMarks(v8::Isolate*) override;
+private:
+ void TraceWrappableFrom(v8::Isolate*, std::pair<void*, void*> hiddenFields);
+ bool m_tracingInProgress = false;
+ std::vector<HeapObjectHeader*> m_headersToUnmark;
haraken 2016/04/13 12:26:22 How is it guaranteed that Oilpan's GC does not hap
Marcel Hlopko 2016/04/14 16:39:08 Currently, there are no guarantees that oilpan gc
haraken 2016/04/15 01:28:16 Ah, good point. You're right.
Marcel Hlopko 2016/04/15 07:27:15 Sad, I was hoping the DOMArrayBuffer and DOMArrayB
+};
+
+} // namespace blink
+
+#endif // ScriptWrappableHeapTracer_h

Powered by Google App Engine
This is Rietveld 408576698