Index: runtime/vm/dart_api_state.h |
diff --git a/runtime/vm/dart_api_state.h b/runtime/vm/dart_api_state.h |
index 3ca4f728b0da255ed68ab03ba171bb7cbb50a1b6..eb7ad36621e6f174f6a4f9dae6b9d963686b93bb 100644 |
--- a/runtime/vm/dart_api_state.h |
+++ b/runtime/vm/dart_api_state.h |
@@ -686,6 +686,16 @@ class ApiNativeScope { |
OSThread::GetThreadLocal(Api::api_native_key_)); |
} |
+ static intptr_t current_memory_usage() { return current_memory_usage_; } |
+ |
+ static void IncrementNativeScopeMemoryUsage(intptr_t size) { |
+ AtomicOperations::IncrementBy(¤t_memory_usage_, size); |
+ } |
+ |
+ static void DecrementNativeScopeMemoryUsage(intptr_t size) { |
+ AtomicOperations::DecrementBy(¤t_memory_usage_, size); |
+ } |
+ |
Zone* zone() { |
Zone* result = zone_.GetZone(); |
ASSERT(result->handles()->CountScopedHandles() == 0); |
@@ -694,6 +704,9 @@ class ApiNativeScope { |
} |
private: |
+ // The current total memory usage within ApiNativeScopes. |
+ static intptr_t current_memory_usage_; |
+ |
ApiZone zone_; |
}; |