Title: [209213] trunk/Source/WebInspectorUI
Revision
209213
Author
mattba...@apple.com
Date
2016-12-01 14:32:33 -0800 (Thu, 01 Dec 2016)

Log Message

Web Inspector: Show async stack traces for workers
https://bugs.webkit.org/show_bug.cgi?id=165235
<rdar://problem/29450172>

Reviewed by Joseph Pecoraro.

* UserInterface/Views/CallFrameTreeElement.css:
(.tree-outline > .children > .item.call-frame.async-boundary):
(.tree-outline:not(.single-thread) > .children > .item.call-frame.async-boundary):
(.tree-outline .item.call-frame.async-boundary::before):
(.tree-outline.single-thread .item.call-frame.async-boundary::before):
(.tree-outline .item.call-frame.async-boundary): Deleted.
Style changes for single/multiple-thread call stacks.
Padding changes to account for Thread tree element.
Make selectors more specific where needed.

* UserInterface/Views/DebuggerSidebarPanel.css:
(.sidebar > .panel.navigation.debugger .tree-outline.single-thread > .item.thread):
(.sidebar > .panel.navigation.debugger .tree-outline.single-thread):
Style changes for single/multiple-thread call stacks.

* UserInterface/Views/DebuggerSidebarPanel.js:
(WebInspector.DebuggerSidebarPanel):
Use a single tree outline for showing a single thread or multiple threads.
For single-threaded, hide Thread tree element and un-indent children.

(WebInspector.DebuggerSidebarPanel.prototype._targetAdded):
(WebInspector.DebuggerSidebarPanel.prototype._targetRemoved):
(WebInspector.DebuggerSidebarPanel.prototype._updateCallStackTreeOutline):
Update tree style and whether Thread tree element is selectable.
(WebInspector.DebuggerSidebarPanel.prototype._debuggerActiveCallFrameDidChange):
Remove support for second tree outline.

(WebInspector.DebuggerSidebarPanel.prototype._updateSingleThreadCallStacks): Deleted.
(WebInspector.DebuggerSidebarPanel.prototype._selectActiveCallFrameTreeElement): Deleted.
(WebInspector.DebuggerSidebarPanel.prototype._showSingleThreadCallStacks): Deleted.
(WebInspector.DebuggerSidebarPanel.prototype._showMultipleThreadCallStacks): Deleted.
No longer needed after unifying tree outlines.

* UserInterface/Views/ThreadTreeElement.js:
(WebInspector.ThreadTreeElement.prototype.refresh):
Append call frames from the async stack trace.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (209212 => 209213)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-12-01 22:31:01 UTC (rev 209212)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-12-01 22:32:33 UTC (rev 209213)
@@ -1,3 +1,48 @@
+2016-12-01  Matt Baker  <mattba...@apple.com>
+
+        Web Inspector: Show async stack traces for workers
+        https://bugs.webkit.org/show_bug.cgi?id=165235
+        <rdar://problem/29450172>
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/CallFrameTreeElement.css:
+        (.tree-outline > .children > .item.call-frame.async-boundary):
+        (.tree-outline:not(.single-thread) > .children > .item.call-frame.async-boundary):
+        (.tree-outline .item.call-frame.async-boundary::before):
+        (.tree-outline.single-thread .item.call-frame.async-boundary::before):
+        (.tree-outline .item.call-frame.async-boundary): Deleted.
+        Style changes for single/multiple-thread call stacks.
+        Padding changes to account for Thread tree element.
+        Make selectors more specific where needed.
+
+        * UserInterface/Views/DebuggerSidebarPanel.css:
+        (.sidebar > .panel.navigation.debugger .tree-outline.single-thread > .item.thread):
+        (.sidebar > .panel.navigation.debugger .tree-outline.single-thread):
+        Style changes for single/multiple-thread call stacks.
+
+        * UserInterface/Views/DebuggerSidebarPanel.js:
+        (WebInspector.DebuggerSidebarPanel):
+        Use a single tree outline for showing a single thread or multiple threads.
+        For single-threaded, hide Thread tree element and un-indent children.
+
+        (WebInspector.DebuggerSidebarPanel.prototype._targetAdded):
+        (WebInspector.DebuggerSidebarPanel.prototype._targetRemoved):
+        (WebInspector.DebuggerSidebarPanel.prototype._updateCallStackTreeOutline):
+        Update tree style and whether Thread tree element is selectable.
+        (WebInspector.DebuggerSidebarPanel.prototype._debuggerActiveCallFrameDidChange):
+        Remove support for second tree outline.
+
+        (WebInspector.DebuggerSidebarPanel.prototype._updateSingleThreadCallStacks): Deleted.
+        (WebInspector.DebuggerSidebarPanel.prototype._selectActiveCallFrameTreeElement): Deleted.
+        (WebInspector.DebuggerSidebarPanel.prototype._showSingleThreadCallStacks): Deleted.
+        (WebInspector.DebuggerSidebarPanel.prototype._showMultipleThreadCallStacks): Deleted.
+        No longer needed after unifying tree outlines.
+
+        * UserInterface/Views/ThreadTreeElement.js:
+        (WebInspector.ThreadTreeElement.prototype.refresh):
+        Append call frames from the async stack trace.
+
 2016-11-30  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Clicking on link in Web Inspector can cause UIProcess to crash

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.css (209212 => 209213)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.css	2016-12-01 22:31:01 UTC (rev 209212)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.css	2016-12-01 22:32:33 UTC (rev 209213)
@@ -47,9 +47,12 @@
 .tree-outline .item.call-frame.async-boundary {
     cursor: default;
     color: var(--text-color-gray-medium);
-    padding-left: 0;
 }
 
+.tree-outline:not(.single-thread) > .children > .item.call-frame.async-boundary {
+    padding-left: 5px;
+}
+
 .tree-outline .item.call-frame.async-boundary .icon {
     float: none;
     display: inline-block;
@@ -72,6 +75,11 @@
 }
 
 .tree-outline .item.call-frame.async-boundary::before {
+    width: 30px;
+    margin-left: -5px;
+    margin-right: 1px;
+}
+
+.tree-outline.single-thread .item.call-frame.async-boundary::before {
     width: 20px;
-    margin-right: 2px;
 }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.css (209212 => 209213)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.css	2016-12-01 22:31:01 UTC (rev 209212)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.css	2016-12-01 22:32:33 UTC (rev 209213)
@@ -54,6 +54,14 @@
     background-color: hsl(50, 100%, 94%);
 }
 
+.sidebar > .panel.navigation.debugger .tree-outline.single-thread > .item.thread {
+    display: none;
+}
+
+.sidebar > .panel.navigation.debugger .tree-outline.single-thread {
+    margin-left: -10px;
+}
+
 .sidebar > .panel.navigation.debugger .warning-banner > a {
     text-decoration: underline;
     cursor: pointer;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js (209212 => 209213)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js	2016-12-01 22:31:01 UTC (rev 209212)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js	2016-12-01 22:32:33 UTC (rev 209213)
@@ -177,25 +177,20 @@
         this._callStackTreeOutline = this.createContentTreeOutline(dontHideByDefault, suppressFiltering);
         this._callStackTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
 
-        this._singleThreadCallStackTreeOutline = this.createContentTreeOutline(dontHideByDefault, suppressFiltering);
-        this._singleThreadCallStackTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange, this._treeSelectionDidChange, this);
+        this._mainTargetTreeElement = new WebInspector.ThreadTreeElement(WebInspector.mainTarget);
+        this._callStackTreeOutline.appendChild(this._mainTargetTreeElement);
 
-        let mainTargetTreeElement = new WebInspector.ThreadTreeElement(WebInspector.mainTarget);
-        this._callStackTreeOutline.appendChild(mainTargetTreeElement);
+        this._updateCallStackTreeOutline();
 
-        this._multipleThreadsCallStackRow = new WebInspector.DetailsSectionRow;
-        this._multipleThreadsCallStackRow.element.appendChild(this._callStackTreeOutline.element);
+        this._callStackRow = new WebInspector.DetailsSectionRow;
+        this._callStackRow.element.appendChild(this._callStackTreeOutline.element);
 
-        this._singleThreadCallStackRow = new WebInspector.DetailsSectionRow;
-        this._singleThreadCallStackRow.element.appendChild(this._singleThreadCallStackTreeOutline.element);
-
-        this._callStackGroup = new WebInspector.DetailsSectionGroup([this._singleThreadCallStackRow]);
+        this._callStackGroup = new WebInspector.DetailsSectionGroup([this._callStackRow]);
         this._callStackSection = new WebInspector.DetailsSection("call-stack", WebInspector.UIString("Call Stack"), [this._callStackGroup]);
 
         this._showingSingleThreadCallStack = true;
 
         this._activeCallFrameTreeElement = null;
-        this._singleThreadActiveCallFrameTreeElement = null;
 
         this._pauseReasonTreeOutline = null;
 
@@ -601,99 +596,6 @@
         this._removeDebuggerTreeElement(breakpointTreeElement);
     }
 
-    _updateSingleThreadCallStacks()
-    {
-        let targetData = WebInspector.debuggerManager.dataForTarget(WebInspector.mainTarget);
-        let callFrames = targetData.callFrames;
-
-        this._singleThreadCallStackTreeOutline.removeChildren();
-
-        if (!callFrames.length) {
-            this._singleThreadCallStackTreeOutline.appendChild(new WebInspector.IdleTreeElement);
-            return;
-        }
-
-        let activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
-        let activeCallFrameTreeElement = null;
-
-        for (let callFrame of callFrames) {
-            let callFrameTreeElement = new WebInspector.CallFrameTreeElement(callFrame);
-            if (callFrame === activeCallFrame)
-                activeCallFrameTreeElement = callFrameTreeElement;
-            this._singleThreadCallStackTreeOutline.appendChild(callFrameTreeElement);
-        }
-
-        if (activeCallFrameTreeElement) {
-            activeCallFrameTreeElement.isActiveCallFrame = true;
-            if (this._showingSingleThreadCallStack)
-                activeCallFrameTreeElement.select(true, true);
-        }
-
-        if (!targetData.asyncStackTrace)
-            return;
-
-        let currentStackTrace = targetData.asyncStackTrace;
-        while (currentStackTrace) {
-            console.assert(currentStackTrace.callFrames.length, "StackTrace should have non-empty call frames array.");
-            if (!currentStackTrace.callFrames.length)
-                break;
-
-            let boundaryCallFrame;
-            if (currentStackTrace.topCallFrameIsBoundary) {
-                boundaryCallFrame = currentStackTrace.callFrames[0];
-                console.assert(boundaryCallFrame.nativeCode && !boundaryCallFrame.sourceCodeLocation);
-            } else {
-                // Create a generic native CallFrame for the asynchronous boundary.
-                const functionName = WebInspector.UIString("(async)");
-                const nativeCode = true;
-                boundaryCallFrame = new WebInspector.CallFrame(null, null, null, functionName, null, null, nativeCode);
-            }
-
-            const isAsyncBoundaryCallFrame = true;
-            this._singleThreadCallStackTreeOutline.appendChild(new WebInspector.CallFrameTreeElement(boundaryCallFrame, isAsyncBoundaryCallFrame));
-
-            let startIndex = currentStackTrace.topCallFrameIsBoundary ? 1 : 0;
-            for (let i = startIndex; i < currentStackTrace.callFrames.length; ++i)
-                this._singleThreadCallStackTreeOutline.appendChild(new WebInspector.CallFrameTreeElement(currentStackTrace.callFrames[i]));
-
-            currentStackTrace = currentStackTrace.parentStackTrace;
-        }
-    }
-
-    _selectActiveCallFrameTreeElement(treeOutline)
-    {
-        let activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
-        if (activeCallFrame) {
-            let activeCallFrameTreeElement = treeOutline.findTreeElement(activeCallFrame);
-            if (activeCallFrameTreeElement)
-                activeCallFrameTreeElement.select(true, true);
-        }
-    }
-
-    _showSingleThreadCallStacks()
-    {
-        console.assert(!this._showingSingleThreadCallStack);
-        console.assert(WebInspector.targets.size === 1);
-
-        this._showingSingleThreadCallStack = true;
-
-        this._callStackGroup.rows = [this._singleThreadCallStackRow];
-
-        this._selectActiveCallFrameTreeElement(this._singleThreadCallStackTreeOutline);
-    }
-
-    _showMultipleThreadCallStacks()
-    {
-        console.assert(this._showingSingleThreadCallStack);
-        console.assert(WebInspector.targets.size > 1);
-
-        this._showingSingleThreadCallStack = false;
-
-        this._callStackGroup.rows = [this._multipleThreadsCallStackRow];
-
-        this._selectActiveCallFrameTreeElement(this._callStackTreeOutline);
-    }
-
     _findThreadTreeElementForTarget(target)
     {
         for (let child of this._callStackTreeOutline.children) {
@@ -710,8 +612,7 @@
         let treeElement = new WebInspector.ThreadTreeElement(target);
         this._callStackTreeOutline.appendChild(treeElement);
 
-        if (this._showingSingleThreadCallStack)
-            this._showMultipleThreadCallStacks();
+        this._updateCallStackTreeOutline();
     }
 
     _targetRemoved(event)
@@ -720,10 +621,16 @@
         let treeElement = this._findThreadTreeElementForTarget(target);
         this._callStackTreeOutline.removeChild(treeElement);
 
-        if (WebInspector.targets.size === 1)
-            this._showSingleThreadCallStacks();
+        this._updateCallStackTreeOutline();
     }
 
+    _updateCallStackTreeOutline()
+    {
+        let singleThreadShowing = WebInspector.targets.size === 1;
+        this._callStackTreeOutline.element.classList.toggle("single-thread", singleThreadShowing);
+        this._mainTargetTreeElement.selectable = !singleThreadShowing;
+    }
+
     _handleDebuggerObjectDisplayLocationDidChange(event)
     {
         var debuggerObject = event.target;
@@ -770,9 +677,6 @@
         let target = event.data.target;
         let treeElement = this._findThreadTreeElementForTarget(target);
         treeElement.refresh();
-
-        if (target === WebInspector.mainTarget)
-            this._updateSingleThreadCallStacks();
     }
 
     _debuggerActiveCallFrameDidChange()
@@ -781,10 +685,6 @@
             this._activeCallFrameTreeElement.isActiveCallFrame = false;
             this._activeCallFrameTreeElement = null;
         }
-        if (this._singleThreadActiveCallFrameTreeElement) {
-            this._singleThreadActiveCallFrameTreeElement.isActiveCallFrame = false;
-            this._singleThreadActiveCallFrameTreeElement = null;
-        }
 
         if (!WebInspector.debuggerManager.activeCallFrame)
             return;
@@ -792,10 +692,6 @@
         this._activeCallFrameTreeElement = this._callStackTreeOutline.findTreeElement(WebInspector.debuggerManager.activeCallFrame);
         if (this._activeCallFrameTreeElement)
             this._activeCallFrameTreeElement.isActiveCallFrame = true;
-
-        this._singleThreadActiveCallFrameTreeElement = this._singleThreadCallStackTreeOutline.findTreeElement(WebInspector.debuggerManager.activeCallFrame);
-        if (this._singleThreadActiveCallFrameTreeElement)
-            this._singleThreadActiveCallFrameTreeElement.isActiveCallFrame = true;
     }
 
     _breakpointsBeneathTreeElement(treeElement)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js (209212 => 209213)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js	2016-12-01 22:31:01 UTC (rev 209212)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ThreadTreeElement.js	2016-12-01 22:32:33 UTC (rev 209213)
@@ -66,6 +66,33 @@
             activeCallFrameTreeElement.isActiveCallFrame = true;
         }
 
+        let currentStackTrace = targetData.asyncStackTrace;
+        while (currentStackTrace) {
+            console.assert(currentStackTrace.callFrames.length, "StackTrace should have non-empty call frames array.");
+            if (!currentStackTrace.callFrames.length)
+                break;
+
+            let boundaryCallFrame;
+            if (currentStackTrace.topCallFrameIsBoundary) {
+                boundaryCallFrame = currentStackTrace.callFrames[0];
+                console.assert(boundaryCallFrame.nativeCode && !boundaryCallFrame.sourceCodeLocation);
+            } else {
+                // Create a generic native CallFrame for the asynchronous boundary.
+                const functionName = WebInspector.UIString("(async)");
+                const nativeCode = true;
+                boundaryCallFrame = new WebInspector.CallFrame(null, null, null, functionName, null, null, nativeCode);
+            }
+
+            const isAsyncBoundaryCallFrame = true;
+            this.appendChild(new WebInspector.CallFrameTreeElement(boundaryCallFrame, isAsyncBoundaryCallFrame));
+
+            let startIndex = currentStackTrace.topCallFrameIsBoundary ? 1 : 0;
+            for (let i = startIndex; i < currentStackTrace.callFrames.length; ++i)
+                this.appendChild(new WebInspector.CallFrameTreeElement(currentStackTrace.callFrames[i]));
+
+            currentStackTrace = currentStackTrace.parentStackTrace;
+        }
+
         this.expand();
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to