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

Unified Diff: Source/devtools/front_end/ProfilesPanel.js

Issue 147923011: Remove unnecessary _profileTypesByIdMap map (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months 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: Source/devtools/front_end/ProfilesPanel.js
diff --git a/Source/devtools/front_end/ProfilesPanel.js b/Source/devtools/front_end/ProfilesPanel.js
index 41321d2de08313fc1f0a78046e0caed485c5a25f..3df02ba70c8015a350e481718ce23854f7739429 100644
--- a/Source/devtools/front_end/ProfilesPanel.js
+++ b/Source/devtools/front_end/ProfilesPanel.js
@@ -384,8 +384,6 @@ WebInspector.ProfilesPanel = function()
this.profilesItemTreeElement = new WebInspector.ProfilesSidebarTreeElement(this);
this.sidebarTree.appendChild(this.profilesItemTreeElement);
- this._profileTypesByIdMap = {};
-
this.profileViews = document.createElement("div");
this.profileViews.id = "profile-views";
this.profileViews.classList.add("vbox");
@@ -497,8 +495,9 @@ WebInspector.ProfilesPanel.prototype = {
_findProfileTypeByExtension: function(fileName)
{
- for (var id in this._profileTypesByIdMap) {
- var type = this._profileTypesByIdMap[id];
+ var types = WebInspector.ProfileTypeRegistry.instance.profileTypes();
+ for (var i = 0; i < types.length; i++) {
+ var type = types[i];
var extension = type.fileExtension();
if (!extension)
continue;
@@ -534,8 +533,9 @@ WebInspector.ProfilesPanel.prototype = {
var profileType = this._findProfileTypeByExtension(file.name);
if (!profileType) {
var extensions = [];
- for (var id in this._profileTypesByIdMap) {
- var extension = this._profileTypesByIdMap[id].fileExtension();
+ var types = WebInspector.ProfileTypeRegistry.instance.profileTypes();
+ for (var i = 0; i < types.length; i++) {
+ var extension = types[i].fileExtension();
if (!extension)
continue;
extensions.push(extension);
@@ -603,8 +603,9 @@ WebInspector.ProfilesPanel.prototype = {
{
WebInspector.Panel.prototype.reset.call(this);
- for (var typeId in this._profileTypesByIdMap)
- this._profileTypesByIdMap[typeId]._reset();
+ var types = WebInspector.ProfileTypeRegistry.instance.profileTypes();
+ for (var i = 0; i < types.length; i++)
+ types[i]._reset();
delete this.visibleView;
delete this.currentQuery;
@@ -655,7 +656,6 @@ WebInspector.ProfilesPanel.prototype = {
*/
_registerProfileType: function(profileType)
{
- this._profileTypesByIdMap[profileType.id] = profileType;
this._launcherView.addProfileType(profileType);
profileType.treeElement = new WebInspector.SidebarSectionTreeElement(profileType.treeItemTitle, null, true);
profileType.treeElement.hidden = true;
@@ -858,7 +858,7 @@ WebInspector.ProfilesPanel.prototype = {
*/
showObject: function(snapshotObjectId, viewName)
{
- var heapProfiles = this.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId).getProfiles();
+ var heapProfiles = WebInspector.ProfileTypeRegistry.instance.heapSnapshotProfileType.getProfiles();
for (var i = 0; i < heapProfiles.length; i++) {
var profile = heapProfiles[i];
// FIXME: allow to choose snapshot if there are several options.
@@ -878,16 +878,6 @@ WebInspector.ProfilesPanel.prototype = {
},
/**
- * @param {string} typeId
- * @param {number} uid
- * @return {?WebInspector.ProfileHeader}
- */
- getProfile: function(typeId, uid)
- {
- return this.getProfileType(typeId).getProfile(uid);
- },
-
- /**
* @param {!WebInspector.View} view
*/
showView: function(view)
@@ -895,25 +885,6 @@ WebInspector.ProfilesPanel.prototype = {
this._showProfile(view.profile);
},
- /**
- * @param {string} typeId
- * @return {!WebInspector.ProfileType}
- */
- getProfileType: function(typeId)
- {
- return this._profileTypesByIdMap[typeId];
- },
-
- /**
- * @param {string} typeId
- * @param {string} uid
- * @return {?WebInspector.View}
- */
- showProfile: function(typeId, uid)
- {
- return this._showProfile(this.getProfile(typeId, Number(uid)));
- },
-
closeVisibleView: function()
{
if (this.visibleView)
@@ -972,17 +943,6 @@ WebInspector.ProfilesPanel.prototype = {
this._searchableView.updateCurrentMatchIndex(this._searchResultsView.currentSearchResultIndex());
},
- /**
- * @return {!Array.<!WebInspector.ProfileHeader>}
- */
- _getAllProfiles: function()
- {
- var profiles = [];
- for (var typeId in this._profileTypesByIdMap)
- profiles = profiles.concat(this._profileTypesByIdMap[typeId].getProfiles());
- return profiles;
- },
-
searchCanceled: function()
{
if (this._searchResultsView) {
@@ -1022,7 +982,7 @@ WebInspector.ProfilesPanel.prototype = {
if (!objectId)
return;
- var heapProfiles = this.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId).getProfiles();
+ var heapProfiles = WebInspector.ProfileTypeRegistry.instance.heapSnapshotProfileType.getProfiles();
if (!heapProfiles.length)
return;

Powered by Google App Engine
This is Rietveld 408576698