OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** | 5 /** |
6 * @fileoverview Playback agent. | 6 * @fileoverview Playback agent. |
7 */ | 7 */ |
8 | 8 |
9 var Benchmark = Benchmark || {}; | 9 var Benchmark = Benchmark || {}; |
10 | 10 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 if (event[properties[i]] != recordedEvent[properties[i]]) | 82 if (event[properties[i]] != recordedEvent[properties[i]]) |
83 equal = false; | 83 equal = false; |
84 } | 84 } |
85 if (!equal) { | 85 if (!equal) { |
86 Benchmark.die('unexpected event: ' + JSON.stringify(event) + | 86 Benchmark.die('unexpected event: ' + JSON.stringify(event) + |
87 ' instead of ' + JSON.stringify(recordedEvent)); | 87 ' instead of ' + JSON.stringify(recordedEvent)); |
88 } | 88 } |
89 }; | 89 }; |
90 | 90 |
91 /** | 91 /** |
92 * Gets next event from timeline and returns it's identifier. | 92 * Gets next event from timeline and returns its identifier. |
93 * @param {Object} event Object with event information. | 93 * @param {Object} event Object with event information. |
94 * @return {number} Event identifier. | 94 * @return {number} Event identifier. |
95 */ | 95 */ |
96 Benchmark.Agent.prototype.createAsyncEvent = function(event) { | 96 Benchmark.Agent.prototype.createAsyncEvent = function(event) { |
97 return this.getNextEvent(event).id; | 97 return this.getNextEvent(event).id; |
98 }; | 98 }; |
99 | 99 |
100 /** | 100 /** |
101 * Stores callback to be invoked according to timeline order. | 101 * Stores callback to be invoked according to timeline order. |
102 * @param {number} eventId 'Parent' event identifier. | 102 * @param {number} eventId 'Parent' event identifier. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 Benchmark.reportScore = function(score) { | 249 Benchmark.reportScore = function(score) { |
250 Benchmark.score = score; | 250 Benchmark.score = score; |
251 }; | 251 }; |
252 | 252 |
253 Benchmark.originals.addEventListenerToWindow.call( | 253 Benchmark.originals.addEventListenerToWindow.call( |
254 window, 'message', function(event) { | 254 window, 'message', function(event) { |
255 if (Benchmark.score) { | 255 if (Benchmark.score) { |
256 event.source.postMessage(Benchmark.score, event.origin); | 256 event.source.postMessage(Benchmark.score, event.origin); |
257 } | 257 } |
258 }, false); | 258 }, false); |
OLD | NEW |