| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @constructor | 8 * @constructor |
| 9 * @extends {WebInspector.Object} | 9 * @extends {WebInspector.Object} |
| 10 */ | 10 */ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 * @param {string} text | 35 * @param {string} text |
| 36 * @param {function(!Array.<!WebInspector.CSSParser.Rule>)=} callback | 36 * @param {function(!Array.<!WebInspector.CSSParser.Rule>)=} callback |
| 37 */ | 37 */ |
| 38 parse: function(text, callback) | 38 parse: function(text, callback) |
| 39 { | 39 { |
| 40 this._lock(); | 40 this._lock(); |
| 41 this._finishedCallback = callback; | 41 this._finishedCallback = callback; |
| 42 this._innerParse(text); | 42 this._innerParse(text); |
| 43 }, | 43 }, |
| 44 | 44 |
| 45 /** |
| 46 * @param {string} text |
| 47 * @return {!Promise<!Array.<!WebInspector.CSSParser.Rule>>} |
| 48 */ |
| 49 parsePromise: function(text) |
| 50 { |
| 51 return new Promise(promiseConstructor.bind(this)); |
| 52 |
| 53 /** |
| 54 * @param {function()} succ |
| 55 * @param {function()} fail |
| 56 * @this {WebInspector.CSSParser} |
| 57 */ |
| 58 function promiseConstructor(succ, fail) |
| 59 { |
| 60 this.parse(text, succ); |
| 61 } |
| 62 }, |
| 63 |
| 45 dispose: function() | 64 dispose: function() |
| 46 { | 65 { |
| 47 if (this._worker) { | 66 if (this._worker) { |
| 48 this._worker.terminate(); | 67 this._worker.terminate(); |
| 49 delete this._worker; | 68 delete this._worker; |
| 50 } | 69 } |
| 51 }, | 70 }, |
| 52 | 71 |
| 53 /** | 72 /** |
| 54 * @return {!Array.<!WebInspector.CSSParser.Rule>} | 73 * @return {!Array.<!WebInspector.CSSParser.Rule>} |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 this.nameRange; | 158 this.nameRange; |
| 140 /** @type {string} */ | 159 /** @type {string} */ |
| 141 this.value; | 160 this.value; |
| 142 /** @type {!WebInspector.CSSParser.Range} */ | 161 /** @type {!WebInspector.CSSParser.Range} */ |
| 143 this.valueRange; | 162 this.valueRange; |
| 144 /** @type {!WebInspector.CSSParser.Range} */ | 163 /** @type {!WebInspector.CSSParser.Range} */ |
| 145 this.range; | 164 this.range; |
| 146 /** @type {(boolean|undefined)} */ | 165 /** @type {(boolean|undefined)} */ |
| 147 this.disabled; | 166 this.disabled; |
| 148 } | 167 } |
| OLD | NEW |