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

Side by Side Diff: Source/devtools/front_end/sdk/NetworkRequest.js

Issue 637523002: DevTools: use timing information for "disk cached" resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « Source/devtools/front_end/sdk/NetworkManager.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 }, 347 },
348 348
349 set canceled(x) 349 set canceled(x)
350 { 350 {
351 this._canceled = x; 351 this._canceled = x;
352 }, 352 },
353 353
354 /** 354 /**
355 * @return {boolean} 355 * @return {boolean}
356 */ 356 */
357 get cached() 357 cached: function()
358 { 358 {
359 return !!this._cached && !this._transferSize; 359 return (!!this._fromMemoryCache || !!this._fromDiskCache) && !this._tran sferSize;
360 }, 360 },
361 361
362 set cached(x) 362 setFromMemoryCache: function()
363 { 363 {
364 this._cached = x; 364 this._fromMemoryCache = true;
365 if (x) 365 delete this._timing;
366 delete this._timing; 366 },
367
368 setFromDiskCache: function()
369 {
370 this._fromDiskCache = true;
367 }, 371 },
368 372
369 /** 373 /**
370 * @return {boolean} 374 * @return {boolean}
371 */ 375 */
372 get fetchedViaServiceWorker() 376 get fetchedViaServiceWorker()
373 { 377 {
374 return this._fetchedViaServiceWorker; 378 return this._fetchedViaServiceWorker;
375 }, 379 },
376 380
377 set fetchedViaServiceWorker(x) 381 set fetchedViaServiceWorker(x)
378 { 382 {
379 this._fetchedViaServiceWorker = x; 383 this._fetchedViaServiceWorker = x;
380 }, 384 },
381 385
382 /** 386 /**
383 * @return {!NetworkAgent.ResourceTiming|undefined} 387 * @return {!NetworkAgent.ResourceTiming|undefined}
384 */ 388 */
385 get timing() 389 get timing()
386 { 390 {
387 return this._timing; 391 return this._timing;
388 }, 392 },
389 393
390 set timing(x) 394 set timing(x)
391 { 395 {
392 if (x && !this._cached) { 396 if (x && !this._fromMemoryCache) {
393 // Take startTime and responseReceivedTime from timing data for bett er accuracy. 397 // Take startTime and responseReceivedTime from timing data for bett er accuracy.
394 // Timing's requestTime is a baseline in seconds, rest of the number s there are ticks in millis. 398 // Timing's requestTime is a baseline in seconds, rest of the number s there are ticks in millis.
395 this._startTime = x.requestTime; 399 this._startTime = x.requestTime;
396 this._responseReceivedTime = x.requestTime + x.receiveHeadersEnd / 1 000.0; 400 this._responseReceivedTime = x.requestTime + x.receiveHeadersEnd / 1 000.0;
397 401
398 this._timing = x; 402 this._timing = x;
399 this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.Tim ingChanged, this); 403 this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.Tim ingChanged, this);
400 } 404 }
401 }, 405 },
402 406
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 * @param {boolean} sent 990 * @param {boolean} sent
987 */ 991 */
988 addFrame: function(response, time, sent) 992 addFrame: function(response, time, sent)
989 { 993 {
990 var type = sent ? WebInspector.NetworkRequest.WebSocketFrameType.Send : WebInspector.NetworkRequest.WebSocketFrameType.Receive; 994 var type = sent ? WebInspector.NetworkRequest.WebSocketFrameType.Send : WebInspector.NetworkRequest.WebSocketFrameType.Receive;
991 this._frames.push({ type: type, text: response.payloadData, time: time, opCode: response.opcode, mask: response.mask }); 995 this._frames.push({ type: type, text: response.payloadData, time: time, opCode: response.opcode, mask: response.mask });
992 }, 996 },
993 997
994 __proto__: WebInspector.SDKObject.prototype 998 __proto__: WebInspector.SDKObject.prototype
995 } 999 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/NetworkManager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698