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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * @implements {UI.ContextMenu.Provider}
7 * @implements {UI.ActionDelegate}
8 */
9 Profiler.MemoryProfilerPanel = class extends Profiler.ProfilesPanel {
10 /**
11 * @override
12 * @param {!Event} event
13 * @param {!UI.ContextMenu} contextMenu
14 * @param {!Object} target
15 */
16 appendApplicableItems(event, contextMenu, target) {
17 if (!(target instanceof SDK.RemoteObject))
18 return;
19
20 if (!this.isShowing())
21 return;
22
23 var object = /** @type {!SDK.RemoteObject} */ (target);
24 var objectId = object.objectId;
25 if (!objectId)
26 return;
27
28 var heapProfiles = Profiler.ProfileTypeRegistry.instance.heapSnapshotProfile Type.getProfiles();
29 if (!heapProfiles.length)
30 return;
31
32 /**
33 * @this {Profiler.ProfilesPanel}
34 */
35 function revealInView(viewName) {
36 object.target().heapProfilerAgent().getHeapObjectId(objectId, didReceiveHe apObjectId.bind(this, viewName));
37 }
38
39 /**
40 * @this {Profiler.ProfilesPanel}
41 */
42 function didReceiveHeapObjectId(viewName, error, result) {
43 if (!this.isShowing())
44 return;
45 if (!error)
46 this.showObject(result, viewName);
47 }
48
49 contextMenu.appendItem(Common.UIString.capitalize('Reveal in Summary ^view') , revealInView.bind(this, 'Summary'));
50 }
51
52 /**
53 * @override
54 * @param {!UI.Context} context
55 * @param {string} actionId
56 * @return {boolean}
57 */
58 handleAction(context, actionId) {
59 var panel = UI.context.flavor(Profiler.MemoryProfilerPanel);
60 console.assert(panel && panel instanceof Profiler.MemoryProfilerPanel);
61 panel.toggleRecord();
62 return true;
63 }
64
65 /**
66 * @override
67 */
68 wasShown() {
69 UI.context.setFlavor(Profiler.MemoryProfilerPanel, this);
70 }
71
72 /**
73 * @override
74 */
75 willHide() {
76 UI.context.setFlavor(Profiler.MemoryProfilerPanel, null);
77 }
78 };
OLDNEW
« 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