OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/ui/extras/about_tracing/inspector_connection.h
tml"> | 8 <link rel="import" href="/tracing/ui/extras/about_tracing/inspector_connection.h
tml"> |
9 <link rel="import" | 9 <link rel="import" |
10 href="/tracing/ui/extras/about_tracing/tracing_controller_client.html"> | 10 href="/tracing/ui/extras/about_tracing/tracing_controller_client.html"> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 }, function(err) { | 84 }, function(err) { |
85 return []; | 85 return []; |
86 }); | 86 }); |
87 }, | 87 }, |
88 | 88 |
89 beginRecording(recordingOptions) { | 89 beginRecording(recordingOptions) { |
90 if (this.recording_) { | 90 if (this.recording_) { |
91 throw new Error('Already recording'); | 91 throw new Error('Already recording'); |
92 } | 92 } |
93 this.recording_ = 'starting'; | 93 this.recording_ = 'starting'; |
| 94 const memoryConfig = { triggers: [] }; |
| 95 if (recordingOptions.included_categories.indexOf( |
| 96 'disabled-by-default-memory-infra') !== -1) { |
| 97 memoryConfig.triggers.push( |
| 98 {'mode': 'detailed', 'periodic_interval_ms': 10000}); |
| 99 } |
| 100 |
| 101 // The devtools and tracing endpoints have slightly different parameter |
| 102 // configurations. Noteably, recordMode has different spelling |
| 103 // requirements. |
| 104 function RewriteRecordMode(recordMode) { |
| 105 if (recordMode === 'record-until-full') { |
| 106 return 'recordUntilFull'; |
| 107 } |
| 108 if (recordMode === 'record-continuously') { |
| 109 return 'recordContinuously'; |
| 110 } |
| 111 if (recordMode === 'record-as-much-as-possible') { |
| 112 return 'recordAsMuchAsPossible'; |
| 113 } |
| 114 return 'unsupported record mode'; |
| 115 } |
| 116 |
| 117 const traceConfigStr = { |
| 118 includedCategories: recordingOptions.included_categories, |
| 119 excludedCategories: recordingOptions.excluded_categories, |
| 120 memoryDumpConfig: memoryConfig, |
| 121 recordMode: RewriteRecordMode(recordingOptions.record_mode), |
| 122 enableSystrace: recordingOptions.enable_systrace |
| 123 }; |
94 let res = this.conn_.req( | 124 let res = this.conn_.req( |
95 'Tracing.start', | 125 'Tracing.start', |
96 { | 126 { |
97 categories: recordingOptions.categoryFilter, | 127 traceConfig: traceConfigStr, |
98 options: | |
99 [recordingOptions.tracingRecordMode, | |
100 (recordingOptions.useSampling ? 'enable-sampling' : '') | |
101 ].join(','), | |
102 bufferUsageReportingInterval: 1000 | 128 bufferUsageReportingInterval: 1000 |
103 }); | 129 }); |
104 res = res.then( | 130 res = res.then( |
105 function ok() { | 131 function ok() { |
106 this.conn_.setNotificationListener( | 132 this.conn_.setNotificationListener( |
107 'Tracing.bufferUsage', | 133 'Tracing.bufferUsage', |
108 this.onBufferUsageUpdateFromInspector_.bind(this)); | 134 this.onBufferUsageUpdateFromInspector_.bind(this)); |
109 this.recording_ = true; | 135 this.recording_ = true; |
110 }.bind(this), | 136 }.bind(this), |
111 function error() { | 137 function error() { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return 'trace.json'; | 206 return 'trace.json'; |
181 } | 207 } |
182 }; | 208 }; |
183 | 209 |
184 return { | 210 return { |
185 InspectorTracingControllerClient, | 211 InspectorTracingControllerClient, |
186 appendTraceChunksTo, | 212 appendTraceChunksTo, |
187 }; | 213 }; |
188 }); | 214 }); |
189 </script> | 215 </script> |
OLD | NEW |