| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * @interface | 5 * @interface |
| 6 */ | 6 */ |
| 7 WebInspector.OutputStream = function() {}; | 7 Common.OutputStream = function() {}; |
| 8 | 8 |
| 9 WebInspector.OutputStream.prototype = { | 9 Common.OutputStream.prototype = { |
| 10 /** | 10 /** |
| 11 * @param {string} data | 11 * @param {string} data |
| 12 * @param {function(!WebInspector.OutputStream)=} callback | 12 * @param {function(!Common.OutputStream)=} callback |
| 13 */ | 13 */ |
| 14 write: function(data, callback) {}, | 14 write: function(data, callback) {}, |
| 15 | 15 |
| 16 close: function() {} | 16 close: function() {} |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * @implements {WebInspector.OutputStream} | 20 * @implements {Common.OutputStream} |
| 21 * @unrestricted | 21 * @unrestricted |
| 22 */ | 22 */ |
| 23 WebInspector.StringOutputStream = class { | 23 Common.StringOutputStream = class { |
| 24 constructor() { | 24 constructor() { |
| 25 this._data = ''; | 25 this._data = ''; |
| 26 } | 26 } |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * @override | 29 * @override |
| 30 * @param {string} chunk | 30 * @param {string} chunk |
| 31 * @param {function(!WebInspector.OutputStream)=} callback | 31 * @param {function(!Common.OutputStream)=} callback |
| 32 */ | 32 */ |
| 33 write(chunk, callback) { | 33 write(chunk, callback) { |
| 34 this._data += chunk; | 34 this._data += chunk; |
| 35 } | 35 } |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * @override | 38 * @override |
| 39 */ | 39 */ |
| 40 close() { | 40 close() { |
| 41 } | 41 } |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * @return {string} | 44 * @return {string} |
| 45 */ | 45 */ |
| 46 data() { | 46 data() { |
| 47 return this._data; | 47 return this._data; |
| 48 } | 48 } |
| 49 }; | 49 }; |
| OLD | NEW |