| Index: third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js
|
| index 1bf91155786be56ca5e52e3fb849b73613483ac8..86786b83f47054fe23fc8feb07739c810f34fbcd 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js
|
| @@ -24,360 +24,6 @@
|
| */
|
|
|
| /**
|
| - * @unrestricted
|
| - */
|
| -Profiler.ProfileType = class extends Common.Object {
|
| - /**
|
| - * @param {string} id
|
| - * @param {string} name
|
| - * @suppressGlobalPropertiesCheck
|
| - */
|
| - constructor(id, name) {
|
| - super();
|
| - this._id = id;
|
| - this._name = name;
|
| - /** @type {!Array.<!Profiler.ProfileHeader>} */
|
| - this._profiles = [];
|
| - /** @type {?Profiler.ProfileHeader} */
|
| - this._profileBeingRecorded = null;
|
| - this._nextProfileUid = 1;
|
| -
|
| - if (!window.opener)
|
| - window.addEventListener('unload', this._clearTempStorage.bind(this), false);
|
| - }
|
| -
|
| - /**
|
| - * @return {string}
|
| - */
|
| - typeName() {
|
| - return '';
|
| - }
|
| -
|
| - /**
|
| - * @return {number}
|
| - */
|
| - nextProfileUid() {
|
| - return this._nextProfileUid;
|
| - }
|
| -
|
| - /**
|
| - * @return {boolean}
|
| - */
|
| - hasTemporaryView() {
|
| - return false;
|
| - }
|
| -
|
| - /**
|
| - * @return {?string}
|
| - */
|
| - fileExtension() {
|
| - return null;
|
| - }
|
| -
|
| - get buttonTooltip() {
|
| - return '';
|
| - }
|
| -
|
| - get id() {
|
| - return this._id;
|
| - }
|
| -
|
| - get treeItemTitle() {
|
| - return this._name;
|
| - }
|
| -
|
| - get name() {
|
| - return this._name;
|
| - }
|
| -
|
| - /**
|
| - * @return {boolean}
|
| - */
|
| - buttonClicked() {
|
| - return false;
|
| - }
|
| -
|
| - get description() {
|
| - return '';
|
| - }
|
| -
|
| - /**
|
| - * @return {boolean}
|
| - */
|
| - isInstantProfile() {
|
| - return false;
|
| - }
|
| -
|
| - /**
|
| - * @return {boolean}
|
| - */
|
| - isEnabled() {
|
| - return true;
|
| - }
|
| -
|
| - /**
|
| - * @return {!Array.<!Profiler.ProfileHeader>}
|
| - */
|
| - getProfiles() {
|
| - /**
|
| - * @param {!Profiler.ProfileHeader} profile
|
| - * @return {boolean}
|
| - * @this {Profiler.ProfileType}
|
| - */
|
| - function isFinished(profile) {
|
| - return this._profileBeingRecorded !== profile;
|
| - }
|
| - return this._profiles.filter(isFinished.bind(this));
|
| - }
|
| -
|
| - /**
|
| - * @return {?Element}
|
| - */
|
| - decorationElement() {
|
| - return null;
|
| - }
|
| -
|
| - /**
|
| - * @param {number} uid
|
| - * @return {?Profiler.ProfileHeader}
|
| - */
|
| - getProfile(uid) {
|
| - for (var i = 0; i < this._profiles.length; ++i) {
|
| - if (this._profiles[i].uid === uid)
|
| - return this._profiles[i];
|
| - }
|
| - return null;
|
| - }
|
| -
|
| - /**
|
| - * @param {!File} file
|
| - */
|
| - loadFromFile(file) {
|
| - var name = file.name;
|
| - var fileExtension = this.fileExtension();
|
| - if (fileExtension && name.endsWith(fileExtension))
|
| - name = name.substr(0, name.length - fileExtension.length);
|
| - var profile = this.createProfileLoadedFromFile(name);
|
| - profile.setFromFile();
|
| - this.setProfileBeingRecorded(profile);
|
| - this.addProfile(profile);
|
| - profile.loadFromFile(file);
|
| - }
|
| -
|
| - /**
|
| - * @param {string} title
|
| - * @return {!Profiler.ProfileHeader}
|
| - */
|
| - createProfileLoadedFromFile(title) {
|
| - throw new Error('Needs implemented.');
|
| - }
|
| -
|
| - /**
|
| - * @param {!Profiler.ProfileHeader} profile
|
| - */
|
| - addProfile(profile) {
|
| - this._profiles.push(profile);
|
| - this.dispatchEventToListeners(Profiler.ProfileType.Events.AddProfileHeader, profile);
|
| - }
|
| -
|
| - /**
|
| - * @param {!Profiler.ProfileHeader} profile
|
| - */
|
| - removeProfile(profile) {
|
| - var index = this._profiles.indexOf(profile);
|
| - if (index === -1)
|
| - return;
|
| - this._profiles.splice(index, 1);
|
| - this._disposeProfile(profile);
|
| - }
|
| -
|
| - _clearTempStorage() {
|
| - for (var i = 0; i < this._profiles.length; ++i)
|
| - this._profiles[i].removeTempFile();
|
| - }
|
| -
|
| - /**
|
| - * @return {?Profiler.ProfileHeader}
|
| - */
|
| - profileBeingRecorded() {
|
| - return this._profileBeingRecorded;
|
| - }
|
| -
|
| - /**
|
| - * @param {?Profiler.ProfileHeader} profile
|
| - */
|
| - setProfileBeingRecorded(profile) {
|
| - this._profileBeingRecorded = profile;
|
| - }
|
| -
|
| - profileBeingRecordedRemoved() {
|
| - }
|
| -
|
| - reset() {
|
| - this._profiles.slice(0).forEach(this._disposeProfile.bind(this));
|
| - this._profiles = [];
|
| - this._nextProfileUid = 1;
|
| - }
|
| -
|
| - /**
|
| - * @param {!Profiler.ProfileHeader} profile
|
| - */
|
| - _disposeProfile(profile) {
|
| - this.dispatchEventToListeners(Profiler.ProfileType.Events.RemoveProfileHeader, profile);
|
| - profile.dispose();
|
| - if (this._profileBeingRecorded === profile) {
|
| - this.profileBeingRecordedRemoved();
|
| - this.setProfileBeingRecorded(null);
|
| - }
|
| - }
|
| -};
|
| -
|
| -/** @enum {symbol} */
|
| -Profiler.ProfileType.Events = {
|
| - AddProfileHeader: Symbol('add-profile-header'),
|
| - ProfileComplete: Symbol('profile-complete'),
|
| - RemoveProfileHeader: Symbol('remove-profile-header'),
|
| - ViewUpdated: Symbol('view-updated')
|
| -};
|
| -
|
| -/**
|
| - * @interface
|
| - */
|
| -Profiler.ProfileType.DataDisplayDelegate = function() {};
|
| -
|
| -Profiler.ProfileType.DataDisplayDelegate.prototype = {
|
| - /**
|
| - * @param {?Profiler.ProfileHeader} profile
|
| - * @return {?UI.Widget}
|
| - */
|
| - showProfile(profile) {},
|
| -
|
| - /**
|
| - * @param {!Protocol.HeapProfiler.HeapSnapshotObjectId} snapshotObjectId
|
| - * @param {string} perspectiveName
|
| - */
|
| - showObject(snapshotObjectId, perspectiveName) {}
|
| -};
|
| -
|
| -/**
|
| - * @unrestricted
|
| - */
|
| -Profiler.ProfileHeader = class extends Common.Object {
|
| - /**
|
| - * @param {?SDK.Target} target
|
| - * @param {!Profiler.ProfileType} profileType
|
| - * @param {string} title
|
| - */
|
| - constructor(target, profileType, title) {
|
| - super();
|
| - this._target = target;
|
| - this._profileType = profileType;
|
| - this.title = title;
|
| - this.uid = profileType._nextProfileUid++;
|
| - this._fromFile = false;
|
| - }
|
| -
|
| - /**
|
| - * @return {?SDK.Target}
|
| - */
|
| - target() {
|
| - return this._target;
|
| - }
|
| -
|
| - /**
|
| - * @return {!Profiler.ProfileType}
|
| - */
|
| - profileType() {
|
| - return this._profileType;
|
| - }
|
| -
|
| - /**
|
| - * @param {?string} subtitle
|
| - * @param {boolean=} wait
|
| - */
|
| - updateStatus(subtitle, wait) {
|
| - this.dispatchEventToListeners(
|
| - Profiler.ProfileHeader.Events.UpdateStatus, new Profiler.ProfileHeader.StatusUpdate(subtitle, wait));
|
| - }
|
| -
|
| - /**
|
| - * Must be implemented by subclasses.
|
| - * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
|
| - * @return {!Profiler.ProfileSidebarTreeElement}
|
| - */
|
| - createSidebarTreeElement(dataDisplayDelegate) {
|
| - throw new Error('Needs implemented.');
|
| - }
|
| -
|
| - /**
|
| - * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate
|
| - * @return {!UI.Widget}
|
| - */
|
| - createView(dataDisplayDelegate) {
|
| - throw new Error('Not implemented.');
|
| - }
|
| -
|
| - removeTempFile() {
|
| - if (this._tempFile)
|
| - this._tempFile.remove();
|
| - }
|
| -
|
| - dispose() {
|
| - }
|
| -
|
| - /**
|
| - * @return {boolean}
|
| - */
|
| - canSaveToFile() {
|
| - return false;
|
| - }
|
| -
|
| - saveToFile() {
|
| - throw new Error('Needs implemented');
|
| - }
|
| -
|
| - /**
|
| - * @param {!File} file
|
| - */
|
| - loadFromFile(file) {
|
| - throw new Error('Needs implemented');
|
| - }
|
| -
|
| - /**
|
| - * @return {boolean}
|
| - */
|
| - fromFile() {
|
| - return this._fromFile;
|
| - }
|
| -
|
| - setFromFile() {
|
| - this._fromFile = true;
|
| - }
|
| -};
|
| -
|
| -/**
|
| - * @unrestricted
|
| - */
|
| -Profiler.ProfileHeader.StatusUpdate = class {
|
| - /**
|
| - * @param {?string} subtitle
|
| - * @param {boolean|undefined} wait
|
| - */
|
| - constructor(subtitle, wait) {
|
| - /** @type {?string} */
|
| - this.subtitle = subtitle;
|
| - /** @type {boolean|undefined} */
|
| - this.wait = wait;
|
| - }
|
| -};
|
| -
|
| -/** @enum {symbol} */
|
| -Profiler.ProfileHeader.Events = {
|
| - UpdateStatus: Symbol('UpdateStatus'),
|
| - ProfileReceived: Symbol('ProfileReceived')
|
| -};
|
| -
|
| -/**
|
| * @implements {Profiler.ProfileType.DataDisplayDelegate}
|
| * @unrestricted
|
| */
|
| @@ -688,7 +334,7 @@ Profiler.ProfilesPanel = class extends UI.PanelWithSidebar {
|
| * @param {!Profiler.ProfileHeader} profile
|
| */
|
| _removeProfileHeader(profile) {
|
| - if (profile.profileType()._profileBeingRecorded === profile)
|
| + if (profile.profileType().profileBeingRecorded() === profile)
|
| this._profileBeingRecordedRemoved();
|
|
|
| var i = this._indexOfViewForProfile(profile);
|
| @@ -793,66 +439,11 @@ Profiler.ProfilesPanel = class extends UI.PanelWithSidebar {
|
| }
|
|
|
| /**
|
| - * @param {!Event} event
|
| - * @param {!UI.ContextMenu} contextMenu
|
| - * @param {!Object} target
|
| - */
|
| - appendApplicableItems(event, contextMenu, target) {
|
| - if (!(target instanceof SDK.RemoteObject))
|
| - return;
|
| -
|
| - if (!this.isShowing())
|
| - return;
|
| -
|
| - var object = /** @type {!SDK.RemoteObject} */ (target);
|
| - var objectId = object.objectId;
|
| - if (!objectId)
|
| - return;
|
| -
|
| - var heapProfiles = Profiler.ProfileTypeRegistry.instance.heapSnapshotProfileType.getProfiles();
|
| - if (!heapProfiles.length)
|
| - return;
|
| -
|
| - /**
|
| - * @this {Profiler.ProfilesPanel}
|
| - */
|
| - function revealInView(viewName) {
|
| - object.target().heapProfilerAgent().getHeapObjectId(objectId, didReceiveHeapObjectId.bind(this, viewName));
|
| - }
|
| -
|
| - /**
|
| - * @this {Profiler.ProfilesPanel}
|
| - */
|
| - function didReceiveHeapObjectId(viewName, error, result) {
|
| - if (!this.isShowing())
|
| - return;
|
| - if (!error)
|
| - this.showObject(result, viewName);
|
| - }
|
| -
|
| - contextMenu.appendItem(Common.UIString.capitalize('Reveal in Summary ^view'), revealInView.bind(this, 'Summary'));
|
| - }
|
| -
|
| - /**
|
| - * @override
|
| - */
|
| - wasShown() {
|
| - UI.context.setFlavor(Profiler.ProfilesPanel, this);
|
| - }
|
| -
|
| - /**
|
| * @override
|
| */
|
| focus() {
|
| this._sidebarTree.focus();
|
| }
|
| -
|
| - /**
|
| - * @override
|
| - */
|
| - willHide() {
|
| - UI.context.setFlavor(Profiler.ProfilesPanel, null);
|
| - }
|
| };
|
|
|
| /**
|
| @@ -1009,22 +600,6 @@ Profiler.ProfileTypeSidebarSection.ProfileGroup = class {
|
| };
|
|
|
| /**
|
| - * @implements {UI.ContextMenu.Provider}
|
| - * @unrestricted
|
| - */
|
| -Profiler.ProfilesPanel.ContextMenuProvider = class {
|
| - /**
|
| - * @override
|
| - * @param {!Event} event
|
| - * @param {!UI.ContextMenu} contextMenu
|
| - * @param {!Object} target
|
| - */
|
| - appendApplicableItems(event, contextMenu, target) {
|
| - Profiler.ProfilesPanel._instance().appendApplicableItems(event, contextMenu, target);
|
| - }
|
| -};
|
| -
|
| -/**
|
| * @unrestricted
|
| */
|
| Profiler.ProfileSidebarTreeElement = class extends UI.TreeElement {
|
| @@ -1220,21 +795,3 @@ Profiler.ProfilesSidebarTreeElement = class extends UI.TreeElement {
|
| .textContent = Common.UIString('Profiles');
|
| }
|
| };
|
| -
|
| -/**
|
| - * @implements {UI.ActionDelegate}
|
| - */
|
| -Profiler.ProfilesPanel.RecordActionDelegate = class {
|
| - /**
|
| - * @override
|
| - * @param {!UI.Context} context
|
| - * @param {string} actionId
|
| - * @return {boolean}
|
| - */
|
| - handleAction(context, actionId) {
|
| - var panel = UI.context.flavor(Profiler.ProfilesPanel);
|
| - console.assert(panel && panel instanceof Profiler.ProfilesPanel);
|
| - panel.toggleRecord();
|
| - return true;
|
| - }
|
| -};
|
|
|