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

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

Issue 2626313002: DevTools: split ProfilesPanel into multiple files. (Closed)
Patch Set: rebaselined Created 3 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: third_party/WebKit/Source/devtools/front_end/profiler/MemoryProfilerPanel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/MemoryProfilerPanel.js b/third_party/WebKit/Source/devtools/front_end/profiler/MemoryProfilerPanel.js
new file mode 100644
index 0000000000000000000000000000000000000000..7ac515cee9505ad709ae1269e19788a99e6bc15b
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/MemoryProfilerPanel.js
@@ -0,0 +1,78 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @implements {UI.ContextMenu.Provider}
+ * @implements {UI.ActionDelegate}
+ */
+Profiler.MemoryProfilerPanel = class extends Profiler.ProfilesPanel {
+ /**
+ * @override
+ * @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
+ * @param {!UI.Context} context
+ * @param {string} actionId
+ * @return {boolean}
+ */
+ handleAction(context, actionId) {
+ var panel = UI.context.flavor(Profiler.MemoryProfilerPanel);
+ console.assert(panel && panel instanceof Profiler.MemoryProfilerPanel);
+ panel.toggleRecord();
+ return true;
+ }
+
+ /**
+ * @override
+ */
+ wasShown() {
+ UI.context.setFlavor(Profiler.MemoryProfilerPanel, this);
+ }
+
+ /**
+ * @override
+ */
+ willHide() {
+ UI.context.setFlavor(Profiler.MemoryProfilerPanel, null);
+ }
+};
« no previous file with comments | « third_party/WebKit/Source/devtools/BUILD.gn ('k') | third_party/WebKit/Source/devtools/front_end/profiler/ProfileHeader.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698