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

Side by Side Diff: Source/devtools/front_end/profiler/ProfilesPanel.js

Issue 268293003: DevTools: Get rid of WebInspector.panels (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 /** 304 /**
305 * Must be implemented by subclasses. 305 * Must be implemented by subclasses.
306 * @return {!WebInspector.ProfileSidebarTreeElement} 306 * @return {!WebInspector.ProfileSidebarTreeElement}
307 */ 307 */
308 createSidebarTreeElement: function() 308 createSidebarTreeElement: function()
309 { 309 {
310 throw new Error("Needs implemented."); 310 throw new Error("Needs implemented.");
311 }, 311 },
312 312
313 /** 313 /**
314 * @param {!WebInspector.ProfilesPanel} panel
314 * @return {!WebInspector.View} 315 * @return {!WebInspector.View}
315 */ 316 */
316 createView: function() 317 createView: function(panel)
317 { 318 {
318 throw new Error("Not implemented."); 319 throw new Error("Not implemented.");
319 }, 320 },
320 321
321 removeTempFile: function() 322 removeTempFile: function()
322 { 323 {
323 if (this._tempFile) 324 if (this._tempFile)
324 this._tempFile.remove(); 325 this._tempFile.remove();
325 }, 326 },
326 327
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 this._profileViewStatusBarItemsContainer = this._statusBarElement.createChil d("div"); 423 this._profileViewStatusBarItemsContainer = this._statusBarElement.createChil d("div");
423 424
424 this._profileGroups = {}; 425 this._profileGroups = {};
425 this._launcherView = new WebInspector.MultiProfileLauncherView(this); 426 this._launcherView = new WebInspector.MultiProfileLauncherView(this);
426 this._launcherView.addEventListener(WebInspector.MultiProfileLauncherView.Ev entTypes.ProfileTypeSelected, this._onProfileTypeSelected, this); 427 this._launcherView.addEventListener(WebInspector.MultiProfileLauncherView.Ev entTypes.ProfileTypeSelected, this._onProfileTypeSelected, this);
427 428
428 this._profileToView = []; 429 this._profileToView = [];
429 this._typeIdToSidebarSection = {}; 430 this._typeIdToSidebarSection = {};
430 var types = WebInspector.ProfileTypeRegistry.instance.profileTypes(); 431 var types = WebInspector.ProfileTypeRegistry.instance.profileTypes();
431 for (var i = 0; i < types.length; i++) 432 for (var i = 0; i < types.length; i++)
432 this._registerProfileType(types[i]); 433 this._registerProfileType(types[i]);
yurys 2014/05/07 14:43:41 Let's register panel as a listener for HeapSnapsho
apavlov 2014/05/07 15:54:23 Done.
433 this._launcherView.restoreSelectedProfileType(); 434 this._launcherView.restoreSelectedProfileType();
434 this.profilesItemTreeElement.select(); 435 this.profilesItemTreeElement.select();
435 this._showLauncherView(); 436 this._showLauncherView();
436 437
437 this._createFileSelectorElement(); 438 this._createFileSelectorElement();
438 this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bi nd(this), true); 439 this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bi nd(this), true);
439 this._registerShortcuts(); 440 this._registerShortcuts();
440 441
441 this._configureCpuProfilerSamplingInterval(); 442 this._configureCpuProfilerSamplingInterval();
442 WebInspector.settings.highResolutionCpuProfiling.addChangeListener(this._con figureCpuProfilerSamplingInterval, this); 443 WebInspector.settings.highResolutionCpuProfiling.addChangeListener(this._con figureCpuProfilerSamplingInterval, this);
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 827
827 /** 828 /**
828 * @param {!WebInspector.ProfileHeader} profile 829 * @param {!WebInspector.ProfileHeader} profile
829 * @return {!WebInspector.View} 830 * @return {!WebInspector.View}
830 */ 831 */
831 _viewForProfile: function(profile) 832 _viewForProfile: function(profile)
832 { 833 {
833 var index = this._indexOfViewForProfile(profile); 834 var index = this._indexOfViewForProfile(profile);
834 if (index !== -1) 835 if (index !== -1)
835 return this._profileToView[index].view; 836 return this._profileToView[index].view;
836 var view = profile.createView(); 837 var view = profile.createView(this);
837 view.element.classList.add("profile-view"); 838 view.element.classList.add("profile-view");
838 this._profileToView.push({ profile: profile, view: view}); 839 this._profileToView.push({ profile: profile, view: view});
839 return view; 840 return view;
840 }, 841 },
841 842
842 /** 843 /**
843 * @param {!WebInspector.ProfileHeader} profile 844 * @param {!WebInspector.ProfileHeader} profile
844 * @return {number} 845 * @return {number}
845 */ 846 */
846 _indexOfViewForProfile: function(profile) 847 _indexOfViewForProfile: function(profile)
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 * @param {!Object} target 1130 * @param {!Object} target
1130 */ 1131 */
1131 appendApplicableItems: function(event, contextMenu, target) 1132 appendApplicableItems: function(event, contextMenu, target)
1132 { 1133 {
1133 WebInspector.inspectorView.panel("profiles").appendApplicableItems(event , contextMenu, target); 1134 WebInspector.inspectorView.panel("profiles").appendApplicableItems(event , contextMenu, target);
1134 } 1135 }
1135 } 1136 }
1136 1137
1137 /** 1138 /**
1138 * @constructor 1139 * @constructor
1140 * @implements {WebInspector.Revealer}
1141 */
1142 WebInspector.ProfilesPanel.ProfileRevealer = function()
1143 {
1144 }
1145
1146 WebInspector.ProfilesPanel.ProfileRevealer.prototype = {
1147 /**
1148 * @param {!Object} profile
1149 */
1150 reveal: function(profile)
1151 {
1152 if (profile instanceof WebInspector.ProfileHeader)
1153 /** @type {!WebInspector.ProfilesPanel} */ (WebInspector.inspectorVi ew.panel("profiles")).showProfile(profile);
1154 }
1155 }
1156
1157 /**
1158 * @constructor
1139 * @extends {WebInspector.SidebarTreeElement} 1159 * @extends {WebInspector.SidebarTreeElement}
1140 * @param {!WebInspector.ProfileHeader} profile 1160 * @param {!WebInspector.ProfileHeader} profile
1141 * @param {string} className 1161 * @param {string} className
1142 */ 1162 */
1143 WebInspector.ProfileSidebarTreeElement = function(profile, className) 1163 WebInspector.ProfileSidebarTreeElement = function(profile, className)
1144 { 1164 {
1145 this.profile = profile; 1165 this.profile = profile;
1146 WebInspector.SidebarTreeElement.call(this, className, profile.title, "", pro file, false); 1166 WebInspector.SidebarTreeElement.call(this, className, profile.title, "", pro file, false);
1147 this.refreshTitles(); 1167 this.refreshTitles();
1148 profile.addEventListener(WebInspector.ProfileHeader.Events.UpdateStatus, thi s._updateStatus, this); 1168 profile.addEventListener(WebInspector.ProfileHeader.Events.UpdateStatus, thi s._updateStatus, this);
(...skipping 30 matching lines...) Expand all
1179 }, 1199 },
1180 1200
1181 dispose: function() 1201 dispose: function()
1182 { 1202 {
1183 this.profile.removeEventListener(WebInspector.ProfileHeader.Events.Updat eStatus, this._updateStatus, this); 1203 this.profile.removeEventListener(WebInspector.ProfileHeader.Events.Updat eStatus, this._updateStatus, this);
1184 this.profile.removeEventListener(WebInspector.ProfileHeader.Events.Profi leReceived, this._onProfileReceived, this); 1204 this.profile.removeEventListener(WebInspector.ProfileHeader.Events.Profi leReceived, this._onProfileReceived, this);
1185 }, 1205 },
1186 1206
1187 onselect: function() 1207 onselect: function()
1188 { 1208 {
1189 WebInspector.panels.profiles.showProfile(this.profile); 1209 WebInspector.Revealer.reveal(this.profile);
yurys 2014/05/07 14:43:41 We can store panel reference in a field.
apavlov 2014/05/07 15:54:23 Done.
1190 }, 1210 },
1191 1211
1192 /** 1212 /**
1193 * @return {boolean} 1213 * @return {boolean}
1194 */ 1214 */
1195 ondelete: function() 1215 ondelete: function()
1196 { 1216 {
1197 this.profile.profileType().removeProfile(this.profile); 1217 this.profile.profileType().removeProfile(this.profile);
1198 return true; 1218 return true;
1199 }, 1219 },
(...skipping 30 matching lines...) Expand all
1230 */ 1250 */
1231 WebInspector.ProfileGroupSidebarTreeElement = function(title, subtitle) 1251 WebInspector.ProfileGroupSidebarTreeElement = function(title, subtitle)
1232 { 1252 {
1233 WebInspector.SidebarTreeElement.call(this, "profile-group-sidebar-tree-item" , title, subtitle, null, true); 1253 WebInspector.SidebarTreeElement.call(this, "profile-group-sidebar-tree-item" , title, subtitle, null, true);
1234 } 1254 }
1235 1255
1236 WebInspector.ProfileGroupSidebarTreeElement.prototype = { 1256 WebInspector.ProfileGroupSidebarTreeElement.prototype = {
1237 onselect: function() 1257 onselect: function()
1238 { 1258 {
1239 if (this.children.length > 0) 1259 if (this.children.length > 0)
1240 WebInspector.panels.profiles.showProfile(this.children[this.children .length - 1].profile); 1260 WebInspector.Revealer.reveal(this.children[this.children.length - 1] .profile);
1241 }, 1261 },
1242 1262
1243 __proto__: WebInspector.SidebarTreeElement.prototype 1263 __proto__: WebInspector.SidebarTreeElement.prototype
1244 } 1264 }
1245 1265
1246 /** 1266 /**
1247 * @constructor 1267 * @constructor
1248 * @extends {WebInspector.SidebarTreeElement} 1268 * @extends {WebInspector.SidebarTreeElement}
1249 * @param {!WebInspector.ProfilesPanel} panel 1269 * @param {!WebInspector.ProfilesPanel} panel
1250 */ 1270 */
(...skipping 29 matching lines...) Expand all
1280 importScript("HeapSnapshotCommon.js"); 1300 importScript("HeapSnapshotCommon.js");
1281 importScript("HeapSnapshotProxy.js"); 1301 importScript("HeapSnapshotProxy.js");
1282 importScript("HeapSnapshotDataGrids.js"); 1302 importScript("HeapSnapshotDataGrids.js");
1283 importScript("HeapSnapshotGridNodes.js"); 1303 importScript("HeapSnapshotGridNodes.js");
1284 importScript("HeapSnapshotView.js"); 1304 importScript("HeapSnapshotView.js");
1285 importScript("ProfileLauncherView.js"); 1305 importScript("ProfileLauncherView.js");
1286 importScript("CanvasProfileView.js"); 1306 importScript("CanvasProfileView.js");
1287 importScript("CanvasReplayStateView.js"); 1307 importScript("CanvasReplayStateView.js");
1288 1308
1289 WebInspector.ProfileTypeRegistry.instance = new WebInspector.ProfileTypeRegistry (); 1309 WebInspector.ProfileTypeRegistry.instance = new WebInspector.ProfileTypeRegistry ();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698