Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(631)

Unified Diff: third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js
index aeba70ac8a1adef2e533247d9547f6a4420f66ae..c642e4810c29f5b80fc3a86b42f2ab4810d0d928 100644
--- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js
@@ -2,52 +2,52 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
- * @implements {WebInspector.Searchable}
+ * @implements {UI.Searchable}
* @unrestricted
*/
-WebInspector.ProfileView = class extends WebInspector.SimpleView {
+Profiler.ProfileView = class extends UI.SimpleView {
constructor() {
- super(WebInspector.UIString('Profile'));
+ super(Common.UIString('Profile'));
- this._searchableView = new WebInspector.SearchableView(this);
- this._searchableView.setPlaceholder(WebInspector.UIString('Find by cost (>50ms), name or file'));
+ this._searchableView = new UI.SearchableView(this);
+ this._searchableView.setPlaceholder(Common.UIString('Find by cost (>50ms), name or file'));
this._searchableView.show(this.element);
- var columns = /** @type {!Array<!WebInspector.DataGrid.ColumnDescriptor>} */ ([]);
+ var columns = /** @type {!Array<!UI.DataGrid.ColumnDescriptor>} */ ([]);
columns.push({
id: 'self',
title: this.columnHeader('self'),
width: '120px',
fixedWidth: true,
sortable: true,
- sort: WebInspector.DataGrid.Order.Descending
+ sort: UI.DataGrid.Order.Descending
});
columns.push({id: 'total', title: this.columnHeader('total'), width: '120px', fixedWidth: true, sortable: true});
- columns.push({id: 'function', title: WebInspector.UIString('Function'), disclosure: true, sortable: true});
+ columns.push({id: 'function', title: Common.UIString('Function'), disclosure: true, sortable: true});
- this.dataGrid = new WebInspector.DataGrid(columns);
- this.dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortProfile, this);
- this.dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._nodeSelected.bind(this, true));
- this.dataGrid.addEventListener(WebInspector.DataGrid.Events.DeselectedNode, this._nodeSelected.bind(this, false));
+ this.dataGrid = new UI.DataGrid(columns);
+ this.dataGrid.addEventListener(UI.DataGrid.Events.SortingChanged, this._sortProfile, this);
+ this.dataGrid.addEventListener(UI.DataGrid.Events.SelectedNode, this._nodeSelected.bind(this, true));
+ this.dataGrid.addEventListener(UI.DataGrid.Events.DeselectedNode, this._nodeSelected.bind(this, false));
- this.viewSelectComboBox = new WebInspector.ToolbarComboBox(this._changeView.bind(this));
+ this.viewSelectComboBox = new UI.ToolbarComboBox(this._changeView.bind(this));
this.focusButton =
- new WebInspector.ToolbarButton(WebInspector.UIString('Focus selected function'), 'largeicon-visibility');
+ new UI.ToolbarButton(Common.UIString('Focus selected function'), 'largeicon-visibility');
this.focusButton.setEnabled(false);
this.focusButton.addEventListener('click', this._focusClicked, this);
this.excludeButton =
- new WebInspector.ToolbarButton(WebInspector.UIString('Exclude selected function'), 'largeicon-delete');
+ new UI.ToolbarButton(Common.UIString('Exclude selected function'), 'largeicon-delete');
this.excludeButton.setEnabled(false);
this.excludeButton.addEventListener('click', this._excludeClicked, this);
this.resetButton =
- new WebInspector.ToolbarButton(WebInspector.UIString('Restore all functions'), 'largeicon-refresh');
+ new UI.ToolbarButton(Common.UIString('Restore all functions'), 'largeicon-refresh');
this.resetButton.setEnabled(false);
this.resetButton.addEventListener('click', this._resetClicked, this);
- this._linkifier = new WebInspector.Linkifier(WebInspector.ProfileView._maxLinkLength);
+ this._linkifier = new Components.Linkifier(Profiler.ProfileView._maxLinkLength);
}
/**
@@ -65,23 +65,23 @@ WebInspector.ProfileView = class extends WebInspector.SimpleView {
}
/**
- * @param {!WebInspector.ProfileDataGridNode.Formatter} nodeFormatter
+ * @param {!Profiler.ProfileDataGridNode.Formatter} nodeFormatter
* @param {!Array<string>=} viewTypes
* @protected
*/
initialize(nodeFormatter, viewTypes) {
this._nodeFormatter = nodeFormatter;
- this._viewType = WebInspector.settings.createSetting('profileView', WebInspector.ProfileView.ViewTypes.Heavy);
+ this._viewType = Common.settings.createSetting('profileView', Profiler.ProfileView.ViewTypes.Heavy);
viewTypes = viewTypes || [
- WebInspector.ProfileView.ViewTypes.Flame, WebInspector.ProfileView.ViewTypes.Heavy,
- WebInspector.ProfileView.ViewTypes.Tree
+ Profiler.ProfileView.ViewTypes.Flame, Profiler.ProfileView.ViewTypes.Heavy,
+ Profiler.ProfileView.ViewTypes.Tree
];
var optionNames = new Map([
- [WebInspector.ProfileView.ViewTypes.Flame, WebInspector.UIString('Chart')],
- [WebInspector.ProfileView.ViewTypes.Heavy, WebInspector.UIString('Heavy (Bottom Up)')],
- [WebInspector.ProfileView.ViewTypes.Tree, WebInspector.UIString('Tree (Top Down)')],
+ [Profiler.ProfileView.ViewTypes.Flame, Common.UIString('Chart')],
+ [Profiler.ProfileView.ViewTypes.Heavy, Common.UIString('Heavy (Bottom Up)')],
+ [Profiler.ProfileView.ViewTypes.Tree, Common.UIString('Tree (Top Down)')],
]);
var options =
@@ -114,7 +114,7 @@ WebInspector.ProfileView = class extends WebInspector.SimpleView {
}
/**
- * @return {?WebInspector.Target}
+ * @return {?SDK.Target}
*/
target() {
return this._profileHeader.target();
@@ -132,28 +132,28 @@ WebInspector.ProfileView = class extends WebInspector.SimpleView {
/**
* @override
- * @return {!Array.<!WebInspector.ToolbarItem>}
+ * @return {!Array.<!UI.ToolbarItem>}
*/
syncToolbarItems() {
return [this.viewSelectComboBox, this.focusButton, this.excludeButton, this.resetButton];
}
/**
- * @return {!WebInspector.ProfileDataGridTree}
+ * @return {!Profiler.ProfileDataGridTree}
*/
_getBottomUpProfileDataGridTree() {
if (!this._bottomUpProfileDataGridTree)
- this._bottomUpProfileDataGridTree = new WebInspector.BottomUpProfileDataGridTree(
+ this._bottomUpProfileDataGridTree = new Profiler.BottomUpProfileDataGridTree(
this._nodeFormatter, this._searchableView, this.profile.root, this.adjustedTotal);
return this._bottomUpProfileDataGridTree;
}
/**
- * @return {!WebInspector.ProfileDataGridTree}
+ * @return {!Profiler.ProfileDataGridTree}
*/
_getTopDownProfileDataGridTree() {
if (!this._topDownProfileDataGridTree)
- this._topDownProfileDataGridTree = new WebInspector.TopDownProfileDataGridTree(
+ this._topDownProfileDataGridTree = new Profiler.TopDownProfileDataGridTree(
this._nodeFormatter, this._searchableView, this.profile.root, this.adjustedTotal);
return this._topDownProfileDataGridTree;
}
@@ -189,7 +189,7 @@ WebInspector.ProfileView = class extends WebInspector.SimpleView {
}
/**
- * @return {!WebInspector.SearchableView}
+ * @return {!UI.SearchableView}
*/
searchableView() {
return this._searchableView;
@@ -220,7 +220,7 @@ WebInspector.ProfileView = class extends WebInspector.SimpleView {
/**
* @override
- * @param {!WebInspector.SearchableView.SearchConfig} searchConfig
+ * @param {!UI.SearchableView.SearchConfig} searchConfig
* @param {boolean} shouldJump
* @param {boolean=} jumpBackwards
*/
@@ -243,14 +243,14 @@ WebInspector.ProfileView = class extends WebInspector.SimpleView {
}
/**
- * @return {!WebInspector.Linkifier}
+ * @return {!Components.Linkifier}
*/
linkifier() {
return this._linkifier;
}
/**
- * @return {!WebInspector.FlameChartDataProvider}
+ * @return {!UI.FlameChartDataProvider}
*/
createFlameChartDataProvider() {
throw 'Not implemented';
@@ -260,12 +260,12 @@ WebInspector.ProfileView = class extends WebInspector.SimpleView {
if (this._flameChart)
return;
this._dataProvider = this.createFlameChartDataProvider();
- this._flameChart = new WebInspector.CPUProfileFlameChart(this._searchableView, this._dataProvider);
- this._flameChart.addEventListener(WebInspector.FlameChart.Events.EntrySelected, this._onEntrySelected.bind(this));
+ this._flameChart = new Profiler.CPUProfileFlameChart(this._searchableView, this._dataProvider);
+ this._flameChart.addEventListener(UI.FlameChart.Events.EntrySelected, this._onEntrySelected.bind(this));
}
/**
- * @param {!WebInspector.Event} event
+ * @param {!Common.Event} event
*/
_onEntrySelected(event) {
var entryIndex = event.data;
@@ -276,9 +276,9 @@ WebInspector.ProfileView = class extends WebInspector.SimpleView {
var script = debuggerModel.scriptForId(node.scriptId);
if (!script)
return;
- var location = /** @type {!WebInspector.DebuggerModel.Location} */ (
+ var location = /** @type {!SDK.DebuggerModel.Location} */ (
debuggerModel.createRawLocation(script, node.lineNumber, node.columnNumber));
- WebInspector.Revealer.reveal(WebInspector.debuggerWorkspaceBinding.rawLocationToUILocation(location));
+ Common.Revealer.reveal(Bindings.debuggerWorkspaceBinding.rawLocationToUILocation(location));
}
_changeView() {
@@ -292,18 +292,18 @@ WebInspector.ProfileView = class extends WebInspector.SimpleView {
this._viewType.set(this.viewSelectComboBox.selectedOption().value);
switch (this._viewType.get()) {
- case WebInspector.ProfileView.ViewTypes.Flame:
+ case Profiler.ProfileView.ViewTypes.Flame:
this._ensureFlameChartCreated();
this._visibleView = this._flameChart;
this._searchableElement = this._flameChart;
break;
- case WebInspector.ProfileView.ViewTypes.Tree:
+ case Profiler.ProfileView.ViewTypes.Tree:
this.profileDataGridTree = this._getTopDownProfileDataGridTree();
this._sortProfile();
this._visibleView = this.dataGrid.asWidget();
this._searchableElement = this.profileDataGridTree;
break;
- case WebInspector.ProfileView.ViewTypes.Heavy:
+ case Profiler.ProfileView.ViewTypes.Heavy:
this.profileDataGridTree = this._getBottomUpProfileDataGridTree();
this._sortProfile();
this._visibleView = this.dataGrid.asWidget();
@@ -311,7 +311,7 @@ WebInspector.ProfileView = class extends WebInspector.SimpleView {
break;
}
- var isFlame = this._viewType.get() === WebInspector.ProfileView.ViewTypes.Flame;
+ var isFlame = this._viewType.get() === Profiler.ProfileView.ViewTypes.Flame;
this.focusButton.setVisible(!isFlame);
this.excludeButton.setVisible(!isFlame);
this.resetButton.setVisible(!isFlame);
@@ -363,16 +363,16 @@ WebInspector.ProfileView = class extends WebInspector.SimpleView {
var sortAscending = this.dataGrid.isSortOrderAscending();
var sortColumnId = this.dataGrid.sortColumnId();
var sortProperty = sortColumnId === 'function' ? 'functionName' : sortColumnId || '';
- this.profileDataGridTree.sort(WebInspector.ProfileDataGridTree.propertyComparator(sortProperty, sortAscending));
+ this.profileDataGridTree.sort(Profiler.ProfileDataGridTree.propertyComparator(sortProperty, sortAscending));
this.refresh();
}
};
-WebInspector.ProfileView._maxLinkLength = 30;
+Profiler.ProfileView._maxLinkLength = 30;
/** @enum {string} */
-WebInspector.ProfileView.ViewTypes = {
+Profiler.ProfileView.ViewTypes = {
Flame: 'Flame',
Tree: 'Tree',
Heavy: 'Heavy'
@@ -380,19 +380,19 @@ WebInspector.ProfileView.ViewTypes = {
/**
- * @implements {WebInspector.OutputStream}
- * @implements {WebInspector.OutputStreamDelegate}
+ * @implements {Common.OutputStream}
+ * @implements {Bindings.OutputStreamDelegate}
* @unrestricted
*/
-WebInspector.WritableProfileHeader = class extends WebInspector.ProfileHeader {
+Profiler.WritableProfileHeader = class extends Profiler.ProfileHeader {
/**
- * @param {?WebInspector.Target} target
- * @param {!WebInspector.ProfileType} type
+ * @param {?SDK.Target} target
+ * @param {!Profiler.ProfileType} type
* @param {string=} title
*/
constructor(target, type, title) {
- super(target, type, title || WebInspector.UIString('Profile %d', type.nextProfileUid()));
- this._debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
+ super(target, type, title || Common.UIString('Profile %d', type.nextProfileUid()));
+ this._debuggerModel = SDK.DebuggerModel.fromTarget(target);
this._tempFile = null;
}
@@ -402,25 +402,25 @@ WebInspector.WritableProfileHeader = class extends WebInspector.ProfileHeader {
onTransferStarted() {
this._jsonifiedProfile = '';
this.updateStatus(
- WebInspector.UIString('Loading\u2026 %s', Number.bytesToString(this._jsonifiedProfile.length)), true);
+ Common.UIString('Loading\u2026 %s', Number.bytesToString(this._jsonifiedProfile.length)), true);
}
/**
* @override
- * @param {!WebInspector.ChunkedReader} reader
+ * @param {!Bindings.ChunkedReader} reader
*/
onChunkTransferred(reader) {
- this.updateStatus(WebInspector.UIString('Loading\u2026 %d%%', Number.bytesToString(this._jsonifiedProfile.length)));
+ this.updateStatus(Common.UIString('Loading\u2026 %d%%', Number.bytesToString(this._jsonifiedProfile.length)));
}
/**
* @override
*/
onTransferFinished() {
- this.updateStatus(WebInspector.UIString('Parsing\u2026'), true);
+ this.updateStatus(Common.UIString('Parsing\u2026'), true);
this._profile = JSON.parse(this._jsonifiedProfile);
this._jsonifiedProfile = null;
- this.updateStatus(WebInspector.UIString('Loaded'), false);
+ this.updateStatus(Common.UIString('Loaded'), false);
if (this._profileType.profileBeingRecorded() === this)
this._profileType.setProfileBeingRecorded(null);
@@ -428,22 +428,22 @@ WebInspector.WritableProfileHeader = class extends WebInspector.ProfileHeader {
/**
* @override
- * @param {!WebInspector.ChunkedReader} reader
+ * @param {!Bindings.ChunkedReader} reader
* @param {!Event} e
*/
onError(reader, e) {
var subtitle;
switch (e.target.error.code) {
case e.target.error.NOT_FOUND_ERR:
- subtitle = WebInspector.UIString('\'%s\' not found.', reader.fileName());
+ subtitle = Common.UIString('\'%s\' not found.', reader.fileName());
break;
case e.target.error.NOT_READABLE_ERR:
- subtitle = WebInspector.UIString('\'%s\' is not readable', reader.fileName());
+ subtitle = Common.UIString('\'%s\' is not readable', reader.fileName());
break;
case e.target.error.ABORT_ERR:
return;
default:
- subtitle = WebInspector.UIString('\'%s\' error %d', reader.fileName(), e.target.error.code);
+ subtitle = Common.UIString('\'%s\' error %d', reader.fileName(), e.target.error.code);
}
this.updateStatus(subtitle);
}
@@ -471,11 +471,11 @@ WebInspector.WritableProfileHeader = class extends WebInspector.ProfileHeader {
/**
* @override
- * @param {!WebInspector.ProfileType.DataDisplayDelegate} panel
- * @return {!WebInspector.ProfileSidebarTreeElement}
+ * @param {!Profiler.ProfileType.DataDisplayDelegate} panel
+ * @return {!Profiler.ProfileSidebarTreeElement}
*/
createSidebarTreeElement(panel) {
- return new WebInspector.ProfileSidebarTreeElement(panel, this, 'profile-sidebar-tree-item');
+ return new Profiler.ProfileSidebarTreeElement(panel, this, 'profile-sidebar-tree-item');
}
/**
@@ -490,11 +490,11 @@ WebInspector.WritableProfileHeader = class extends WebInspector.ProfileHeader {
* @override
*/
saveToFile() {
- var fileOutputStream = new WebInspector.FileOutputStream();
+ var fileOutputStream = new Bindings.FileOutputStream();
/**
* @param {boolean} accepted
- * @this {WebInspector.WritableProfileHeader}
+ * @this {Profiler.WritableProfileHeader}
*/
function onOpenForSave(accepted) {
if (!accepted)
@@ -506,7 +506,7 @@ WebInspector.WritableProfileHeader = class extends WebInspector.ProfileHeader {
fileOutputStream.close();
}
if (this._failedToCreateTempFile) {
- WebInspector.console.error('Failed to open temp file with heap snapshot');
+ Common.console.error('Failed to open temp file with heap snapshot');
fileOutputStream.close();
} else if (this._tempFile) {
this._tempFile.read(didRead);
@@ -524,8 +524,8 @@ WebInspector.WritableProfileHeader = class extends WebInspector.ProfileHeader {
* @param {!File} file
*/
loadFromFile(file) {
- this.updateStatus(WebInspector.UIString('Loading\u2026'), true);
- var fileReader = new WebInspector.ChunkedFileReader(file, 10000000, this);
+ this.updateStatus(Common.UIString('Loading\u2026'), true);
+ var fileReader = new Bindings.ChunkedFileReader(file, 10000000, this);
fileReader.start(this);
}
@@ -536,7 +536,7 @@ WebInspector.WritableProfileHeader = class extends WebInspector.ProfileHeader {
this._protocolProfile = profile;
this._saveProfileDataToTempFile(profile);
if (this.canSaveToFile())
- this.dispatchEventToListeners(WebInspector.ProfileHeader.Events.ProfileReceived);
+ this.dispatchEventToListeners(Profiler.ProfileHeader.Events.ProfileReceived);
}
/**
@@ -546,16 +546,16 @@ WebInspector.WritableProfileHeader = class extends WebInspector.ProfileHeader {
var serializedData = JSON.stringify(data);
/**
- * @this {WebInspector.WritableProfileHeader}
+ * @this {Profiler.WritableProfileHeader}
*/
function didCreateTempFile(tempFile) {
this._writeToTempFile(tempFile, serializedData);
}
- WebInspector.TempFile.create('cpu-profiler', String(this.uid)).then(didCreateTempFile.bind(this));
+ Bindings.TempFile.create('cpu-profiler', String(this.uid)).then(didCreateTempFile.bind(this));
}
/**
- * @param {?WebInspector.TempFile} tempFile
+ * @param {?Bindings.TempFile} tempFile
* @param {string} serializedData
*/
_writeToTempFile(tempFile, serializedData) {
@@ -567,7 +567,7 @@ WebInspector.WritableProfileHeader = class extends WebInspector.ProfileHeader {
}
/**
* @param {number} fileSize
- * @this {WebInspector.WritableProfileHeader}
+ * @this {Profiler.WritableProfileHeader}
*/
function didWriteToTempFile(fileSize) {
if (!fileSize)

Powered by Google App Engine
This is Rietveld 408576698