| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * | 10 * |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 this.dispatchEventToListeners(WebInspector.CPUProfilerModel.EventTypes.P
rofileStarted); | 116 this.dispatchEventToListeners(WebInspector.CPUProfilerModel.EventTypes.P
rofileStarted); |
| 117 WebInspector.userMetrics.ProfilesCPUProfileTaken.record(); | 117 WebInspector.userMetrics.ProfilesCPUProfileTaken.record(); |
| 118 }, | 118 }, |
| 119 | 119 |
| 120 /** | 120 /** |
| 121 * @return {!Promise.<?ProfilerAgent.CPUProfile>} | 121 * @return {!Promise.<?ProfilerAgent.CPUProfile>} |
| 122 */ | 122 */ |
| 123 stopRecording: function() | 123 stopRecording: function() |
| 124 { | 124 { |
| 125 /** | 125 /** |
| 126 * @param {?{profile: !ProfilerAgent.CPUProfile}} value | 126 * @param {?Protocol.Error} error |
| 127 * @param {?ProfilerAgent.CPUProfile} profile |
| 127 * @return {?ProfilerAgent.CPUProfile} | 128 * @return {?ProfilerAgent.CPUProfile} |
| 128 */ | 129 */ |
| 129 function extractProfile(value) | 130 function extractProfile(error, profile) |
| 130 { | 131 { |
| 131 return value && value.profile; | 132 return !error && profile ? profile : null; |
| 132 } | 133 } |
| 133 this._isRecording = false; | 134 this._isRecording = false; |
| 134 this.dispatchEventToListeners(WebInspector.CPUProfilerModel.EventTypes.P
rofileStopped); | 135 this.dispatchEventToListeners(WebInspector.CPUProfilerModel.EventTypes.P
rofileStopped); |
| 135 return this.target().profilerAgent().stop().then(extractProfile); | 136 return this.target().profilerAgent().stop(extractProfile); |
| 136 }, | 137 }, |
| 137 | 138 |
| 138 dispose: function() | 139 dispose: function() |
| 139 { | 140 { |
| 140 WebInspector.moduleSetting("highResolutionCpuProfiling").removeChangeLis
tener(this._configureCpuProfilerSamplingInterval, this); | 141 WebInspector.moduleSetting("highResolutionCpuProfiling").removeChangeLis
tener(this._configureCpuProfilerSamplingInterval, this); |
| 141 }, | 142 }, |
| 142 | 143 |
| 143 | 144 |
| 144 __proto__: WebInspector.SDKModel.prototype | 145 __proto__: WebInspector.SDKModel.prototype |
| 145 } | 146 } |
| OLD | NEW |