Web Inspector: Remove time and weight from the dashboard
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Apr 2015 01:19:08 +0000 (01:19 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Apr 2015 01:19:08 +0000 (01:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144063

These two items were the odd ones out since they are only available
when recording a timeline. We will need the toolbar space soon, so make
this lets us make the dashboard skinnier.

This also removes the exception catching in DashboardContainerView. It doesn't really
help us and it makes debugging an exception harder.

Reviewed by Joseph Pecoraro.

* UserInterface/Views/DashboardContainerView.css:
(.toolbar .dashboard-container):
* UserInterface/Views/DashboardContainerView.js:
(WebInspector.DashboardContainerView.prototype._dashboardViewForRepresentedObject):
* UserInterface/Views/DefaultDashboardView.css:
(body.web .toolbar.collapsed .dashboard.default > .item.resourcesCount):
(body.javascript .toolbar .dashboard.default > .item.resourcesCount):
* UserInterface/Views/DefaultDashboardView.js:
(WebInspector.DefaultDashboardView):
(WebInspector.DefaultDashboardView.prototype._updateDisplay):

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js
Source/WebInspectorUI/UserInterface/Views/DashboardContainerView.css
Source/WebInspectorUI/UserInterface/Views/DashboardContainerView.js
Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.css
Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.js

index e78566c..d6c62bf 100644 (file)
@@ -1,5 +1,30 @@
 2015-04-22  Timothy Hatcher  <timothy@apple.com>
 
+        Web Inspector: Remove time and weight from the dashboard
+        https://bugs.webkit.org/show_bug.cgi?id=144063
+
+        These two items were the odd ones out since they are only available
+        when recording a timeline. We will need the toolbar space soon, so make
+        this lets us make the dashboard skinnier.
+
+        This also removes the exception catching in DashboardContainerView. It doesn't really
+        help us and it makes debugging an exception harder.
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/DashboardContainerView.css:
+        (.toolbar .dashboard-container):
+        * UserInterface/Views/DashboardContainerView.js:
+        (WebInspector.DashboardContainerView.prototype._dashboardViewForRepresentedObject):
+        * UserInterface/Views/DefaultDashboardView.css:
+        (body.web .toolbar.collapsed .dashboard.default > .item.resourcesCount):
+        (body.javascript .toolbar .dashboard.default > .item.resourcesCount):
+        * UserInterface/Views/DefaultDashboardView.js:
+        (WebInspector.DefaultDashboardView):
+        (WebInspector.DefaultDashboardView.prototype._updateDisplay):
+
+2015-04-22  Timothy Hatcher  <timothy@apple.com>
+
         Web Inspector: Remove sidebar panel shortcut and image
         https://bugs.webkit.org/show_bug.cgi?id=144061
 
index 1ecbbe4..e9d9d9c 100644 (file)
@@ -31,10 +31,6 @@ WebInspector.DefaultDashboard = class DefaultDashboard extends WebInspector.Obje
 
         this._waitingForFirstMainResourceToStartTrackingSize = true;
 
-        // Necessary event required to track page load time and resource sizes.
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
-
         // Necessary events required to track load of resources.
         WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
         WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasAdded, this._frameWasAdded, this);
@@ -47,8 +43,6 @@ WebInspector.DefaultDashboard = class DefaultDashboard extends WebInspector.Obje
         logManager.addEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, this._consoleMessageWasRepeated, this);
 
         this._resourcesCount = 0;
-        this._resourcesSize = 0;
-        this._time = 0;
         this._logs = 0;
         this._errors = 0;
         this._issues = 0;
@@ -67,28 +61,6 @@ WebInspector.DefaultDashboard = class DefaultDashboard extends WebInspector.Obje
         this._dataDidChange();
     }
 
-    get resourcesSize()
-    {
-        return this._resourcesSize;
-    }
-
-    set resourcesSize(value)
-    {
-        this._resourcesSize = value;
-        this._dataDidChange();
-    }
-
-    get time()
-    {
-        return this._time;
-    }
-
-    set time(value)
-    {
-        this._time = value;
-        this._dataDidChange();
-    }
-
     get logs()
     {
         return this._logs;
@@ -129,38 +101,6 @@ WebInspector.DefaultDashboard = class DefaultDashboard extends WebInspector.Obje
         this.dispatchEventToListeners(WebInspector.DefaultDashboard.Event.DataDidChange);
     }
 
-    _mainResourceDidChange(event)
-    {
-        console.assert(event.target instanceof WebInspector.Frame);
-
-        if (!event.target.isMainFrame())
-            return;
-
-        this._resourcesCount = 1;
-        this._resourcesSize = WebInspector.frameResourceManager.mainFrame.mainResource.size || 0;
-
-        // Only update the time if we are recording the timeline.
-        if (!WebInspector.timelineManager.isCapturing()) {
-            this._time = 0;
-            return;
-        }
-
-        // We should only track resource sizes on fresh loads.
-        if (this._waitingForFirstMainResourceToStartTrackingSize) {
-            delete this._waitingForFirstMainResourceToStartTrackingSize;
-            WebInspector.Resource.addEventListener(WebInspector.Resource.Event.SizeDidChange, this._resourceSizeDidChange, this);
-        }
-
-        this._dataDidChange();
-        this._startUpdatingTime();
-    }
-
-    _capturingStopped(event)
-    {
-        // If recording stops, we should stop the timer if it hasn't stopped already.
-        this._stopUpdatingTime();
-    }
-
     _resourceWasAdded(event)
     {
         ++this.resourcesCount;
@@ -176,59 +116,6 @@ WebInspector.DefaultDashboard = class DefaultDashboard extends WebInspector.Obje
         this.resourcesSize += event.target.size - event.data.previousSize;
     }
 
-    _startUpdatingTime()
-    {
-        this._stopUpdatingTime();
-
-        this.time = 0;
-
-        this._timelineBaseTime = Date.now();
-        this._timeIntervalDelay = 50;
-        this._timeIntervalIdentifier = setInterval(this._updateTime.bind(this), this._timeIntervalDelay);
-    }
-
-    _stopUpdatingTime()
-    {
-        if (!this._timeIntervalIdentifier)
-            return;
-
-        clearInterval(this._timeIntervalIdentifier);
-        delete this._timeIntervalIdentifier;
-    }
-
-    _updateTime()
-    {
-        var duration = Date.now() - this._timelineBaseTime;
-
-        var timeIntervalDelay = this._timeIntervalDelay;
-        if (duration >= 1000) // 1 second
-            timeIntervalDelay = 100;
-        else if (duration >= 60000) // 60 seconds
-            timeIntervalDelay = 1000;
-        else if (duration >= 3600000) // 1 minute
-            timeIntervalDelay = 10000;
-
-        if (timeIntervalDelay !== this._timeIntervalDelay) {
-            this._timeIntervalDelay = timeIntervalDelay;
-
-            clearInterval(this._timeIntervalIdentifier);
-            this._timeIntervalIdentifier = setInterval(this._updateTime.bind(this), this._timeIntervalDelay);
-        }
-
-        var mainFrame = WebInspector.frameResourceManager.mainFrame;
-        var mainFrameStartTime = mainFrame.mainResource.firstTimestamp;
-        var mainFrameLoadEventTime = mainFrame.loadEventTimestamp;
-
-        if (isNaN(mainFrameStartTime) || isNaN(mainFrameLoadEventTime)) {
-            this.time = duration / 1000;
-            return;
-        }
-
-        this.time = mainFrameLoadEventTime - mainFrameStartTime;
-
-        this._stopUpdatingTime();
-    }
-
     _consoleMessageAdded(event)
     {
         var message = event.data.message;
index 645d7c8..10c5494 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -26,7 +26,7 @@
 .toolbar .dashboard-container {
     position: relative;
 
-    width: 375px;
+    width: 225px;
 
     border-radius: 4px;
     background-color: rgb(252, 252, 252);
index 9a4e2f0..94f2d26 100644 (file)
@@ -136,13 +136,12 @@ WebInspector.DashboardContainerView = class DashboardContainerView extends WebIn
         if (onlyReturnExistingViews)
             return null;
 
-        try {
-            // No existing content view found, make a new one.
-            dashboardView = WebInspector.DashboardView.create(representedObject);
-        } catch (e) {
-            console.error(e, e.stack);
+        // No existing content view found, make a new one.
+        dashboardView = WebInspector.DashboardView.create(representedObject);
+
+        console.assert(dashboardView, "Unknown representedObject", representedObject);
+        if (!dashboardView)
             return null;
-        }
 
         this._dashboardStack.push(dashboardView);
         this._toolbarItem.element.appendChild(dashboardView.element);
index 41ecf01..1bfcbb2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-body.web .toolbar.collapsed .dashboard.default > :matches(.time, .resourcesSize, .logs) {
+body.web .toolbar.collapsed .dashboard.default > .item.resourcesCount {
     display: none;
 }
 
-body.javascript .toolbar .dashboard.default > :matches(.time, .resourcesSize, .resourcesCount) {
+body.javascript .toolbar .dashboard.default > .item.resourcesCount {
     display: none;
 }
 
@@ -58,11 +58,6 @@ body.mac-platform.legacy .toolbar .dashboard.default > .item {
     font-weight: bold;
 }
 
-.toolbar .dashboard.default > .time,
-.toolbar .dashboard.default > .resourcesSize {
-    min-width: 70px;
-}
-
 .toolbar .dashboard.default > .item.enabled:hover {
     border: 1px solid rgba(0, 0, 0, 0.1);
 }
@@ -111,18 +106,10 @@ body.mac-platform.legacy .toolbar .dashboard.default > .item {
     content: url(../Images/Resources.svg);
 }
 
-.toolbar .dashboard.default > .time > img {
-    content: url(../Images/Time.svg);
-}
-
 .toolbar .dashboard.default > .logs > img {
     content: url(../Images/Logs.svg);
 }
 
-.toolbar .dashboard.default > .resourcesSize > img {
-    content: url(../Images/Weight.svg);
-}
-
 .toolbar .dashboard.default > .errors > img {
     content: url(../Images/Errors.svg);
 }
@@ -136,18 +123,10 @@ body.mac-platform.legacy .toolbar .dashboard.default > .resourcesCount > img {
     content: url(../Images/Legacy/Resources.svg);
 }
 
-body.mac-platform.legacy .toolbar .dashboard.default > .time > img {
-    content: url(../Images/Legacy/Time.svg);
-}
-
 body.mac-platform.legacy .toolbar .dashboard.default > .logs > img {
     content: url(../Images/Legacy/Logs.svg);
 }
 
-body.mac-platform.legacy .toolbar .dashboard.default > .resourcesSize > img {
-    content: url(../Images/Legacy/Weight.svg);
-}
-
 body.mac-platform.legacy .toolbar .dashboard.default > .errors > img {
     content: url(../Images/Legacy/Errors.svg);
 }
index cd0bf89..f7f3706 100644 (file)
@@ -36,14 +36,6 @@ WebInspector.DefaultDashboardView = class DefaultDashboardView extends WebInspec
                 tooltip: WebInspector.UIString("Total number of resources, click to show the Resources navigation sidebar"),
                 handler: this._resourcesWasClicked
             },
-            resourcesSize: {
-                tooltip: WebInspector.UIString("Total size of all resources, click to show the Network Requests timeline"),
-                handler: this._networkItemWasClicked
-            },
-            time: {
-                tooltip: WebInspector.UIString("Time until the load event fired, click to show the Network Requests timeline"),
-                handler: this._networkItemWasClicked
-            },
             logs: {
                 tooltip: WebInspector.UIString("Console logs, click to show the Console"),
                 handler: this._consoleItemWasClicked.bind(this, WebInspector.LogContentView.Scopes.Logs)
@@ -71,17 +63,9 @@ WebInspector.DefaultDashboardView = class DefaultDashboardView extends WebInspec
         for (var category of ["logs", "issues", "errors"])
             this._setConsoleItemValue(category, dashboard[category]);
 
-        var timeItem = this._items.time;
-        timeItem.text = dashboard.time ? Number.secondsToString(dashboard.time) : "\u2014";
-        this._setItemEnabled(timeItem, dashboard.time > 0);
-
         var countItem = this._items.resourcesCount;
         countItem.text = this._formatPossibleLargeNumber(dashboard.resourcesCount);
         this._setItemEnabled(countItem, dashboard.resourcesCount > 0);
-
-        var sizeItem = this._items.resourcesSize;
-        sizeItem.text = dashboard.resourcesSize ? Number.bytesToString(dashboard.resourcesSize, false) : "\u2014";
-        this._setItemEnabled(sizeItem, dashboard.resourcesSize > 0);
     }
 
     _formatPossibleLargeNumber(number)