| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <include src="../../../../third_party/polymer/components/polymer/polymer.js"> | 5 <include src="../../../../third_party/polymer/components/polymer/polymer.js"> |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Formats size to a human readable form. | 8 * Formats size to a human readable form. |
| 9 * @param {number} size Size in bytes. | 9 * @param {number} size Size in bytes. |
| 10 * @return {string} Output string in a human-readable format. | 10 * @return {string} Output string in a human-readable format. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 var requestTimelineNode = document.querySelector('#request-timeline'); | 39 var requestTimelineNode = document.querySelector('#request-timeline'); |
| 40 requestTimelineNode.hidden = false; | 40 requestTimelineNode.hidden = false; |
| 41 requestTimelineNode.model = []; | 41 requestTimelineNode.model = []; |
| 42 | 42 |
| 43 chrome.send('selectFileSystem', [sender.dataset.extensionId, | 43 chrome.send('selectFileSystem', [sender.dataset.extensionId, |
| 44 sender.dataset.id]); | 44 sender.dataset.id]); |
| 45 }, | 45 }, |
| 46 | 46 |
| 47 /** | 47 /** |
| 48 * List of provided file system information maps. | 48 * List of provided file system information maps. |
| 49 * @type {Array.<Object>} | 49 * @type {Array<Object>} |
| 50 */ | 50 */ |
| 51 model: [] | 51 model: [] |
| 52 }); | 52 }); |
| 53 | 53 |
| 54 // Defines the request-log element. | 54 // Defines the request-log element. |
| 55 Polymer('request-events', { | 55 Polymer('request-events', { |
| 56 /** | 56 /** |
| 57 * Called when the element is created. | 57 * Called when the element is created. |
| 58 */ | 58 */ |
| 59 ready: function() { | 59 ready: function() { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 */ | 99 */ |
| 100 formatExecutionTime: function(opt_executionTime) { | 100 formatExecutionTime: function(opt_executionTime) { |
| 101 if (opt_executionTime == undefined) | 101 if (opt_executionTime == undefined) |
| 102 return ''; | 102 return ''; |
| 103 | 103 |
| 104 return opt_executionTime + ' ms'; | 104 return opt_executionTime + ' ms'; |
| 105 }, | 105 }, |
| 106 | 106 |
| 107 /** | 107 /** |
| 108 * List of events. | 108 * List of events. |
| 109 * @type {Array.<Object>} | 109 * @type {Array<Object>} |
| 110 */ | 110 */ |
| 111 model: [] | 111 model: [] |
| 112 }); | 112 }); |
| 113 | 113 |
| 114 // Defines the request-timeline element. | 114 // Defines the request-timeline element. |
| 115 Polymer('request-timeline', { | 115 Polymer('request-timeline', { |
| 116 /** | 116 /** |
| 117 * Step for zoomin in and out. | 117 * Step for zoomin in and out. |
| 118 * @type {number} | 118 * @type {number} |
| 119 * @const | 119 * @const |
| 120 */ | 120 */ |
| 121 SCALE_STEP: 1.5, | 121 SCALE_STEP: 1.5, |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * Height of each row in the chart in pixels. | 124 * Height of each row in the chart in pixels. |
| 125 * @type {number} | 125 * @type {number} |
| 126 * @const | 126 * @const |
| 127 */ | 127 */ |
| 128 ROW_HEIGHT: 14, | 128 ROW_HEIGHT: 14, |
| 129 | 129 |
| 130 /** | 130 /** |
| 131 * Observes changes in the model. | 131 * Observes changes in the model. |
| 132 * @type {Object.<string, string>} | 132 * @type {Object<string, string>} |
| 133 */ | 133 */ |
| 134 observe: { | 134 observe: { |
| 135 'model.length': 'chartUpdate' | 135 'model.length': 'chartUpdate' |
| 136 }, | 136 }, |
| 137 | 137 |
| 138 /** | 138 /** |
| 139 * Called when the element is created. | 139 * Called when the element is created. |
| 140 */ | 140 */ |
| 141 ready: function() { | 141 ready: function() { |
| 142 // Update active requests in the background for nice animation. | 142 // Update active requests in the background for nice animation. |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 // If this was the last active request, then idling starts. | 310 // If this was the last active request, then idling starts. |
| 311 if (Object.keys(this.active).length == 0) | 311 if (Object.keys(this.active).length == 0) |
| 312 this.idleStart = event.time; | 312 this.idleStart = event.time; |
| 313 break; | 313 break; |
| 314 } | 314 } |
| 315 } | 315 } |
| 316 }, | 316 }, |
| 317 | 317 |
| 318 /** | 318 /** |
| 319 * Map of selected requests. | 319 * Map of selected requests. |
| 320 * @type {Object.<number, boolean>} | 320 * @type {Object<number, boolean>} |
| 321 */ | 321 */ |
| 322 selected: {}, | 322 selected: {}, |
| 323 | 323 |
| 324 /** | 324 /** |
| 325 * Map of requests which has started, but are not completed yet, from | 325 * Map of requests which has started, but are not completed yet, from |
| 326 * a request id to the chart element index. | 326 * a request id to the chart element index. |
| 327 * @type {Object.<number, number>}} | 327 * @type {Object<number, number>}} |
| 328 */ | 328 */ |
| 329 active: {}, | 329 active: {}, |
| 330 | 330 |
| 331 /** | 331 /** |
| 332 * List of chart elements, calculated from the model. | 332 * List of chart elements, calculated from the model. |
| 333 * @type {Array.<Object>} | 333 * @type {Array<Object>} |
| 334 */ | 334 */ |
| 335 chart: [], | 335 chart: [], |
| 336 | 336 |
| 337 /** | 337 /** |
| 338 * List of rows in the chart, with the last endTime value on it. | 338 * List of rows in the chart, with the last endTime value on it. |
| 339 * @type {Array.<Object>} | 339 * @type {Array<Object>} |
| 340 */ | 340 */ |
| 341 rows: [], | 341 rows: [], |
| 342 | 342 |
| 343 /** | 343 /** |
| 344 * Scale of the chart. | 344 * Scale of the chart. |
| 345 * @type {number} | 345 * @type {number} |
| 346 */ | 346 */ |
| 347 scale: 1, | 347 scale: 1, |
| 348 | 348 |
| 349 /** | 349 /** |
| (...skipping 10 matching lines...) Expand all Loading... |
| 360 | 360 |
| 361 /** | 361 /** |
| 362 * Total idling time since chart generation started. Used to avoid | 362 * Total idling time since chart generation started. Used to avoid |
| 363 * generating gaps in the chart when there is no activity. In milliseconds. | 363 * generating gaps in the chart when there is no activity. In milliseconds. |
| 364 * @type {number} | 364 * @type {number} |
| 365 */ | 365 */ |
| 366 idleTotal: 0, | 366 idleTotal: 0, |
| 367 | 367 |
| 368 /** | 368 /** |
| 369 * List of requests information maps. | 369 * List of requests information maps. |
| 370 * @type {Array.<Object>} | 370 * @type {Array<Object>} |
| 371 */ | 371 */ |
| 372 model: [] | 372 model: [] |
| 373 }); | 373 }); |
| 374 | 374 |
| 375 /* | 375 /* |
| 376 * Updates the mounted file system list. | 376 * Updates the mounted file system list. |
| 377 * @param {Array.<Object>} fileSystems Array containing provided file system | 377 * @param {Array<Object>} fileSystems Array containing provided file system |
| 378 * information. | 378 * information. |
| 379 */ | 379 */ |
| 380 function updateFileSystems(fileSystems) { | 380 function updateFileSystems(fileSystems) { |
| 381 var fileSystemsNode = document.querySelector('#file-systems'); | 381 var fileSystemsNode = document.querySelector('#file-systems'); |
| 382 fileSystemsNode.model = fileSystems; | 382 fileSystemsNode.model = fileSystems; |
| 383 } | 383 } |
| 384 | 384 |
| 385 /** | 385 /** |
| 386 * Called when a request is created. | 386 * Called when a request is created. |
| 387 * @param {Object} event Event. | 387 * @param {Object} event Event. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 400 context.lineTo(4, 4); | 400 context.lineTo(4, 4); |
| 401 context.stroke(); | 401 context.stroke(); |
| 402 | 402 |
| 403 chrome.send('updateFileSystems'); | 403 chrome.send('updateFileSystems'); |
| 404 | 404 |
| 405 // Refresh periodically. | 405 // Refresh periodically. |
| 406 setInterval(function() { | 406 setInterval(function() { |
| 407 chrome.send('updateFileSystems'); | 407 chrome.send('updateFileSystems'); |
| 408 }, 1000); | 408 }, 1000); |
| 409 }); | 409 }); |
| OLD | NEW |