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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/profiler/ProfilesPanel.js
diff --git a/Source/devtools/front_end/profiler/ProfilesPanel.js b/Source/devtools/front_end/profiler/ProfilesPanel.js
index c68d2abf2788c285a1f2fa9db4d6524242fb7038..134b19974cce9a3a71780e242809d79dce2b0d51 100644
--- a/Source/devtools/front_end/profiler/ProfilesPanel.js
+++ b/Source/devtools/front_end/profiler/ProfilesPanel.js
@@ -311,9 +311,10 @@ WebInspector.ProfileHeader.prototype = {
},
/**
+ * @param {!WebInspector.ProfilesPanel} panel
* @return {!WebInspector.View}
*/
- createView: function()
+ createView: function(panel)
{
throw new Error("Not implemented.");
},
@@ -833,7 +834,7 @@ WebInspector.ProfilesPanel.prototype = {
var index = this._indexOfViewForProfile(profile);
if (index !== -1)
return this._profileToView[index].view;
- var view = profile.createView();
+ var view = profile.createView(this);
view.element.classList.add("profile-view");
this._profileToView.push({ profile: profile, view: view});
return view;
@@ -1136,6 +1137,25 @@ WebInspector.ProfilesPanel.ContextMenuProvider.prototype = {
/**
* @constructor
+ * @implements {WebInspector.Revealer}
+ */
+WebInspector.ProfilesPanel.ProfileRevealer = function()
+{
+}
+
+WebInspector.ProfilesPanel.ProfileRevealer.prototype = {
+ /**
+ * @param {!Object} profile
+ */
+ reveal: function(profile)
+ {
+ if (profile instanceof WebInspector.ProfileHeader)
+ /** @type {!WebInspector.ProfilesPanel} */ (WebInspector.inspectorView.panel("profiles")).showProfile(profile);
+ }
+}
+
+/**
+ * @constructor
* @extends {WebInspector.SidebarTreeElement}
* @param {!WebInspector.ProfileHeader} profile
* @param {string} className
@@ -1186,7 +1206,7 @@ WebInspector.ProfileSidebarTreeElement.prototype = {
onselect: function()
{
- WebInspector.panels.profiles.showProfile(this.profile);
+ 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.
},
/**
@@ -1237,7 +1257,7 @@ WebInspector.ProfileGroupSidebarTreeElement.prototype = {
onselect: function()
{
if (this.children.length > 0)
- WebInspector.panels.profiles.showProfile(this.children[this.children.length - 1].profile);
+ WebInspector.Revealer.reveal(this.children[this.children.length - 1].profile);
},
__proto__: WebInspector.SidebarTreeElement.prototype

Powered by Google App Engine
This is Rietveld 408576698