OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @param {!WebInspector.TracingModel} tracingModel | 6 * @param {!WebInspector.TracingModel} tracingModel |
7 * @constructor | 7 * @constructor |
8 * @extends {WebInspector.TimelineModel} | 8 * @extends {WebInspector.TimelineModel} |
9 */ | 9 */ |
10 WebInspector.TracingTimelineModel = function(tracingModel) | 10 WebInspector.TracingTimelineModel = function(tracingModel) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 | 94 |
95 WebInspector.TracingTimelineModel.defaultTracingCategoryFilter = "*,disabled-by- default-cc.debug,disabled-by-default-devtools.timeline"; | 95 WebInspector.TracingTimelineModel.defaultTracingCategoryFilter = "*,disabled-by- default-cc.debug,disabled-by-default-devtools.timeline"; |
96 | 96 |
97 WebInspector.TracingTimelineModel.prototype = { | 97 WebInspector.TracingTimelineModel.prototype = { |
98 /** | 98 /** |
99 * @param {boolean} captureStacks | 99 * @param {boolean} captureStacks |
100 * @param {boolean} captureMemory | 100 * @param {boolean} captureMemory |
101 */ | 101 */ |
102 startRecording: function(captureStacks, captureMemory) | 102 startRecording: function(captureStacks, captureMemory) |
103 { | 103 { |
104 this.reset(); | |
yurys
2014/06/10 07:04:27
This should go into _startRecordingWithCategories
| |
104 var categories; | 105 var categories; |
105 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) { | 106 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) { |
106 categories = WebInspector.TracingTimelineModel.defaultTracingCategor yFilter; | 107 categories = WebInspector.TracingTimelineModel.defaultTracingCategor yFilter; |
107 } else { | 108 } else { |
108 var categoriesArray = ["disabled-by-default-devtools.timeline", "dev tools"]; | 109 var categoriesArray = ["disabled-by-default-devtools.timeline", "dev tools"]; |
109 if (captureStacks) | 110 if (captureStacks) |
110 categoriesArray.push("disabled-by-default-devtools.timeline.stac k"); | 111 categoriesArray.push("disabled-by-default-devtools.timeline.stac k"); |
111 categories = categoriesArray.join(","); | 112 categories = categoriesArray.join(","); |
112 } | 113 } |
113 this._startRecordingWithCategories(categories); | 114 this._startRecordingWithCategories(categories); |
114 }, | 115 }, |
115 | 116 |
116 stopRecording: function() | 117 stopRecording: function() |
117 { | 118 { |
118 this._tracingModel.stop(this._didStopRecordingTraceEvents.bind(this)); | 119 this._tracingModel.stop(this._didStopRecordingTraceEvents.bind(this)); |
119 }, | 120 }, |
120 | 121 |
121 /** | 122 /** |
122 * @param {string} sessionId | 123 * @param {string} sessionId |
123 * @param {!Array.<!WebInspector.TracingModel.EventPayload>} events | 124 * @param {!Array.<!WebInspector.TracingModel.EventPayload>} events |
124 */ | 125 */ |
125 setEventsForTest: function(sessionId, events) | 126 setEventsForTest: function(sessionId, events) |
126 { | 127 { |
128 this.reset(); | |
127 this._didStartRecordingTraceEvents(); | 129 this._didStartRecordingTraceEvents(); |
128 this._tracingModel.setEventsForTest(sessionId, events); | 130 this._tracingModel.setEventsForTest(sessionId, events); |
129 this._didStopRecordingTraceEvents(); | 131 this._didStopRecordingTraceEvents(); |
130 }, | 132 }, |
131 | 133 |
132 /** | 134 /** |
133 * @param {string} categories | 135 * @param {string} categories |
134 */ | 136 */ |
135 _startRecordingWithCategories: function(categories) | 137 _startRecordingWithCategories: function(categories) |
136 { | 138 { |
137 this._tracingModel.start(categories, "", this._didStartRecordingTraceEve nts.bind(this)); | 139 this._tracingModel.start(categories, "", this._didStartRecordingTraceEve nts.bind(this)); |
138 }, | 140 }, |
139 | 141 |
140 _didStartRecordingTraceEvents: function() | 142 _didStartRecordingTraceEvents: function() |
141 { | 143 { |
142 this.reset(); | |
143 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStarted); | 144 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStarted); |
144 }, | 145 }, |
145 | 146 |
146 _didStopRecordingTraceEvents: function() | 147 _didStopRecordingTraceEvents: function() |
147 { | 148 { |
148 var events = this._tracingModel.devtoolsMetadataEvents(); | 149 var events = this._tracingModel.devtoolsMetadataEvents(); |
149 events.sort(WebInspector.TracingModel.Event.compareStartTime); | 150 events.sort(WebInspector.TracingModel.Event.compareStartTime); |
150 | 151 |
151 this._resetProcessingState(); | 152 this._resetProcessingState(); |
152 for (var i = 0, length = events.length; i < length; i++) { | 153 for (var i = 0, length = events.length; i < length; i++) { |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
642 { | 643 { |
643 var tokens = [this.title()]; | 644 var tokens = [this.title()]; |
644 var data = this._event.args.data; | 645 var data = this._event.args.data; |
645 if (data) { | 646 if (data) { |
646 for (var key in data) | 647 for (var key in data) |
647 tokens.push(data[key]); | 648 tokens.push(data[key]); |
648 } | 649 } |
649 return regExp.test(tokens.join("|")); | 650 return regExp.test(tokens.join("|")); |
650 } | 651 } |
651 } | 652 } |
OLD | NEW |