OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 29 matching lines...) Expand all Loading... |
40 */ | 40 */ |
41 WebInspector.PaintProfilerSnapshot = function(target, snapshotId) | 41 WebInspector.PaintProfilerSnapshot = function(target, snapshotId) |
42 { | 42 { |
43 this._target = target; | 43 this._target = target; |
44 this._id = snapshotId; | 44 this._id = snapshotId; |
45 } | 45 } |
46 | 46 |
47 /** | 47 /** |
48 * @param {!WebInspector.Target} target | 48 * @param {!WebInspector.Target} target |
49 * @param {!Array.<!WebInspector.PictureFragment>} fragments | 49 * @param {!Array.<!WebInspector.PictureFragment>} fragments |
50 * @param {function(?WebInspector.PaintProfilerSnapshot)} callback | 50 * @return {!Promise<?WebInspector.PaintProfilerSnapshot>} |
51 */ | 51 */ |
52 WebInspector.PaintProfilerSnapshot.loadFromFragments = function(target, fragment
s, callback) | 52 WebInspector.PaintProfilerSnapshot.loadFromFragments = function(target, fragment
s) |
53 { | 53 { |
54 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "LayerTr
eeAgent.loadSnapshot(): ", WebInspector.PaintProfilerSnapshot.bind(null, target)
); | 54 return target.layerTreeAgent().loadSnapshot(fragments, (error, snapshotId) =
> error ? null : new WebInspector.PaintProfilerSnapshot(target, snapshotId)); |
55 target.layerTreeAgent().loadSnapshot(fragments, wrappedCallback); | |
56 } | 55 } |
57 | 56 |
58 /** | 57 /** |
59 * @param {!WebInspector.Target} target | 58 * @param {!WebInspector.Target} target |
60 * @param {string} encodedPicture | 59 * @param {string} encodedPicture |
61 * @param {function(?WebInspector.PaintProfilerSnapshot)} callback | 60 * @return {!Promise<?WebInspector.PaintProfilerSnapshot>} |
62 */ | 61 */ |
63 WebInspector.PaintProfilerSnapshot.load = function(target, encodedPicture, callb
ack) | 62 WebInspector.PaintProfilerSnapshot.load = function(target, encodedPicture) |
64 { | 63 { |
65 var fragment = { | 64 var fragment = { |
66 x: 0, | 65 x: 0, |
67 y: 0, | 66 y: 0, |
68 picture: encodedPicture | 67 picture: encodedPicture |
69 }; | 68 }; |
70 WebInspector.PaintProfilerSnapshot.loadFromFragments(target, [fragment], cal
lback); | 69 return WebInspector.PaintProfilerSnapshot.loadFromFragments(target, [fragmen
t]); |
71 } | 70 } |
72 | 71 |
73 WebInspector.PaintProfilerSnapshot.prototype = { | 72 WebInspector.PaintProfilerSnapshot.prototype = { |
74 dispose: function() | 73 dispose: function() |
75 { | 74 { |
76 this._target.layerTreeAgent().releaseSnapshot(this._id); | 75 this._target.layerTreeAgent().releaseSnapshot(this._id); |
77 }, | 76 }, |
78 | 77 |
79 /** | 78 /** |
80 * @return {!WebInspector.Target} | 79 * @return {!WebInspector.Target} |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 * @constructor | 138 * @constructor |
140 * @param {!WebInspector.RawPaintProfilerLogItem} rawEntry | 139 * @param {!WebInspector.RawPaintProfilerLogItem} rawEntry |
141 * @param {number} commandIndex | 140 * @param {number} commandIndex |
142 */ | 141 */ |
143 WebInspector.PaintProfilerLogItem = function(rawEntry, commandIndex) | 142 WebInspector.PaintProfilerLogItem = function(rawEntry, commandIndex) |
144 { | 143 { |
145 this.method = rawEntry.method; | 144 this.method = rawEntry.method; |
146 this.params = rawEntry.params; | 145 this.params = rawEntry.params; |
147 this.commandIndex = commandIndex; | 146 this.commandIndex = commandIndex; |
148 } | 147 } |
OLD | NEW |