Chromium Code Reviews| 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 |