| 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 * @param {!WebInspector.BackingStorage} backingStorage | 9 * @param {!WebInspector.BackingStorage} backingStorage |
| 10 */ | 10 */ |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 console.error("Missing mandatory 'snapshot' argument at " + payload.ts /
1000); | 681 console.error("Missing mandatory 'snapshot' argument at " + payload.ts /
1000); |
| 682 return snapshot; | 682 return snapshot; |
| 683 } | 683 } |
| 684 if (payload.args) | 684 if (payload.args) |
| 685 snapshot.addArgs(payload.args); | 685 snapshot.addArgs(payload.args); |
| 686 return snapshot; | 686 return snapshot; |
| 687 } | 687 } |
| 688 | 688 |
| 689 WebInspector.TracingModel.ObjectSnapshot.prototype = { | 689 WebInspector.TracingModel.ObjectSnapshot.prototype = { |
| 690 /** | 690 /** |
| 691 * @param {function(?Object)} callback | 691 * @param {function(?)} callback |
| 692 */ | 692 */ |
| 693 requestObject: function(callback) | 693 requestObject: function(callback) |
| 694 { | 694 { |
| 695 var snapshot = this.args["snapshot"]; | 695 var snapshot = this.args["snapshot"]; |
| 696 if (snapshot) { | 696 if (snapshot) { |
| 697 callback(snapshot); | 697 callback(snapshot); |
| 698 return; | 698 return; |
| 699 } | 699 } |
| 700 this._backingStorage().then(onRead, callback.bind(null, null)); | 700 this._backingStorage().then(onRead, callback.bind(null, null)); |
| 701 /** | 701 /** |
| 702 * @param {?string} result | 702 * @param {?string} result |
| 703 */ | 703 */ |
| 704 function onRead(result) | 704 function onRead(result) |
| 705 { | 705 { |
| 706 if (!result) { | 706 if (!result) { |
| 707 callback(null); | 707 callback(null); |
| 708 return; | 708 return; |
| 709 } | 709 } |
| 710 try { | 710 try { |
| 711 var payload = JSON.parse(result); | 711 var payload = JSON.parse(result); |
| 712 callback(payload["args"]["snapshot"]); | 712 callback(payload["args"]["snapshot"]); |
| 713 } catch (e) { | 713 } catch (e) { |
| 714 WebInspector.console.error("Malformed event data in backing stor
age"); | 714 WebInspector.console.error("Malformed event data in backing stor
age"); |
| 715 callback(null); | 715 callback(null); |
| 716 } | 716 } |
| 717 } | 717 } |
| 718 }, | 718 }, |
| 719 | 719 |
| 720 /** | 720 /** |
| 721 * @return {!Promise<?>} |
| 722 */ |
| 723 objectPromise: function() |
| 724 { |
| 725 if (!this._objectPromise) |
| 726 this._objectPromise = new Promise(this.requestObject.bind(this)); |
| 727 return this._objectPromise; |
| 728 }, |
| 729 |
| 730 /** |
| 721 * @override | 731 * @override |
| 722 * @param {?function():!Promise.<?string>} backingStorage | 732 * @param {?function():!Promise.<?>} backingStorage |
| 723 */ | 733 */ |
| 724 _setBackingStorage: function(backingStorage) | 734 _setBackingStorage: function(backingStorage) |
| 725 { | 735 { |
| 726 if (!backingStorage) | 736 if (!backingStorage) |
| 727 return; | 737 return; |
| 728 this._backingStorage = backingStorage; | 738 this._backingStorage = backingStorage; |
| 729 this.args = {}; | 739 this.args = {}; |
| 730 }, | 740 }, |
| 731 | 741 |
| 732 __proto__: WebInspector.TracingModel.Event.prototype | 742 __proto__: WebInspector.TracingModel.Event.prototype |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 /** | 1020 /** |
| 1011 * @return {!Array.<!WebInspector.TracingModel.AsyncEvent>} | 1021 * @return {!Array.<!WebInspector.TracingModel.AsyncEvent>} |
| 1012 */ | 1022 */ |
| 1013 asyncEvents: function() | 1023 asyncEvents: function() |
| 1014 { | 1024 { |
| 1015 return this._asyncEvents; | 1025 return this._asyncEvents; |
| 1016 }, | 1026 }, |
| 1017 | 1027 |
| 1018 __proto__: WebInspector.TracingModel.NamedObject.prototype | 1028 __proto__: WebInspector.TracingModel.NamedObject.prototype |
| 1019 } | 1029 } |
| OLD | NEW |