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

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: track page count 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..524bc31bc8b835379fd7ad630d0a5e0a7de421a0 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,19 @@ 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();
+ fprintf(stderr, "currentUsage: %zu\n", currentUsage);
kouhei (in TOK) 2014/06/06 11:24:28 I will remove this printf.
kouhei (in TOK) 2014/06/09 05:48:22 Done.
+ ssize_t diff = static_cast<ssize_t>(currentUsage) - static_cast<ssize_t>(lastUsageReportedToV8);
+ isolate->AdjustAmountOfExternalAllocatedMemory(diff);
+
+ lastUsageReportedToV8 = currentUsage;
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698