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 function promiseConstructor(succ, fail) |
| 54 { |
| 55 this.parse(text, succ); |
| 56 } |
| 57 }, |
| 58 |
45 dispose: function() | 59 dispose: function() |
46 { | 60 { |
47 if (this._worker) { | 61 if (this._worker) { |
48 this._worker.terminate(); | 62 this._worker.terminate(); |
49 delete this._worker; | 63 delete this._worker; |
50 } | 64 } |
51 }, | 65 }, |
52 | 66 |
53 /** | 67 /** |
54 * @return {!Array.<!WebInspector.CSSParser.Rule>} | 68 * @return {!Array.<!WebInspector.CSSParser.Rule>} |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 this.nameRange; | 153 this.nameRange; |
140 /** @type {string} */ | 154 /** @type {string} */ |
141 this.value; | 155 this.value; |
142 /** @type {!WebInspector.CSSParser.Range} */ | 156 /** @type {!WebInspector.CSSParser.Range} */ |
143 this.valueRange; | 157 this.valueRange; |
144 /** @type {!WebInspector.CSSParser.Range} */ | 158 /** @type {!WebInspector.CSSParser.Range} */ |
145 this.range; | 159 this.range; |
146 /** @type {(boolean|undefined)} */ | 160 /** @type {(boolean|undefined)} */ |
147 this.disabled; | 161 this.disabled; |
148 } | 162 } |
OLD | NEW |