Title: [113708] trunk/Source/WebCore
Revision
113708
Author
loi...@chromium.org
Date
2012-04-10 04:34:06 -0700 (Tue, 10 Apr 2012)

Log Message

Web Inspector: use maxJSObjectId that is provided by back-end.
https://bugs.webkit.org/show_bug.cgi?id=82451

Summary view can filter objects in snapshot. It uses maxJSObjectId for this.
There was no such field in the profile header at the
moment but I've landed a patch in downstream.

Reviewed by Yury Semikhatsky.

* bindings/js/ScriptHeapSnapshot.h:
(WebCore):
(WebCore::ScriptHeapSnapshot::maxSnapshotJSObjectId):
* bindings/v8/ScriptHeapSnapshot.cpp:
(WebCore::ScriptHeapSnapshot::maxSnapshotJSObjectId):
(WebCore):
* bindings/v8/ScriptHeapSnapshot.h:
(WebCore):
(ScriptHeapSnapshot):
* inspector/InspectorProfilerAgent.cpp:
(WebCore::InspectorProfilerAgent::createSnapshotHeader):
* inspector/front-end/DetailedHeapshotView.js:
(WebInspector.HeapSnapshotConstructorsDataGrid):
(WebInspector.HeapSnapshotConstructorsDataGrid.prototype.setDataSource):
(WebInspector.HeapSnapshotConstructorsDataGrid.prototype.populateChildren):
(WebInspector.HeapSnapshotConstructorsDataGrid.prototype._filterSelectIndexChanged):
(WebInspector.DetailedHeapshotView.prototype._changeFilter):
* inspector/front-end/HeapSnapshot.js:
(WebInspector.HeapSnapshot.prototype.updateStaticData):
* inspector/front-end/HeapSnapshotProxy.js:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113707 => 113708)


--- trunk/Source/WebCore/ChangeLog	2012-04-10 11:26:53 UTC (rev 113707)
+++ trunk/Source/WebCore/ChangeLog	2012-04-10 11:34:06 UTC (rev 113708)
@@ -1,3 +1,35 @@
+2012-04-10  Ilya Tikhonovsky  <loi...@chromium.org>
+
+        Web Inspector: use maxJSObjectId that is provided by back-end.
+        https://bugs.webkit.org/show_bug.cgi?id=82451
+
+        Summary view can filter objects in snapshot. It uses maxJSObjectId for this.
+        There was no such field in the profile header at the
+        moment but I've landed a patch in downstream.
+
+        Reviewed by Yury Semikhatsky.
+
+        * bindings/js/ScriptHeapSnapshot.h:
+        (WebCore):
+        (WebCore::ScriptHeapSnapshot::maxSnapshotJSObjectId):
+        * bindings/v8/ScriptHeapSnapshot.cpp:
+        (WebCore::ScriptHeapSnapshot::maxSnapshotJSObjectId):
+        (WebCore):
+        * bindings/v8/ScriptHeapSnapshot.h:
+        (WebCore):
+        (ScriptHeapSnapshot):
+        * inspector/InspectorProfilerAgent.cpp:
+        (WebCore::InspectorProfilerAgent::createSnapshotHeader):
+        * inspector/front-end/DetailedHeapshotView.js:
+        (WebInspector.HeapSnapshotConstructorsDataGrid):
+        (WebInspector.HeapSnapshotConstructorsDataGrid.prototype.setDataSource):
+        (WebInspector.HeapSnapshotConstructorsDataGrid.prototype.populateChildren):
+        (WebInspector.HeapSnapshotConstructorsDataGrid.prototype._filterSelectIndexChanged):
+        (WebInspector.DetailedHeapshotView.prototype._changeFilter):
+        * inspector/front-end/HeapSnapshot.js:
+        (WebInspector.HeapSnapshot.prototype.updateStaticData):
+        * inspector/front-end/HeapSnapshotProxy.js:
+
 2012-04-09  Pavel Feldman  <pfeld...@chromium.org>
 
         Web Inspector: annotate front-end for newer closure compiler.

Modified: trunk/Source/WebCore/bindings/js/ScriptHeapSnapshot.h (113707 => 113708)


--- trunk/Source/WebCore/bindings/js/ScriptHeapSnapshot.h	2012-04-10 11:26:53 UTC (rev 113707)
+++ trunk/Source/WebCore/bindings/js/ScriptHeapSnapshot.h	2012-04-10 11:34:06 UTC (rev 113708)
@@ -36,6 +36,8 @@
 
 namespace WebCore {
 
+typedef uint32_t SnapshotObjectId;
+
 class ScriptHeapSnapshot : public RefCounted<ScriptHeapSnapshot> {
 public:
     class OutputStream {
@@ -51,6 +53,7 @@
     unsigned int uid() const { return 0; }
 
     void writeJSON(OutputStream*) { }
+    SnapshotObjectId maxSnapshotJSObjectId() const { return 0; }
 
 private:
     ScriptHeapSnapshot() { }

Modified: trunk/Source/WebCore/bindings/v8/ScriptHeapSnapshot.cpp (113707 => 113708)


--- trunk/Source/WebCore/bindings/v8/ScriptHeapSnapshot.cpp	2012-04-10 11:26:53 UTC (rev 113707)
+++ trunk/Source/WebCore/bindings/v8/ScriptHeapSnapshot.cpp	2012-04-10 11:34:06 UTC (rev 113708)
@@ -56,6 +56,11 @@
     return m_snapshot->GetUid();
 }
 
+SnapshotObjectId ScriptHeapSnapshot::maxSnapshotJSObjectId() const
+{
+    return m_snapshot->GetMaxSnapshotJSObjectId();
+}
+
 namespace {
 
 class OutputStreamAdapter : public v8::OutputStream {

Modified: trunk/Source/WebCore/bindings/v8/ScriptHeapSnapshot.h (113707 => 113708)


--- trunk/Source/WebCore/bindings/v8/ScriptHeapSnapshot.h	2012-04-10 11:26:53 UTC (rev 113707)
+++ trunk/Source/WebCore/bindings/v8/ScriptHeapSnapshot.h	2012-04-10 11:34:06 UTC (rev 113708)
@@ -41,6 +41,7 @@
 namespace WebCore {
 
 class InspectorObject;
+typedef uint32_t SnapshotObjectId;
 
 class ScriptHeapSnapshot : public RefCounted<ScriptHeapSnapshot> {
 public:
@@ -60,6 +61,7 @@
     String title() const;
     unsigned int uid() const;
     void writeJSON(OutputStream* stream);
+    SnapshotObjectId maxSnapshotJSObjectId() const;
 
 private:
     ScriptHeapSnapshot(const v8::HeapSnapshot* snapshot)

Modified: trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp (113707 => 113708)


--- trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp	2012-04-10 11:26:53 UTC (rev 113707)
+++ trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp	2012-04-10 11:34:06 UTC (rev 113708)
@@ -182,6 +182,7 @@
     header->setString("title", snapshot.title());
     header->setNumber("uid", snapshot.uid());
     header->setString("typeId", String(HeapProfileType));
+    header->setNumber("maxJSObjectId", snapshot.maxSnapshotJSObjectId());
     return header;
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js (113707 => 113708)


--- trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js	2012-04-10 11:26:53 UTC (rev 113707)
+++ trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js	2012-04-10 11:34:06 UTC (rev 113708)
@@ -225,7 +225,7 @@
         retainedSize: { title: WebInspector.UIString("Retained Size"), width: "120px", sort: "descending", sortable: true }
     };
     WebInspector.HeapSnapshotSortableDataGrid.call(this, columns);
-    this._filterProfileIndex = -1;
+    this._profileIndex = -1;
 }
 
 WebInspector.HeapSnapshotConstructorsDataGrid.prototype = {
@@ -246,7 +246,7 @@
     {
         this.snapshotView = snapshotView;
         this.snapshot = snapshot;
-        if (this._filterProfileIndex === -1)
+        if (this._profileIndex === -1)
             this.populateChildren();
     },
 
@@ -263,42 +263,25 @@
         this.removeChildren();
         this.resetSortingCache();
 
-        var key = this._filterProfileIndex === -1 ? "allObjects" : this._minNodeId + ".." + this._maxNodeId;
-        var filter = this._filterProfileIndex === -1 ? null : "function(node) { var id = node.id; return id > " + this._minNodeId + " && id <= " + this._maxNodeId + "; }";
+        var key = this._profileIndex === -1 ? "allObjects" : this._minNodeId + ".." + this._maxNodeId;
+        var filter = this._profileIndex === -1 ? null : "function(node) { var id = node.id; return id > " + this._minNodeId + " && id <= " + this._maxNodeId + "; }";
 
         this.snapshot.aggregates(false, key, filter, aggregatesReceived.bind(this, key));
     },
 
-    _filterSelectIndexChanged: function(loader, profileIndex)
+    _filterSelectIndexChanged: function(profiles, profileIndex)
     {
-        this._filterProfileIndex = profileIndex;
+        this._profileIndex = profileIndex;
 
         delete this._maxNodeId;
         delete this._minNodeId;
 
-        if (this._filterProfileIndex === -1) {
-            this.populateChildren();
-            return;
+        if (this._profileIndex !== -1) {
+            this._minNodeId = profileIndex > 0 ? profiles[profileIndex - 1].maxJSObjectId : 0;
+            this._maxNodeId = profiles[profileIndex].maxJSObjectId;
         }
 
-        function firstSnapshotLoaded(snapshot)
-        {
-            this._maxNodeId = snapshot.maxNodeId;
-            if (profileIndex > 0)
-                loader(profileIndex - 1, secondSnapshotLoaded.bind(this));
-            else {
-                this._minNodeId = 0;
-                this.populateChildren();
-            }
-        }
-
-        function secondSnapshotLoaded(snapshot)
-        {
-            this._minNodeId = snapshot.maxNodeId;
-            this.populateChildren();
-        }
-
-        loader(profileIndex, firstSnapshotLoaded.bind(this));
+        this.populateChildren();
     },
 
 };
@@ -778,7 +761,7 @@
     _changeFilter: function()
     {
         var profileIndex = this.filterSelectElement.selectedIndex - 1;
-        this.dataGrid._filterSelectIndexChanged(this._loadProfileByIndex.bind(this), profileIndex);
+        this.dataGrid._filterSelectIndexChanged(this._profiles(), profileIndex);
 
         if (!this.currentQuery || !this._searchFinishedCallback || !this._searchResults)
             return;

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js (113707 => 113708)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-04-10 11:26:53 UTC (rev 113707)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshot.js	2012-04-10 11:34:06 UTC (rev 113708)
@@ -987,19 +987,6 @@
         return new WebInspector.HeapSnapshotNode(this, this._rootNodeIndex);
     },
 
-    get maxNodeId()
-    {
-        if (typeof this._maxNodeId === "number")
-            return this._maxNodeId;
-        this._maxNodeId = 0;
-        for (var nodeIdIndex = this._nodeIdOffset; nodeIdIndex < this._onlyNodes.length; nodeIdIndex += this._nodeFieldCount) {
-            var id = this._onlyNodes[nodeIdIndex];
-            if ((id % 2) && id > this._maxNodeId)
-                this._maxNodeId = id;
-        }
-        return this._maxNodeId;
-    },
-
     get rootNodeIndex()
     {
         return this._rootNodeIndex;
@@ -1434,7 +1421,7 @@
 
     updateStaticData: function()
     {
-        return {nodeCount: this.nodeCount, rootNodeIndex: this._rootNodeIndex, totalSize: this.totalSize, uid: this.uid, nodeFlags: this._nodeFlags, maxNodeId: this.maxNodeId};
+        return {nodeCount: this.nodeCount, rootNodeIndex: this._rootNodeIndex, totalSize: this.totalSize, uid: this.uid, nodeFlags: this._nodeFlags};
     }
 };
 

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js (113707 => 113708)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js	2012-04-10 11:26:53 UTC (rev 113707)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js	2012-04-10 11:34:06 UTC (rev 113708)
@@ -369,11 +369,6 @@
         return !!this._objectId;
     },
 
-    get maxNodeId()
-    {
-        return this._staticData.maxNodeId;
-    },
-
     get nodeCount()
     {
         return this._staticData.nodeCount;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to