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

Side by Side Diff: Source/devtools/front_end/audits/AuditRules.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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 * @param {!WebInspector.Progress} progress 87 * @param {!WebInspector.Progress} progress
88 */ 88 */
89 doRun: function(target, requests, result, callback, progress) 89 doRun: function(target, requests, result, callback, progress)
90 { 90 {
91 var totalSavings = 0; 91 var totalSavings = 0;
92 var compressedSize = 0; 92 var compressedSize = 0;
93 var candidateSize = 0; 93 var candidateSize = 0;
94 var summary = result.addChild("", true); 94 var summary = result.addChild("", true);
95 for (var i = 0, length = requests.length; i < length; ++i) { 95 for (var i = 0, length = requests.length; i < length; ++i) {
96 var request = requests[i]; 96 var request = requests[i];
97 if (request.cached || request.statusCode === 304) 97 if (request.cached() || request.statusCode === 304)
98 continue; // Do not test cached resources. 98 continue; // Do not test cached resources.
99 if (this._shouldCompress(request)) { 99 if (this._shouldCompress(request)) {
100 var size = request.resourceSize; 100 var size = request.resourceSize;
101 candidateSize += size; 101 candidateSize += size;
102 if (this._isCompressed(request)) { 102 if (this._isCompressed(request)) {
103 compressedSize += size; 103 compressedSize += size;
104 continue; 104 continue;
105 } 105 }
106 var savings = 2 * size / 3; 106 var savings = 2 * size / 3;
107 totalSavings += savings; 107 totalSavings += savings;
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 result.violationCount = badUrls.length; 1592 result.violationCount = badUrls.length;
1593 }, 1593 },
1594 1594
1595 _collectorCallback: function(matchingResourceData, request, cookie) 1595 _collectorCallback: function(matchingResourceData, request, cookie)
1596 { 1596 {
1597 matchingResourceData[request.url] = (matchingResourceData[request.url] | | 0) + cookie.size(); 1597 matchingResourceData[request.url] = (matchingResourceData[request.url] | | 0) + cookie.size();
1598 }, 1598 },
1599 1599
1600 __proto__: WebInspector.AuditRules.CookieRuleBase.prototype 1600 __proto__: WebInspector.AuditRules.CookieRuleBase.prototype
1601 } 1601 }
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/inspector/network/resources/cached-script.php ('k') | Source/devtools/front_end/network/HAREntry.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698