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

Unified Diff: Source/bindings/v8/V8GCController.cpp

Issue 301743006: Report DOM partitionAlloc size to V8 GC. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: undo changes on Partitions.cpp Created 6 years, 6 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: Source/bindings/v8/V8GCController.cpp
diff --git a/Source/bindings/v8/V8GCController.cpp b/Source/bindings/v8/V8GCController.cpp
index dfea224c4ef72765891958d54bef73313bc0727d..4c471ae0f99fdafe9819a0fab9b2554c02592c7d 100644
--- a/Source/bindings/v8/V8GCController.cpp
+++ b/Source/bindings/v8/V8GCController.cpp
@@ -48,6 +48,7 @@
#include "core/html/imports/HTMLImportsController.h"
#include "core/inspector/InspectorTraceEvents.h"
#include "core/svg/SVGElement.h"
+#include "platform/Partitions.h"
#include "platform/TraceEvent.h"
#include <algorithm>
@@ -437,4 +438,18 @@ void V8GCController::collectGarbage(v8::Isolate* isolate)
scriptState->disposePerContextData();
}
+void V8GCController::reportDOMMemoryUsageToV8(v8::Isolate* isolate)
+{
+ if (!isMainThread())
+ return;
+
+ static size_t lastUsageReportedToV8 = 0;
+
+ size_t currentUsage = Partitions::currentDOMMemoryUsage();
+ ssize_t diff = static_cast<ssize_t>(currentUsage) - static_cast<ssize_t>(lastUsageReportedToV8);
+ isolate->AdjustAmountOfExternalAllocatedMemory(diff);
Tom Sepez 2014/06/05 17:58:08 nit: down the road, you'd probably be happier with
+
+ lastUsageReportedToV8 = currentUsage;
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698