OLD | NEW |
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 { | 231 { |
232 return this._profileBeingRecorded; | 232 return this._profileBeingRecorded; |
233 }, | 233 }, |
234 | 234 |
235 /** | 235 /** |
236 * @param {?WebInspector.ProfileHeader} profile | 236 * @param {?WebInspector.ProfileHeader} profile |
237 */ | 237 */ |
238 setProfileBeingRecorded: function(profile) | 238 setProfileBeingRecorded: function(profile) |
239 { | 239 { |
240 if (this._profileBeingRecorded && this._profileBeingRecorded.target()) | 240 if (this._profileBeingRecorded && this._profileBeingRecorded.target()) |
241 WebInspector.profilingLock.release(); | 241 this._profileBeingRecorded.target().profilingLock.release(); |
242 if (profile && profile.target()) | 242 if (profile && profile.target()) |
243 WebInspector.profilingLock.acquire(); | 243 profile.target().profilingLock.acquire(); |
244 this._profileBeingRecorded = profile; | 244 this._profileBeingRecorded = profile; |
245 }, | 245 }, |
246 | 246 |
247 profileBeingRecordedRemoved: function() | 247 profileBeingRecordedRemoved: function() |
248 { | 248 { |
249 }, | 249 }, |
250 | 250 |
251 _reset: function() | 251 _reset: function() |
252 { | 252 { |
253 var profiles = this._profiles.slice(0); | 253 var profiles = this._profiles.slice(0); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 this._fromFile = true; | 433 this._fromFile = true; |
434 }, | 434 }, |
435 | 435 |
436 __proto__: WebInspector.Object.prototype | 436 __proto__: WebInspector.Object.prototype |
437 } | 437 } |
438 | 438 |
439 /** | 439 /** |
440 * @constructor | 440 * @constructor |
441 * @implements {WebInspector.Searchable} | 441 * @implements {WebInspector.Searchable} |
442 * @implements {WebInspector.ProfileType.DataDisplayDelegate} | 442 * @implements {WebInspector.ProfileType.DataDisplayDelegate} |
| 443 * @implements {WebInspector.TargetManager.Observer} |
443 * @extends {WebInspector.PanelWithSidebarTree} | 444 * @extends {WebInspector.PanelWithSidebarTree} |
444 */ | 445 */ |
445 WebInspector.ProfilesPanel = function() | 446 WebInspector.ProfilesPanel = function() |
446 { | 447 { |
447 WebInspector.PanelWithSidebarTree.call(this, "profiles"); | 448 WebInspector.PanelWithSidebarTree.call(this, "profiles"); |
448 this.registerRequiredCSS("panelEnablerView.css"); | 449 this.registerRequiredCSS("panelEnablerView.css"); |
449 this.registerRequiredCSS("heapProfiler.css"); | 450 this.registerRequiredCSS("heapProfiler.css"); |
450 this.registerRequiredCSS("profilesPanel.css"); | 451 this.registerRequiredCSS("profilesPanel.css"); |
451 | 452 |
452 this._searchableView = new WebInspector.SearchableView(this); | 453 this._searchableView = new WebInspector.SearchableView(this); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 for (var i = 0; i < types.length; i++) | 494 for (var i = 0; i < types.length; i++) |
494 this._registerProfileType(types[i]); | 495 this._registerProfileType(types[i]); |
495 this._launcherView.restoreSelectedProfileType(); | 496 this._launcherView.restoreSelectedProfileType(); |
496 this.profilesItemTreeElement.select(); | 497 this.profilesItemTreeElement.select(); |
497 this._showLauncherView(); | 498 this._showLauncherView(); |
498 | 499 |
499 this._createFileSelectorElement(); | 500 this._createFileSelectorElement(); |
500 this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bi
nd(this), true); | 501 this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bi
nd(this), true); |
501 this._registerShortcuts(); | 502 this._registerShortcuts(); |
502 | 503 |
503 WebInspector.profilingLock.addEventListener(WebInspector.Lock.Events.StateCh
anged, this._onProfilingStateChanged, this); | 504 WebInspector.targetManager.observeTargets(this); |
504 } | 505 } |
505 | 506 |
506 WebInspector.ProfilesPanel.prototype = { | 507 WebInspector.ProfilesPanel.prototype = { |
507 /** | 508 /** |
| 509 * @param {!WebInspector.Target} target |
| 510 */ |
| 511 targetAdded: function(target) |
| 512 { |
| 513 target.profilingLock.addEventListener(WebInspector.Lock.Events.StateChan
ged, this._onProfilingStateChanged, this); |
| 514 }, |
| 515 |
| 516 /** |
| 517 * @param {!WebInspector.Target} target |
| 518 */ |
| 519 targetRemoved: function(target) |
| 520 { |
| 521 target.profilingLock.removeEventListener(WebInspector.Lock.Events.StateC
hanged, this._onProfilingStateChanged, this); |
| 522 }, |
| 523 |
| 524 /** |
508 * @return {!WebInspector.SearchableView} | 525 * @return {!WebInspector.SearchableView} |
509 */ | 526 */ |
510 searchableView: function() | 527 searchableView: function() |
511 { | 528 { |
512 return this._searchableView; | 529 return this._searchableView; |
513 }, | 530 }, |
514 | 531 |
515 _createFileSelectorElement: function() | 532 _createFileSelectorElement: function() |
516 { | 533 { |
517 if (this._fileSelectorElement) | 534 if (this._fileSelectorElement) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 this._updateRecordButton(this.recordButton.toggled); | 610 this._updateRecordButton(this.recordButton.toggled); |
594 }, | 611 }, |
595 | 612 |
596 /** | 613 /** |
597 * @param {boolean} toggled | 614 * @param {boolean} toggled |
598 */ | 615 */ |
599 _updateRecordButton: function(toggled) | 616 _updateRecordButton: function(toggled) |
600 { | 617 { |
601 if (WebInspector.experimentsSettings.disableAgentsWhenProfile.isEnabled(
)) | 618 if (WebInspector.experimentsSettings.disableAgentsWhenProfile.isEnabled(
)) |
602 WebInspector.inspectorView.setCurrentPanelLocked(toggled); | 619 WebInspector.inspectorView.setCurrentPanelLocked(toggled); |
603 var isAcquiredInSomeTarget = WebInspector.profilingLock.isAcquired(); | 620 var isAcquiredInSomeTarget = WebInspector.targetManager.targets().some(f
unction(target) { return target.profilingLock.isAcquired(); }); |
604 var enable = toggled || !isAcquiredInSomeTarget; | 621 var enable = toggled || !isAcquiredInSomeTarget; |
605 this.recordButton.setEnabled(enable); | 622 this.recordButton.setEnabled(enable); |
606 this.recordButton.toggled = toggled; | 623 this.recordButton.toggled = toggled; |
607 if (enable) | 624 if (enable) |
608 this.recordButton.title = this._selectedProfileType ? this._selected
ProfileType.buttonTooltip : ""; | 625 this.recordButton.title = this._selectedProfileType ? this._selected
ProfileType.buttonTooltip : ""; |
609 else | 626 else |
610 this.recordButton.title = WebInspector.anotherProfilerActiveLabel(); | 627 this.recordButton.title = WebInspector.anotherProfilerActiveLabel(); |
611 if (this._selectedProfileType) | 628 if (this._selectedProfileType) |
612 this._launcherView.updateProfileType(this._selectedProfileType, enab
le); | 629 this._launcherView.updateProfileType(this._selectedProfileType, enab
le); |
613 }, | 630 }, |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 this._panel._showLauncherView(); | 1304 this._panel._showLauncherView(); |
1288 }, | 1305 }, |
1289 | 1306 |
1290 get selectable() | 1307 get selectable() |
1291 { | 1308 { |
1292 return true; | 1309 return true; |
1293 }, | 1310 }, |
1294 | 1311 |
1295 __proto__: WebInspector.SidebarTreeElement.prototype | 1312 __proto__: WebInspector.SidebarTreeElement.prototype |
1296 } | 1313 } |
OLD | NEW |