Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/HAREntry.js

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 23 matching lines...) Expand all
34 // FIXME: Some fields are not yet supported due to back-end limitations. 34 // FIXME: Some fields are not yet supported due to back-end limitations.
35 // See https://bugs.webkit.org/show_bug.cgi?id=58127 for details. 35 // See https://bugs.webkit.org/show_bug.cgi?id=58127 for details.
36 36
37 /** 37 /**
38 * @constructor 38 * @constructor
39 * @param {!WebInspector.NetworkRequest} request 39 * @param {!WebInspector.NetworkRequest} request
40 */ 40 */
41 WebInspector.HAREntry = function(request) 41 WebInspector.HAREntry = function(request)
42 { 42 {
43 this._request = request; 43 this._request = request;
44 } 44 };
45 45
46 WebInspector.HAREntry.prototype = { 46 WebInspector.HAREntry.prototype = {
47 /** 47 /**
48 * @return {!Object} 48 * @return {!Object}
49 */ 49 */
50 build: function() 50 build: function()
51 { 51 {
52 var ipAddress = this._request.remoteAddress(); 52 var ipAddress = this._request.remoteAddress();
53 var portPositionInString = ipAddress.lastIndexOf(":"); 53 var portPositionInString = ipAddress.lastIndexOf(":");
54 if (portPositionInString !== -1) 54 if (portPositionInString !== -1)
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 * @return {number|undefined} 258 * @return {number|undefined}
259 */ 259 */
260 get responseCompression() 260 get responseCompression()
261 { 261 {
262 if (this._request.cached() || this._request.statusCode === 304 || this._ request.statusCode === 206) 262 if (this._request.cached() || this._request.statusCode === 304 || this._ request.statusCode === 206)
263 return; 263 return;
264 if (!this._request.responseHeadersText) 264 if (!this._request.responseHeadersText)
265 return; 265 return;
266 return this._request.resourceSize - this.responseBodySize; 266 return this._request.resourceSize - this.responseBodySize;
267 } 267 }
268 } 268 };
269 269
270 /** 270 /**
271 * @param {number} time 271 * @param {number} time
272 * @return {number} 272 * @return {number}
273 */ 273 */
274 WebInspector.HAREntry._toMilliseconds = function(time) 274 WebInspector.HAREntry._toMilliseconds = function(time)
275 { 275 {
276 return time === -1 ? -1 : time * 1000; 276 return time === -1 ? -1 : time * 1000;
277 } 277 };
278 278
279 /** 279 /**
280 * @constructor 280 * @constructor
281 * @param {!Array.<!WebInspector.NetworkRequest>} requests 281 * @param {!Array.<!WebInspector.NetworkRequest>} requests
282 */ 282 */
283 WebInspector.HARLog = function(requests) 283 WebInspector.HARLog = function(requests)
284 { 284 {
285 this._requests = requests; 285 this._requests = requests;
286 } 286 };
287 287
288 /** 288 /**
289 * @param {!WebInspector.NetworkRequest} request 289 * @param {!WebInspector.NetworkRequest} request
290 * @param {number} monotonicTime 290 * @param {number} monotonicTime
291 * @return {!Date} 291 * @return {!Date}
292 */ 292 */
293 WebInspector.HARLog.pseudoWallTime = function(request, monotonicTime) 293 WebInspector.HARLog.pseudoWallTime = function(request, monotonicTime)
294 { 294 {
295 return new Date(request.pseudoWallTime(monotonicTime) * 1000); 295 return new Date(request.pseudoWallTime(monotonicTime) * 1000);
296 } 296 };
297 297
298 WebInspector.HARLog.prototype = { 298 WebInspector.HARLog.prototype = {
299 /** 299 /**
300 * @return {!Object} 300 * @return {!Object}
301 */ 301 */
302 build: function() 302 build: function()
303 { 303 {
304 return { 304 return {
305 version: "1.2", 305 version: "1.2",
306 creator: this._creator(), 306 creator: this._creator(),
307 pages: this._buildPages(), 307 pages: this._buildPages(),
308 entries: this._requests.map(this._convertResource.bind(this)) 308 entries: this._requests.map(this._convertResource.bind(this))
309 } 309 };
310 }, 310 },
311 311
312 _creator: function() 312 _creator: function()
313 { 313 {
314 var webKitVersion = /AppleWebKit\/([^ ]+)/.exec(window.navigator.userAge nt); 314 var webKitVersion = /AppleWebKit\/([^ ]+)/.exec(window.navigator.userAge nt);
315 315
316 return { 316 return {
317 name: "WebInspector", 317 name: "WebInspector",
318 version: webKitVersion ? webKitVersion[1] : "n/a" 318 version: webKitVersion ? webKitVersion[1] : "n/a"
319 }; 319 };
(...skipping 25 matching lines...) Expand all
345 _convertPage: function(page, request) 345 _convertPage: function(page, request)
346 { 346 {
347 return { 347 return {
348 startedDateTime: WebInspector.HARLog.pseudoWallTime(request, page.st artTime), 348 startedDateTime: WebInspector.HARLog.pseudoWallTime(request, page.st artTime),
349 id: "page_" + page.id, 349 id: "page_" + page.id,
350 title: page.url, // We don't have actual page title here. URL is pro bably better than nothing. 350 title: page.url, // We don't have actual page title here. URL is pro bably better than nothing.
351 pageTimings: { 351 pageTimings: {
352 onContentLoad: this._pageEventTime(page, page.contentLoadTime), 352 onContentLoad: this._pageEventTime(page, page.contentLoadTime),
353 onLoad: this._pageEventTime(page, page.loadTime) 353 onLoad: this._pageEventTime(page, page.loadTime)
354 } 354 }
355 } 355 };
356 }, 356 },
357 357
358 /** 358 /**
359 * @param {!WebInspector.NetworkRequest} request 359 * @param {!WebInspector.NetworkRequest} request
360 * @return {!Object} 360 * @return {!Object}
361 */ 361 */
362 _convertResource: function(request) 362 _convertResource: function(request)
363 { 363 {
364 return (new WebInspector.HAREntry(request)).build(); 364 return (new WebInspector.HAREntry(request)).build();
365 }, 365 },
366 366
367 /** 367 /**
368 * @param {!WebInspector.PageLoad} page 368 * @param {!WebInspector.PageLoad} page
369 * @param {number} time 369 * @param {number} time
370 * @return {number} 370 * @return {number}
371 */ 371 */
372 _pageEventTime: function(page, time) 372 _pageEventTime: function(page, time)
373 { 373 {
374 var startTime = page.startTime; 374 var startTime = page.startTime;
375 if (time === -1 || startTime === -1) 375 if (time === -1 || startTime === -1)
376 return -1; 376 return -1;
377 return WebInspector.HAREntry._toMilliseconds(time - startTime); 377 return WebInspector.HAREntry._toMilliseconds(time - startTime);
378 } 378 }
379 } 379 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698