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

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: add unittest / fix windows 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
« no previous file with comments | « Source/bindings/v8/V8GCController.h ('k') | Source/platform/Partitions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8GCController.cpp
diff --git a/Source/bindings/v8/V8GCController.cpp b/Source/bindings/v8/V8GCController.cpp
index dfea224c4ef72765891958d54bef73313bc0727d..647a4aa4487d511b5d3bd074ec0c095135fe9013 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();
+ int64_t diff = static_cast<int64_t>(currentUsage) - static_cast<int64_t>(lastUsageReportedToV8);
+ isolate->AdjustAmountOfExternalAllocatedMemory(diff);
+
+ lastUsageReportedToV8 = currentUsage;
+}
+
} // namespace WebCore
« no previous file with comments | « Source/bindings/v8/V8GCController.h ('k') | Source/platform/Partitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698