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

Unified Diff: src/heap/heap.h

Issue 2910203002: [api] Add an API function to set the GetExternallyAllocatedMemoryInBytesCallback. (Closed)
Patch Set: comment Created 3 years, 7 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/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index d9ac1556b51dcf0c3466afa884a0004c640ec0c3..aaddcb9a5d6fefcb6829b5eca3c0f248e9495848 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -1175,6 +1175,14 @@ class Heap {
// completes incremental marking in order to free external resources.
void ReportExternalMemoryPressure();
+ typedef v8::Isolate::GetExternallyAllocatedMemoryInBytesCallback
+ GetExternallyAllocatedMemoryInBytesCallback;
+
+ void SetGetExternallyAllocatedMemoryInBytesCallback(
+ GetExternallyAllocatedMemoryInBytesCallback callback) {
+ external_memory_callback_ = callback;
+ }
+
// Invoked when GC was requested via the stack guard.
void HandleGCRequest();
@@ -1664,6 +1672,10 @@ class Heap {
return (pretenure == TENURED) ? OLD_SPACE : NEW_SPACE;
}
+ static size_t DefaultGetExternallyAllocatedMemoryInBytesCallback() {
+ return 0;
+ }
+
#define ROOT_ACCESSOR(type, name, camel_name) \
inline void set_##name(type* value);
ROOT_LIST(ROOT_ACCESSOR)
@@ -2282,6 +2294,8 @@ class Heap {
List<GCCallbackPair> gc_epilogue_callbacks_;
List<GCCallbackPair> gc_prologue_callbacks_;
+ GetExternallyAllocatedMemoryInBytesCallback external_memory_callback_;
+
int deferred_counters_[v8::Isolate::kUseCounterFeatureCount];
GCTracer* tracer_;
« no previous file with comments | « src/api.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698