Web Inspector: [chromium] introduce HeapSnapshot performance test.
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Mar 2012 15:24:45 +0000 (15:24 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Mar 2012 15:24:45 +0000 (15:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=80280

Reviewed by Pavel Feldman.

PerformanceTests:

* inspector/detailed-heapshots-smoke-test.html: Added.

Source/WebCore:

* inspector/front-end/HeapSnapshotProxy.js:
(WebInspector.HeapSnapshotLoaderProxy.prototype.finishLoading.updateStaticData):
(WebInspector.HeapSnapshotLoaderProxy.prototype.finishLoading):
(WebInspector.HeapSnapshotLoaderProxy.prototype._callLoadCallbacks):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@109743 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/inspector/detailed-heapshots-smoke-test.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/HeapSnapshotProxy.js

index 56ba375..38bc164 100644 (file)
@@ -1,3 +1,12 @@
+2012-03-05  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: [chromium] introduce HeapSnapshot performance test.
+        https://bugs.webkit.org/show_bug.cgi?id=80280
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/detailed-heapshots-smoke-test.html: Added.
+
 2012-03-01  Ryosuke Niwa  <rniwa@webkit.org>
 
         DOM tests take too long to run
diff --git a/PerformanceTests/inspector/detailed-heapshots-smoke-test.html b/PerformanceTests/inspector/detailed-heapshots-smoke-test.html
new file mode 100644 (file)
index 0000000..7912324
--- /dev/null
@@ -0,0 +1,55 @@
+<html>
+<head>
+  <script src="../../LayoutTests/http/tests/inspector/inspector-test.js"></script>
+  <script src="../../LayoutTests/inspector/profiler/detailed-heapshots-test.js"></script>
+  <script src="performance-test.js"></script>
+<script>
+
+function test()
+{
+    function performanceTest(timer)
+    {
+
+        var showPanelTimerCookie = timer.start("panel-update");
+        ProfilerAgent.takeHeapSnapshot(step0);
+
+        function step0()
+        {
+            var profiles = WebInspector.panels.profiles.getProfiles("HEAP");
+            WebInspector.panels.profiles.showProfile(profiles[profiles.length - 1]);
+            InspectorTest.addSniffer(WebInspector.panels.profiles, "_finishHeapSnapshot", step1);
+        }
+
+        function step1(uid)
+        {
+            var panel = WebInspector.panels.profiles;
+            var profile = panel._profilesIdMap[panel._makeKey(uid, WebInspector.DetailedHeapshotProfileType.TypeId)];
+            InspectorTest.addSniffer(profile.proxy, "_callLoadCallbacks", step2);
+        }
+
+        function step2()
+        {
+            InspectorTest.switchToView("Containment", cleanup);
+        }
+
+        function cleanup()
+        {
+            timer.finish(showPanelTimerCookie);
+            ProfilerAgent.clearProfiles(done);
+            WebInspector.panels.profiles._reset();
+        }
+
+        function done()
+        {
+            timer.done("take-snapshot");
+        }
+    }
+
+    InspectorTest.runPerformanceTest(performanceTest, 25000);
+}
+
+</script>
+</head>
+<body onload="runTest()">
+</body>
+</html>
index ba6253e..6e262b6 100644 (file)
@@ -1,3 +1,15 @@
+2012-03-05  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: [chromium] introduce HeapSnapshot performance test.
+        https://bugs.webkit.org/show_bug.cgi?id=80280
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/HeapSnapshotProxy.js:
+        (WebInspector.HeapSnapshotLoaderProxy.prototype.finishLoading.updateStaticData):
+        (WebInspector.HeapSnapshotLoaderProxy.prototype.finishLoading):
+        (WebInspector.HeapSnapshotLoaderProxy.prototype._callLoadCallbacks):
+
 2012-03-05  Pavel Feldman  <pfeldman@chromium.org>
 
         Web Inspector: cannot be launched when localStorage is disabled
index 2b2823a..fe98f3c 100644 (file)
@@ -263,20 +263,22 @@ WebInspector.HeapSnapshotLoaderProxy.prototype = {
         delete this._onLoadCallbacks;
         this._loading = false;
         this._loaded = true;
-        function callLoadCallbacks(snapshotProxy)
-        {
-            for (var i = 0; i < loadCallbacks.length; ++i)
-                loadCallbacks[i](snapshotProxy);
-        }
+        var self = this;
         function updateStaticData(snapshotProxy)
         {
             this.dispose();
-            snapshotProxy.updateStaticData(callLoadCallbacks);
+            snapshotProxy.updateStaticData(this._callLoadCallbacks.bind(this, loadCallbacks));
         }
         this.callFactoryMethod(updateStaticData.bind(this), "finishLoading", "WebInspector.HeapSnapshotProxy");
         return true;
     },
 
+    _callLoadCallbacks: function(loadCallbacks, snapshotProxy)
+    {
+        for (var i = 0; i < loadCallbacks.length; ++i)
+            loadCallbacks[i](snapshotProxy);
+    },
+
     get loaded()
     {
         return this._loaded;