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

Side by Side Diff: Source/devtools/front_end/timeline/TimelinePanel.js

Issue 475803002: Make profiling lock global rather than per Target (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Extracted Lock.js Created 6 years, 4 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 16 matching lines...) Expand all
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 /** 32 /**
33 * @constructor 33 * @constructor
34 * @extends {WebInspector.Panel} 34 * @extends {WebInspector.Panel}
35 * @implements {WebInspector.TimelineModeViewDelegate} 35 * @implements {WebInspector.TimelineModeViewDelegate}
36 * @implements {WebInspector.Searchable} 36 * @implements {WebInspector.Searchable}
37 * @implements {WebInspector.TargetManager.Observer}
38 */ 37 */
39 WebInspector.TimelinePanel = function() 38 WebInspector.TimelinePanel = function()
40 { 39 {
41 WebInspector.Panel.call(this, "timeline"); 40 WebInspector.Panel.call(this, "timeline");
42 this.registerRequiredCSS("timelinePanel.css"); 41 this.registerRequiredCSS("timelinePanel.css");
43 this.registerRequiredCSS("layersPanel.css"); 42 this.registerRequiredCSS("layersPanel.css");
44 this.registerRequiredCSS("filter.css"); 43 this.registerRequiredCSS("filter.css");
45 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse); 44 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse);
46 45
47 this._detailsLinkifier = new WebInspector.Linkifier(); 46 this._detailsLinkifier = new WebInspector.Linkifier();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 this._stackView = new WebInspector.StackView(false); 116 this._stackView = new WebInspector.StackView(false);
118 this._stackView.show(this._searchableView.element); 117 this._stackView.show(this._searchableView.element);
119 this._stackView.element.classList.add("timeline-view-stack"); 118 this._stackView.element.classList.add("timeline-view-stack");
120 119
121 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._dockSideChanged.bind(this)); 120 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._dockSideChanged.bind(this));
122 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi s._dockSideChanged.bind(this)); 121 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi s._dockSideChanged.bind(this));
123 this._dockSideChanged(); 122 this._dockSideChanged();
124 123
125 this._onModeChanged(); 124 this._onModeChanged();
126 this._detailsSplitView.show(this.element); 125 this._detailsSplitView.show(this.element);
126 WebInspector.profilingLock.addEventListener(WebInspector.Lock.Events.StateCh anged, this._onProfilingStateChanged, this);
127 } 127 }
128 128
129 WebInspector.TimelinePanel.OverviewMode = { 129 WebInspector.TimelinePanel.OverviewMode = {
130 Events: "Events", 130 Events: "Events",
131 Frames: "Frames" 131 Frames: "Frames"
132 }; 132 };
133 133
134 // Define row and header height, should be in sync with styles for timeline grap hs. 134 // Define row and header height, should be in sync with styles for timeline grap hs.
135 WebInspector.TimelinePanel.rowHeight = 18; 135 WebInspector.TimelinePanel.rowHeight = 18;
136 WebInspector.TimelinePanel.headerHeight = 20; 136 WebInspector.TimelinePanel.headerHeight = 20;
137 137
138 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15]; 138 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15];
139 139
140 WebInspector.TimelinePanel.prototype = { 140 WebInspector.TimelinePanel.prototype = {
141 /** 141 /**
142 * @param {!WebInspector.Target} target
143 */
144 targetAdded: function(target)
145 {
146 target.profilingLock.addEventListener(WebInspector.Lock.Events.StateChan ged, this._onProfilingStateChanged, this);
147 },
148
149 /**
150 * @param {!WebInspector.Target} target
151 */
152 targetRemoved: function(target)
153 {
154 target.profilingLock.removeEventListener(WebInspector.Lock.Events.StateC hanged, this._onProfilingStateChanged, this);
155 },
156
157 /**
158 * @return {?WebInspector.SearchableView} 142 * @return {?WebInspector.SearchableView}
159 */ 143 */
160 searchableView: function() 144 searchableView: function()
161 { 145 {
162 return this._searchableView; 146 return this._searchableView;
163 }, 147 },
164 148
165 wasShown: function() 149 wasShown: function()
166 { 150 {
167 if (!WebInspector.TimelinePanel._categoryStylesInitialized) { 151 if (!WebInspector.TimelinePanel._categoryStylesInitialized) {
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 _onProfilingStateChanged: function() 667 _onProfilingStateChanged: function()
684 { 668 {
685 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled); 669 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled);
686 }, 670 },
687 671
688 /** 672 /**
689 * @param {boolean} toggled 673 * @param {boolean} toggled
690 */ 674 */
691 _updateToggleTimelineButton: function(toggled) 675 _updateToggleTimelineButton: function(toggled)
692 { 676 {
693 var isAcquiredInSomeTarget = WebInspector.targetManager.targets().some(f unction(target) { return target.profilingLock.isAcquired(); }); 677 var isAcquiredInSomeTarget = WebInspector.profilingLock.isAcquired();
694 this.toggleTimelineButton.toggled = toggled; 678 this.toggleTimelineButton.toggled = toggled;
695 if (toggled) { 679 if (toggled) {
696 this.toggleTimelineButton.title = WebInspector.UIString("Stop"); 680 this.toggleTimelineButton.title = WebInspector.UIString("Stop");
697 this.toggleTimelineButton.setEnabled(true); 681 this.toggleTimelineButton.setEnabled(true);
698 } else if (this._stopPending) { 682 } else if (this._stopPending) {
699 this.toggleTimelineButton.title = WebInspector.UIString("Stop pendin g"); 683 this.toggleTimelineButton.title = WebInspector.UIString("Stop pendin g");
700 this.toggleTimelineButton.setEnabled(false); 684 this.toggleTimelineButton.setEnabled(false);
701 } else if (isAcquiredInSomeTarget) { 685 } else if (isAcquiredInSomeTarget) {
702 this.toggleTimelineButton.title = WebInspector.anotherProfilerActive Label(); 686 this.toggleTimelineButton.title = WebInspector.anotherProfilerActive Label();
703 this.toggleTimelineButton.setEnabled(false); 687 this.toggleTimelineButton.setEnabled(false);
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 * @param {!WebInspector.TimelineModel.Record} record 1410 * @param {!WebInspector.TimelineModel.Record} record
1427 * @return {boolean} 1411 * @return {boolean}
1428 */ 1412 */
1429 accept: function(record) 1413 accept: function(record)
1430 { 1414 {
1431 return !this._regex || this._uiUtils.testContentMatching(record, this._r egex); 1415 return !this._regex || this._uiUtils.testContentMatching(record, this._r egex);
1432 }, 1416 },
1433 1417
1434 __proto__: WebInspector.TimelineModel.Filter.prototype 1418 __proto__: WebInspector.TimelineModel.Filter.prototype
1435 } 1419 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698