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

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

Issue 2948173005: har import
Patch Set: Created 3 years, 6 months 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 */ 302 */
303 _buildPages() { 303 _buildPages() {
304 var seenIdentifiers = {}; 304 var seenIdentifiers = {};
305 var pages = []; 305 var pages = [];
306 for (var i = 0; i < this._requests.length; ++i) { 306 for (var i = 0; i < this._requests.length; ++i) {
307 var request = this._requests[i]; 307 var request = this._requests[i];
308 var page = NetworkLog.networkLog.pageLoadForRequest(request); 308 var page = NetworkLog.networkLog.pageLoadForRequest(request);
309 if (!page || seenIdentifiers[page.id]) 309 if (!page || seenIdentifiers[page.id])
310 continue; 310 continue;
311 seenIdentifiers[page.id] = true; 311 seenIdentifiers[page.id] = true;
312 pages.push(this._convertPage(page, request)); 312 pages.push(this._convertPage(page));
313 } 313 }
314 return pages; 314 return pages;
315 } 315 }
316 316
317 /** 317 /**
318 * @param {!NetworkLog.PageLoad} page 318 * @param {!NetworkLog.PageLoad} page
319 * @param {!SDK.NetworkRequest} request 319 * @param {!SDK.NetworkRequest} request
320 * @return {!Object} 320 * @return {!Object}
321 */ 321 */
322 _convertPage(page, request) { 322 _convertPage(page) {
323 return { 323 return {
324 startedDateTime: NetworkLog.HARLog.pseudoWallTime(request, page.startTime) , 324 startedDateTime: page.startTime,
325 id: 'page_' + page.id, 325 id: 'page_' + page.id,
326 title: page.url, // We don't have actual page title here. URL is probably better than nothing. 326 title: page.url, // We don't have actual page title here. URL is probably better than nothing.
327 pageTimings: { 327 pageTimings: {
328 onContentLoad: this._pageEventTime(page, page.contentLoadTime), 328 onContentLoad: this._pageEventTime(page, page.contentLoadTime),
329 onLoad: this._pageEventTime(page, page.loadTime) 329 onLoad: this._pageEventTime(page, page.loadTime)
330 } 330 }
331 }; 331 };
332 } 332 }
333 333
334 /** 334 /**
335 * @param {!SDK.NetworkRequest} request 335 * @param {!SDK.NetworkRequest} request
336 * @return {!Object} 336 * @return {!Object}
337 */ 337 */
338 _convertResource(request) { 338 _convertResource(request) {
339 return (new NetworkLog.HAREntry(request)).build(); 339 return (new NetworkLog.HAREntry(request)).build();
340 } 340 }
341 341
342 /** 342 /**
343 * @param {!NetworkLog.PageLoad} page 343 * @param {!NetworkLog.PageLoad} page
344 * @param {number} time 344 * @param {number} time
345 * @return {number} 345 * @return {number}
346 */ 346 */
347 _pageEventTime(page, time) { 347 _pageEventTime(page, time) {
348 var startTime = page.startTime; 348 var startTime = page.startTime;
349 if (time === -1 || startTime === -1) 349 if (time === -1 || startTime === -1)
350 return -1; 350 return -1;
351 return NetworkLog.HAREntry._toMilliseconds(time - startTime); 351 return NetworkLog.HAREntry._toMilliseconds((time / 1000) + startTime);
352 } 352 }
353 }; 353 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698