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

Unified Diff: src/heap.h

Issue 1165004: New GCCallbacks with additional parameters. (Closed)
Patch Set: Created 10 years, 9 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
« no previous file with comments | « src/api.cc ('k') | src/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index 22d942ee60587b7b9feefdd14e9383240ad8ec46..ca9b50a79a4f52de9f27fb2c35b6f534a21ced65 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -674,10 +674,20 @@ class Heap : public AllStatic {
static bool GarbageCollectionGreedyCheck();
#endif
+ static void AddGCPrologueCallback(
+ GCEpilogueCallback callback, GCType gc_type_filter);
+ static void RemoveGCPrologueCallback(GCEpilogueCallback callback);
+
+ static void AddGCEpilogueCallback(
+ GCEpilogueCallback callback, GCType gc_type_filter);
+ static void RemoveGCEpilogueCallback(GCEpilogueCallback callback);
+
static void SetGlobalGCPrologueCallback(GCCallback callback) {
+ ASSERT((callback == NULL) ^ (global_gc_prologue_callback_ == NULL));
global_gc_prologue_callback_ = callback;
}
static void SetGlobalGCEpilogueCallback(GCCallback callback) {
+ ASSERT((callback == NULL) ^ (global_gc_epilogue_callback_ == NULL));
global_gc_epilogue_callback_ = callback;
}
@@ -1046,6 +1056,30 @@ class Heap : public AllStatic {
// GC callback function, called before and after mark-compact GC.
// Allocations in the callback function are disallowed.
+ struct GCPrologueCallbackPair {
+ GCPrologueCallbackPair(GCPrologueCallback callback, GCType gc_type)
+ : callback(callback), gc_type(gc_type) {
+ }
+ bool operator==(const GCPrologueCallbackPair& pair) const {
+ return pair.callback == callback;
+ }
+ GCPrologueCallback callback;
+ GCType gc_type;
+ };
+ static List<GCPrologueCallbackPair> gc_prologue_callbacks_;
+
+ struct GCEpilogueCallbackPair {
+ GCEpilogueCallbackPair(GCEpilogueCallback callback, GCType gc_type)
+ : callback(callback), gc_type(gc_type) {
+ }
+ bool operator==(const GCEpilogueCallbackPair& pair) const {
+ return pair.callback == callback;
+ }
+ GCEpilogueCallback callback;
+ GCType gc_type;
+ };
+ static List<GCEpilogueCallbackPair> gc_epilogue_callbacks_;
+
static GCCallback global_gc_prologue_callback_;
static GCCallback global_gc_epilogue_callback_;
@@ -1588,6 +1622,7 @@ class GCTracer BASE_EMBEDDED {
// Sets the flag that this is a compacting full GC.
void set_is_compacting() { is_compacting_ = true; }
+ bool is_compacting() const { return is_compacting_; }
// Increment and decrement the count of marked objects.
void increment_marked_count() { ++marked_count_; }
« no previous file with comments | « src/api.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698