Commit 3d837ef6 authored by timothy@apple.com's avatar timothy@apple.com

Remove a lot of the current Timelines code to make room for a new implementation.

https://bugs.webkit.org/show_bug.cgi?id=123368

Reviewed by Joseph Pecoraro.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/ContentView.js:
(WebInspector.ContentView):
(WebInspector.ContentView.isViewable):
* UserInterface/DashboardView.js:
(WebInspector.DashboardView.prototype._networkItemWasClicked):
* UserInterface/InspectorFrontendAPI.js:
(InspectorFrontendAPI.setTimelineProfilingEnabled):
(InspectorFrontendAPI.stopProfilingJavaScript):
* UserInterface/InstrumentSidebarPanel.js: Removed.
* UserInterface/Main.html:
* UserInterface/Main.js:
(WebInspector.contentLoaded):
(WebInspector.sidebarPanelForRepresentedObject):
(WebInspector.openURL):
* UserInterface/Object.js:
(WebInspector.Object.addEventListener):
* UserInterface/TimelineManager.js:
(WebInspector.TimelineManager):
(WebInspector.TimelineManager.prototype.startRecording):
(WebInspector.TimelineManager.prototype.eventRecorded.processRecord):
(WebInspector.TimelineManager.prototype.eventRecorded):
(WebInspector.TimelineManager.prototype.objectForCookie):
(WebInspector.TimelineManager.prototype._addRecord):
* UserInterface/TimelinesObject.js: Removed.
* UserInterface/TimelineOverview.css: Removed.
* UserInterface/TimelineOverview.js: Removed.
* UserInterface/TimelineSidebarPanel.css: Added.
* UserInterface/TimelineSidebarPanel.js: Added.
(WebInspector.TimelineSidebarPanel):
* UserInterface/TimelinesContentView.css: Removed.
* UserInterface/TimelinesContentView.js: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162397 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 22ec5d1b
2013-10-25 Timothy Hatcher <timothy@apple.com>
Remove a lot of the current Timelines code to make room for a new implementation.
https://bugs.webkit.org/show_bug.cgi?id=123368
Reviewed by Joseph Pecoraro.
* Localizations/en.lproj/localizedStrings.js:
* UserInterface/ContentView.js:
(WebInspector.ContentView):
(WebInspector.ContentView.isViewable):
* UserInterface/DashboardView.js:
(WebInspector.DashboardView.prototype._networkItemWasClicked):
* UserInterface/InspectorFrontendAPI.js:
(InspectorFrontendAPI.setTimelineProfilingEnabled):
(InspectorFrontendAPI.stopProfilingJavaScript):
* UserInterface/InstrumentSidebarPanel.js: Removed.
* UserInterface/Main.html:
* UserInterface/Main.js:
(WebInspector.contentLoaded):
(WebInspector.sidebarPanelForRepresentedObject):
(WebInspector.openURL):
* UserInterface/Object.js:
(WebInspector.Object.addEventListener):
* UserInterface/TimelineManager.js:
(WebInspector.TimelineManager):
(WebInspector.TimelineManager.prototype.startRecording):
(WebInspector.TimelineManager.prototype.eventRecorded.processRecord):
(WebInspector.TimelineManager.prototype.eventRecorded):
(WebInspector.TimelineManager.prototype.objectForCookie):
(WebInspector.TimelineManager.prototype._addRecord):
* UserInterface/TimelinesObject.js: Removed.
* UserInterface/TimelineOverview.css: Removed.
* UserInterface/TimelineOverview.js: Removed.
* UserInterface/TimelineSidebarPanel.css: Added.
* UserInterface/TimelineSidebarPanel.js: Added.
(WebInspector.TimelineSidebarPanel):
* UserInterface/TimelinesContentView.css: Removed.
* UserInterface/TimelinesContentView.js: Removed.
2014-01-20 Timothy Hatcher <timothy@apple.com>
Fix jumping to a text position when showing a resource.
......
......@@ -60,9 +60,6 @@ WebInspector.ContentView = function(representedObject)
if (representedObject instanceof WebInspector.LogObject)
return new WebInspector.LogContentView(representedObject);
if (representedObject instanceof WebInspector.TimelinesObject)
return new WebInspector.TimelinesContentView(representedObject);
if (representedObject instanceof WebInspector.JavaScriptProfileObject)
return new WebInspector.JavaScriptProfileView(representedObject);
......@@ -118,8 +115,6 @@ WebInspector.ContentView.isViewable = function(representedObject)
return true;
if (representedObject instanceof WebInspector.LogObject)
return true;
if (representedObject instanceof WebInspector.TimelinesObject)
return true;
if (representedObject instanceof WebInspector.JavaScriptProfileObject)
return true;
if (representedObject instanceof WebInspector.CanvasProfileObject)
......
......@@ -191,8 +191,7 @@ WebInspector.DashboardView.prototype = {
_networkItemWasClicked: function()
{
WebInspector.navigationSidebar.selectedSidebarPanel = WebInspector.instrumentSidebarPanel;
WebInspector.instrumentSidebarPanel.showTimelineForRecordType(WebInspector.TimelineRecord.Type.Network);
WebInspector.navigationSidebar.selectedSidebarPanel = WebInspector.timelineSidebarPanel;
},
_consoleItemWasClicked: function(scope)
......
......@@ -57,8 +57,7 @@ InspectorFrontendAPI = {
setTimelineProfilingEnabled: function(enabled)
{
if (enabled) {
WebInspector.navigationSidebar.selectedSidebarPanel = WebInspector.instrumentSidebarPanel;
WebInspector.instrumentSidebarPanel.showTimeline();
WebInspector.navigationSidebar.selectedSidebarPanel = WebInspector.timelineSidebarPanel;
WebInspector.timelineManager.startRecording();
} else {
WebInspector.timelineManager.stopRecording();
......@@ -77,7 +76,7 @@ InspectorFrontendAPI = {
stopProfilingJavaScript: function()
{
WebInspector.instrumentSidebarPanel.show();
WebInspector.timelineSidebarPanel.show();
WebInspector.profileManager.stopProfilingJavaScript();
},
......
/*
* Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
.sidebar > .panel.instrument > .title-bar {
position: absolute;
left: 0;
right: 0;
box-shadow: inset rgba(255, 255, 255, 0.2) 0 1px 0;
border-bottom: 1px solid rgb(179, 179, 179);
height: 22px;
padding: 4px 6px;
font-size: 11px;
font-family: "Lucida Grande", sans-serif;
white-space: nowrap;
overflow: hidden;
}
.sidebar > .panel.instrument > .title-bar.timelines {
top: 0;
}
.sidebar > .panel.instrument > .title-bar > .record-glyph {
position: absolute;
top: 0;
right: 0;
width: 21px;
height: 21px;
padding: 0;
border: none;
outline: none;
color: transparent;
overflow: hidden;
-webkit-appearance: none;
background-color: transparent;
background-image: -webkit-image-set(url(Images/RecordingStopped.png) 1x, url(Images/RecordingStopped@2x.png) 2x);
background-repeat: no-repeat;
background-size: 21px 21px;
}
.sidebar > .panel.instrument > .title-bar > .record-glyph.recording {
background-image: -webkit-image-set(url(Images/Recording.png) 1x, url(Images/Recording@2x.png) 2x);
}
.sidebar > .panel.instrument > .title-bar > .record-glyph:hover {
background-image: -webkit-image-set(url(Images/RecordingHovered.png) 1x, url(Images/RecordingHovered@2x.png) 2x);
}
.sidebar > .panel.instrument > .title-bar > .record-glyph.recording:hover {
background-image: -webkit-image-set(url(Images/RecordingStopped.png) 1x, url(Images/RecordingStopped@2x.png) 2x);
}
.sidebar > .panel.instrument > .title-bar > .record-glyph.forced {
background-image: -webkit-image-set(url(Images/RecordingStopped.png) 1x, url(Images/RecordingStopped@2x.png) 2x) !important;
}
.sidebar > .panel.instrument > .title-bar > .record-glyph.recording.forced {
background-image: -webkit-image-set(url(Images/Recording.png) 1x, url(Images/Recording@2x.png) 2x) !important;
}
.sidebar > .panel.instrument > .title-bar > .record-status {
position: absolute;
top: 0;
right: 21px;
line-height: 20px;
color: rgb(76, 76, 76);
}
.sidebar > .panel.instrument > .navigation-sidebar-panel-content-tree-outline.timelines {
position: absolute;
top: 22px;
left: 0;
right: 0;
height: 78px;
}
.sidebar > .panel.instrument > .navigation-sidebar-panel-content-tree-outline.timelines .item:not(:first-child):not(.selected) {
border-top-color: rgba(0, 0, 0, 0.1);
}
.sidebar > .panel.instrument > .navigation-sidebar-panel-content-tree-outline.timelines .item.selected + .item {
border-top-color: rgba(0, 0, 0, 0.4);
}
.sidebar > .panel.instrument > .title-bar.profiles {
top: 100px;
border-top: 1px solid rgb(179, 179, 179);
height: 23px;
}
.sidebar > .panel.instrument > .content,
.sidebar > .panel.instrument > .empty-content-placeholder {
top: 123px;
}
/*
* Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
WebInspector.InstrumentSidebarPanel = function()
{
WebInspector.NavigationSidebarPanel.call(this, "instrument", WebInspector.UIString("Timelines"), "Images/NavigationItemStopwatch.svg", "2");
this.filterBar.placeholder = WebInspector.UIString("Filter Profile List");
var timelinesTitleBarElement = document.createElement("div");
timelinesTitleBarElement.textContent = WebInspector.UIString("Timelines");
timelinesTitleBarElement.classList.add(WebInspector.InstrumentSidebarPanel.TitleBarStyleClass);
timelinesTitleBarElement.classList.add(WebInspector.InstrumentSidebarPanel.TimelinesTitleBarStyleClass);
this.element.appendChild(timelinesTitleBarElement);
this._recordGlyphElement = document.createElement("div");
this._recordGlyphElement.className = WebInspector.InstrumentSidebarPanel.RecordGlyphStyleClass;
this._recordGlyphElement.addEventListener("mouseover", this._recordGlyphMousedOver.bind(this));
this._recordGlyphElement.addEventListener("mouseout", this._recordGlyphMousedOut.bind(this));
this._recordGlyphElement.addEventListener("click", this._recordGlyphClicked.bind(this));
timelinesTitleBarElement.appendChild(this._recordGlyphElement);
this._recordStatusElement = document.createElement("div");
this._recordStatusElement.className = WebInspector.InstrumentSidebarPanel.RecordStatusStyleClass;
timelinesTitleBarElement.appendChild(this._recordStatusElement);
var timelinesTreeOutlineElement = document.createElement("ol");
timelinesTreeOutlineElement.classList.add(WebInspector.NavigationSidebarPanel.ContentTreeOutlineElementStyleClassName);
timelinesTreeOutlineElement.classList.add(WebInspector.NavigationSidebarPanel.HideDisclosureButtonsStyleClassName);
timelinesTreeOutlineElement.classList.add(WebInspector.InstrumentSidebarPanel.TimelinesTreeOutlineStyleClass);
this.element.appendChild(timelinesTreeOutlineElement);
this._timelinesTreeOutline = new TreeOutline(timelinesTreeOutlineElement);
this._timelinesTreeOutline.allowsRepeatSelection = true;
this._timelinesTreeElement = new WebInspector.GeneralTreeElement(WebInspector.InstrumentSidebarPanel.StopwatchIconStyleClass, WebInspector.UIString("Timelines"), null, WebInspector.timelineManager.timelines);
var networkTimelineTreeElement = new WebInspector.GeneralTreeElement(WebInspector.InstrumentSidebarPanel.NetworkIconStyleClass, WebInspector.UIString("Network Requests"), null, WebInspector.TimelineRecord.Type.Network);
networkTimelineTreeElement.small = true;
networkTimelineTreeElement.twoLine = true;
this._timelinesTreeOutline.appendChild(networkTimelineTreeElement);
// Select by default, but don't allow focus or onselect to prevent showing the content view.
networkTimelineTreeElement.select(true, false, true);
var layoutTimelineTreeElement = new WebInspector.GeneralTreeElement(WebInspector.InstrumentSidebarPanel.ColorsIconStyleClass, WebInspector.UIString("Layout & Rendering"), null, WebInspector.TimelineRecord.Type.Layout);
layoutTimelineTreeElement.small = true;
layoutTimelineTreeElement.twoLine = true;
this._timelinesTreeOutline.appendChild(layoutTimelineTreeElement);
var scriptTimelineTreeElement = new WebInspector.GeneralTreeElement(WebInspector.InstrumentSidebarPanel.ScriptIconStyleClass, WebInspector.UIString("JavaScript & Events"), null, WebInspector.TimelineRecord.Type.Script);
scriptTimelineTreeElement.small = true;
scriptTimelineTreeElement.twoLine = true;
this._timelinesTreeOutline.appendChild(scriptTimelineTreeElement);
this._timelineTreeElementMap = {};
this._timelineTreeElementMap[WebInspector.TimelineRecord.Type.Network] = networkTimelineTreeElement;
this._timelineTreeElementMap[WebInspector.TimelineRecord.Type.Layout] = layoutTimelineTreeElement;
this._timelineTreeElementMap[WebInspector.TimelineRecord.Type.Script] = scriptTimelineTreeElement;
var profilesTitleBarElement = document.createElement("div");
profilesTitleBarElement.textContent = WebInspector.UIString("Profiles");
profilesTitleBarElement.classList.add(WebInspector.InstrumentSidebarPanel.TitleBarStyleClass);
profilesTitleBarElement.classList.add(WebInspector.InstrumentSidebarPanel.ProfilesTitleBarStyleClass);
this.element.appendChild(profilesTitleBarElement);
this._recordProfileGlyphElement = document.createElement("select");
this._recordProfileGlyphElement.className = WebInspector.InstrumentSidebarPanel.RecordGlyphStyleClass;
this._recordProfileGlyphElement.addEventListener("mouseover", this._recordProfileGlyphMousedOver.bind(this));
this._recordProfileGlyphElement.addEventListener("mouseout", this._recordProfileGlyphMousedOut.bind(this));
this._recordProfileGlyphElement.addEventListener("mousedown", this._recordProfileGlyphMousedDown.bind(this));
this._recordProfileGlyphElement.addEventListener("click", this._recordProfileGlyphClicked.bind(this));
this._recordProfileGlyphElement.addEventListener("change", this._profileTypeWasSelected.bind(this));
var startJavaScriptProfileOption = document.createElement("option");
startJavaScriptProfileOption.textContent = WebInspector.UIString("Start JavaScript Profile");
startJavaScriptProfileOption.value = WebInspector.InstrumentSidebarPanel.StartJavaScriptProfileValue;
startJavaScriptProfileOption.selected = false;
var startCanvasProfileOption = document.createElement("option");
startCanvasProfileOption.textContent = WebInspector.UIString("Start Canvas Profile");
startCanvasProfileOption.value = WebInspector.InstrumentSidebarPanel.StartCanvasProfileValue;
startCanvasProfileOption.selected = false;
this._recordProfileGlyphElement.add(startJavaScriptProfileOption);
this._recordProfileGlyphElement.add(startCanvasProfileOption);
profilesTitleBarElement.appendChild(this._recordProfileGlyphElement);
this._recordProfileGlyphElement.selectedIndex = -1;
this._recordProfileStatusElement = document.createElement("div");
this._recordProfileStatusElement.className = WebInspector.InstrumentSidebarPanel.RecordStatusStyleClass;
profilesTitleBarElement.appendChild(this._recordProfileStatusElement);
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.RecordingStarted, this._recordingStarted, this);
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.RecordingStopped, this._recordingStopped, this);
WebInspector.profileManager.addEventListener(WebInspector.ProfileManager.Event.ProfileWasAdded, this._profileWasAdded, this);
WebInspector.profileManager.addEventListener(WebInspector.ProfileManager.Event.ProfileWasUpdated, this._profileWasUpdated, this);
WebInspector.profileManager.addEventListener(WebInspector.ProfileManager.Event.Cleared, this._profilesCleared, this);
WebInspector.profileManager.addEventListener(WebInspector.ProfileManager.Event.ProfilingStarted, this._profilingStarted, this);
WebInspector.profileManager.addEventListener(WebInspector.ProfileManager.Event.ProfilingEnded, this._profilingEnded, this);
WebInspector.profileManager.addEventListener(WebInspector.ProfileManager.Event.ProfilingInterrupted, this._profilingInterrupted, this);
this.updateEmptyContentPlaceholder(WebInspector.UIString("No Recorded Profiles"));
// Maps from profile titles -> tree elements.
this._profileTreeElementMap = {};
this._timelinesTreeOutline.onselect = this._timelinesTreeElementSelected.bind(this);
this.contentTreeOutline.onselect = this._profileSelected.bind(this);
};
WebInspector.InstrumentSidebarPanel.TitleBarStyleClass = "title-bar";
WebInspector.InstrumentSidebarPanel.TimelinesTitleBarStyleClass = "timelines";
WebInspector.InstrumentSidebarPanel.TimelinesTreeOutlineStyleClass = "timelines";
WebInspector.InstrumentSidebarPanel.RecordGlyphStyleClass = "record-glyph";
WebInspector.InstrumentSidebarPanel.RecordGlyphRecordingStyleClass = "recording";
WebInspector.InstrumentSidebarPanel.RecordGlyphRecordingForcedStyleClass = "forced";
WebInspector.InstrumentSidebarPanel.RecordStatusStyleClass = "record-status";
WebInspector.InstrumentSidebarPanel.ProfilesTitleBarStyleClass = "profiles";
WebInspector.InstrumentSidebarPanel.StopwatchIconStyleClass = "stopwatch-icon";
WebInspector.InstrumentSidebarPanel.NetworkIconStyleClass = "network-icon";
WebInspector.InstrumentSidebarPanel.ColorsIconStyleClass = "colors-icon";
WebInspector.InstrumentSidebarPanel.ScriptIconStyleClass = "script-icon";
WebInspector.InstrumentSidebarPanel.ProfileIconStyleClass = "profile-icon";
WebInspector.InstrumentSidebarPanel.StartJavaScriptProfileValue = "start-javascript-profile";
WebInspector.InstrumentSidebarPanel.StartCanvasProfileValue = "start-canvas-profile";
WebInspector.InstrumentSidebarPanel.SelectedTimelineCookieKey = "instrument-sidebar-panel-selected-timeline";
WebInspector.InstrumentSidebarPanel.SelectedProfileTypeCookieKey = "instrument-sidebar-panel-selected-profile-type";
WebInspector.InstrumentSidebarPanel.SelectedProfileTitleCookieKey = "instrument-sidebar-panel-selected-profile-title";
WebInspector.InstrumentSidebarPanel.prototype = {
constructor: WebInspector.InstrumentSidebarPanel,
// Public
treeElementForRepresentedObject: function(representedObject)
{
if (representedObject instanceof WebInspector.TimelinesObject)
return this._timelinesTreeElement;
return this.contentTreeOutline.getCachedTreeElement(representedObject);
},
showTimeline: function()
{
WebInspector.contentBrowser.showContentViewForRepresentedObject(WebInspector.timelineManager.timelines);
},
showTimelineForRecordType: function(type)
{
var treeElementToSelect = this._timelineTreeElementMap[type];
if (!treeElementToSelect)
return null;
treeElementToSelect.select(true, true);
return treeElementToSelect.representedObject;
},
saveStateToCookie: function(cookie)
{
console.assert(cookie);
// This sidebar has two separate tree outlines, but only one selected tree element between them.
var selectedTreeElement = this._timelinesTreeOutline.selectedTreeElement || this.contentTreeOutline.selectedTreeElement;
if (!selectedTreeElement)
return;
var representedObject = selectedTreeElement.representedObject;
if (representedObject === WebInspector.TimelineRecord.Type.Script || representedObject === WebInspector.TimelineRecord.Type.Layout || representedObject === WebInspector.TimelineRecord.Type.Network)
cookie[WebInspector.InstrumentSidebarPanel.SelectedTimelineCookieKey] = representedObject;
else if (representedObject instanceof WebInspector.ProfileObject) {
cookie[WebInspector.InstrumentSidebarPanel.SelectedProfileTypeCookieKey] = representedObject.type;
cookie[WebInspector.InstrumentSidebarPanel.SelectedProfileTitleCookieKey] = representedObject.title;
}
},
restoreStateFromCookie: function(cookie)
{
// Eagerly restore the sidebar's selection, since its elements are persistent or permanent.
console.assert(cookie);
var selectedTimelineType = cookie[WebInspector.InstrumentSidebarPanel.SelectedTimelineCookieKey];
if (selectedTimelineType) {
return this.showTimelineForRecordType(selectedTimelineType);
return WebInspector.timelineManager.timelines;
}
// Profiles are persisted across page reloads, but not across inspector open/close.
var selectedProfileType = cookie[WebInspector.InstrumentSidebarPanel.SelectedProfileTypeCookieKey];
var selectedProfileTitle = cookie[WebInspector.InstrumentSidebarPanel.SelectedProfileTitleCookieKey];
// Profile titles are optional, but profile types are mandatory.
if (!selectedProfileType)
return null;
return this.showProfile(selectedProfileType, selectedProfileTitle);
},
showProfile: function(type, title)
{
var profileTreeElements = this.contentTreeOutline.children;
for (var i = 0; i < profileTreeElements.length; ++i) {
var treeElement = profileTreeElements[i];
var profile = treeElement.representedObject;
if (profile.type === type && profile.title === title) {
treeElement.revealAndSelect();
return profile;
}
}
},
shown: function()
{
// Delegate to TimelinesContentView to select the default record type.
WebInspector.contentBrowser.showContentViewForRepresentedObject(WebInspector.timelineManager.timelines);
WebInspector.NavigationSidebarPanel.prototype.shown.call(this);
},
// Private
_timelinesTreeElementSelected: function(treeElement, selectedByUser)
{
if (this._timelineTreeElementMap[treeElement.representedObject] !== treeElement)
return;
// Deselect any tree element in the main content tree outline to prevent two selections in the sidebar.
var selectedTreeElement = this.contentTreeOutline.selectedTreeElement;
if (selectedTreeElement)
selectedTreeElement.deselect();
var contentView = WebInspector.contentBrowser.contentViewForRepresentedObject(WebInspector.timelineManager.timelines);
contentView.showTimelineForRecordType(treeElement.representedObject);
WebInspector.contentBrowser.showContentView(contentView);
},
_profilingStarted: function(event)
{
this._recordProfileStatusElement.textContent = WebInspector.UIString("Profiling");
this._recordProfileGlyphElement.classList.add(WebInspector.InstrumentSidebarPanel.RecordGlyphRecordingStyleClass);
},
_profilingEnded: function(event)
{
// Immediately create a view for this profile so that it is archived across page loads.
if (event && event.data.profile) {
WebInspector.contentBrowser.contentViewForRepresentedObject(event.data.profile);
var treeElement = this.treeElementForRepresentedObject(event.data.profile);
if (treeElement) {
treeElement.status = null;
if (!event.data.fromConsole)
treeElement.select();
}
}
this._recordProfileStatusElement.textContent = "";
this._recordProfileGlyphElement.classList.remove(WebInspector.InstrumentSidebarPanel.RecordGlyphRecordingStyleClass);
},
_profilingInterrupted: function(event)
{
this._profilingEnded();
var profile = event.data.profile;
console.assert(profile instanceof WebInspector.ProfileObject);
var treeElement = this.treeElementForRepresentedObject(profile);
console.assert(treeElement);
if (!treeElement)
return;
treeElement.treeOutline.removeChild(treeElement);
},
_recordProfileGlyphMousedOver: function(event)
{
this._recordProfileGlyphElement.classList.remove(WebInspector.InstrumentSidebarPanel.RecordGlyphRecordingForcedStyleClass);
if (WebInspector.profileManager.isProfilingJavaScript() || WebInspector.profileManager.isProfilingCanvas())
this._recordProfileStatusElement.textContent = WebInspector.UIString("Stop Profiling");
else
this._recordProfileStatusElement.textContent = WebInspector.UIString("Start Profiling");
},
_recordProfileGlyphMousedOut: function(event)
{
this._recordProfileGlyphElement.classList.remove(WebInspector.InstrumentSidebarPanel.RecordGlyphRecordingForcedStyleClass);
if (WebInspector.profileManager.isProfilingJavaScript())
this._recordProfileStatusElement.textContent = WebInspector.UIString("Profiling");
else
this._recordProfileStatusElement.textContent = "";
},
_recordProfileGlyphMousedDown: function(event)
{
// Don't show any option as selected in the profile selector.
this._recordProfileGlyphElement.selectedIndex = -1;
// We don't want to show the select if the user is currently profiling. In that case,
// the user should just be able to click the record button to stop profiling.
if (WebInspector.profileManager.isProfilingJavaScript() || WebInspector.profileManager.isProfilingCanvas())
event.preventDefault();
else {
// When a select is opened, a click event will be fired when the select is closed,
// whether or not anything was selected. We want to ignore that click, because it
// would instantly stop profiling.
this._shouldIgnoreRecordProfileGlyphClick = true;
}
},
_recordProfileGlyphClicked: function(event)
{
// Add forced class to prevent the glyph from showing a confusing status after click.
this._recordProfileGlyphElement.classList.add(WebInspector.InstrumentSidebarPanel.RecordGlyphRecordingForcedStyleClass);
if (this._shouldIgnoreRecordProfileGlyphClick) {