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

Unified Diff: third_party/WebKit/Source/core/timing/MemoryInfo.cpp

Issue 2422913002: Add serializers for window.performance. (Closed)
Patch Set: Add serializers for window.performance and window.performance.navigation. Created 4 years, 2 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: third_party/WebKit/Source/core/timing/MemoryInfo.cpp
diff --git a/third_party/WebKit/Source/core/timing/MemoryInfo.cpp b/third_party/WebKit/Source/core/timing/MemoryInfo.cpp
index be531bb18672fe20aac351af214c15b2fb9e1919..5868fccb8df1004a1a1eac21fc03136a38e9c0e0 100644
--- a/third_party/WebKit/Source/core/timing/MemoryInfo.cpp
+++ b/third_party/WebKit/Source/core/timing/MemoryInfo.cpp
@@ -30,6 +30,8 @@
#include "core/timing/MemoryInfo.h"
+#include "bindings/core/v8/ScriptValue.h"
+#include "bindings/core/v8/V8ObjectBuilder.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
#include "platform/RuntimeEnabledFeatures.h"
@@ -145,6 +147,14 @@ size_t quantizeMemorySize(size_t size) {
return bucketSizeList[numberOfBuckets - 1];
}
+ScriptValue MemoryInfo::toJSONForBinding(ScriptState* scriptState) const {
+ V8ObjectBuilder result(scriptState);
+ result.addNumber("totalJSHeapSize", totalJSHeapSize());
+ result.addNumber("usedJSHeapSize", usedJSHeapSize());
+ result.addNumber("jsHeapSizeLimit", jsHeapSizeLimit());
+ return result.scriptValue();
+}
+
MemoryInfo::MemoryInfo() {
if (RuntimeEnabledFeatures::preciseMemoryInfoEnabled())
getHeapSize(m_info);

Powered by Google App Engine
This is Rietveld 408576698