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

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

Issue 400633003: DevTools: introduce multitarget model listeners (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 * @constructor 1005 * @constructor
1006 * @extends {WebInspector.ProfileType} 1006 * @extends {WebInspector.ProfileType}
1007 * @implements {WebInspector.TargetManager.Observer} 1007 * @implements {WebInspector.TargetManager.Observer}
1008 * @param {string=} id 1008 * @param {string=} id
1009 * @param {string=} title 1009 * @param {string=} title
1010 */ 1010 */
1011 WebInspector.HeapSnapshotProfileType = function(id, title) 1011 WebInspector.HeapSnapshotProfileType = function(id, title)
1012 { 1012 {
1013 WebInspector.ProfileType.call(this, id || WebInspector.HeapSnapshotProfileTy pe.TypeId, title || WebInspector.UIString("Take Heap Snapshot")); 1013 WebInspector.ProfileType.call(this, id || WebInspector.HeapSnapshotProfileTy pe.TypeId, title || WebInspector.UIString("Take Heap Snapshot"));
1014 WebInspector.targetManager.observeTargets(this); 1014 WebInspector.targetManager.observeTargets(this);
1015 WebInspector.targetManager.addModelListener(WebInspector.HeapProfilerModel, WebInspector.HeapProfilerModel.Events.ResetProfiles, this._resetProfiles, this);
1016 WebInspector.targetManager.addModelListener(WebInspector.HeapProfilerModel, WebInspector.HeapProfilerModel.Events.AddHeapSnapshotChunk, this._addHeapSnapsho tChunk, this);
1017 WebInspector.targetManager.addModelListener(WebInspector.HeapProfilerModel, WebInspector.HeapProfilerModel.Events.ReportHeapSnapshotProgress, this._reportHe apSnapshotProgress, this);
1015 } 1018 }
1016 1019
1017 WebInspector.HeapSnapshotProfileType.TypeId = "HEAP"; 1020 WebInspector.HeapSnapshotProfileType.TypeId = "HEAP";
1018 WebInspector.HeapSnapshotProfileType.SnapshotReceived = "SnapshotReceived"; 1021 WebInspector.HeapSnapshotProfileType.SnapshotReceived = "SnapshotReceived";
1019 1022
1020 WebInspector.HeapSnapshotProfileType.prototype = { 1023 WebInspector.HeapSnapshotProfileType.prototype = {
1021 /** 1024 /**
1022 * @param {!WebInspector.Target} target 1025 * @param {!WebInspector.Target} target
1023 */ 1026 */
1024 targetAdded: function(target) 1027 targetAdded: function(target)
1025 { 1028 {
1026 target.heapProfilerModel.enable(); 1029 target.heapProfilerModel.enable();
1027 target.heapProfilerModel.addEventListener(WebInspector.HeapProfilerModel .Events.ResetProfiles, this._resetProfiles, this);
1028 target.heapProfilerModel.addEventListener(WebInspector.HeapProfilerModel .Events.AddHeapSnapshotChunk, this._addHeapSnapshotChunk, this);
1029 target.heapProfilerModel.addEventListener(WebInspector.HeapProfilerModel .Events.ReportHeapSnapshotProgress, this._reportHeapSnapshotProgress, this);
1030 }, 1030 },
1031 1031
1032 /** 1032 /**
1033 * @param {!WebInspector.Target} target 1033 * @param {!WebInspector.Target} target
1034 */ 1034 */
1035 targetRemoved: function(target) 1035 targetRemoved: function(target)
1036 { 1036 {
1037 target.heapProfilerModel.removeEventListener(WebInspector.HeapProfilerMo del.Events.ResetProfiles, this._resetProfiles, this);
1038 target.heapProfilerModel.removeEventListener(WebInspector.HeapProfilerMo del.Events.AddHeapSnapshotChunk, this._addHeapSnapshotChunk, this);
1039 target.heapProfilerModel.removeEventListener(WebInspector.HeapProfilerMo del.Events.ReportHeapSnapshotProgress, this._reportHeapSnapshotProgress, this);
1040 }, 1037 },
1041 1038
1042 /** 1039 /**
1043 * @override 1040 * @override
1044 * @return {string} 1041 * @return {string}
1045 */ 1042 */
1046 fileExtension: function() 1043 fileExtension: function()
1047 { 1044 {
1048 return ".heapsnapshot"; 1045 return ".heapsnapshot";
1049 }, 1046 },
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 name.textContent = frame.functionName; 2170 name.textContent = frame.functionName;
2174 if (frame.scriptId) { 2171 if (frame.scriptId) {
2175 var urlElement = this._linkifier.linkifyLocationByScriptId(this. _weakTarget.get(), String(frame.scriptId), frame.scriptName, frame.line - 1, fra me.column - 1); 2172 var urlElement = this._linkifier.linkifyLocationByScriptId(this. _weakTarget.get(), String(frame.scriptId), frame.scriptName, frame.line - 1, fra me.column - 1);
2176 frameDiv.appendChild(urlElement); 2173 frameDiv.appendChild(urlElement);
2177 } 2174 }
2178 } 2175 }
2179 }, 2176 },
2180 2177
2181 __proto__: WebInspector.View.prototype 2178 __proto__: WebInspector.View.prototype
2182 } 2179 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/profiler/CPUProfileView.js ('k') | Source/devtools/front_end/sdk/CPUProfilerModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698