Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
| 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
| 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
| 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
| 7 | 7 |
| 8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
| 9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
| 10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 625 break; | 625 break; |
| 626 case Revalidate: | 626 case Revalidate: |
| 627 resource = revalidateResource(request, resource.get()); | 627 resource = revalidateResource(request, resource.get()); |
| 628 break; | 628 break; |
| 629 case Use: | 629 case Use: |
| 630 resource->updateForAccess(); | 630 resource->updateForAccess(); |
| 631 notifyLoadedFromMemoryCache(resource.get()); | 631 notifyLoadedFromMemoryCache(resource.get()); |
| 632 break; | 632 break; |
| 633 } | 633 } |
| 634 | 634 |
| 635 if (!resource->hasClients()) | |
|
Nate Chapin
2014/01/29 18:19:56
We null-check resource just below this. Either thi
| |
| 636 m_deadStatsRecorder.update(policy); | |
| 637 | |
| 635 if (!resource) | 638 if (!resource) |
| 636 return 0; | 639 return 0; |
| 637 | 640 |
| 638 if (policy != Use) | 641 if (policy != Use) |
| 639 resource->setIdentifier(createUniqueIdentifier()); | 642 resource->setIdentifier(createUniqueIdentifier()); |
| 640 | 643 |
| 641 if (!request.forPreload() || policy != Use) { | 644 if (!request.forPreload() || policy != Use) { |
| 642 ResourceLoadPriority priority = loadPriority(type, request); | 645 ResourceLoadPriority priority = loadPriority(type, request); |
| 643 if (priority != resource->resourceRequest().priority()) { | 646 if (priority != resource->resourceRequest().priority()) { |
| 644 resource->resourceRequest().setPriority(priority); | 647 resource->resourceRequest().setPriority(priority); |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1366 printf("IMAGES: %d (%d hits, hit rate %d%%)\n", images, images - imageM isses, (images - imageMisses) * 100 / images); | 1369 printf("IMAGES: %d (%d hits, hit rate %d%%)\n", images, images - imageM isses, (images - imageMisses) * 100 / images); |
| 1367 } | 1370 } |
| 1368 #endif | 1371 #endif |
| 1369 | 1372 |
| 1370 const ResourceLoaderOptions& ResourceFetcher::defaultResourceOptions() | 1373 const ResourceLoaderOptions& ResourceFetcher::defaultResourceOptions() |
| 1371 { | 1374 { |
| 1372 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SniffContent, BufferDat a, AllowStoredCredentials, ClientRequestedCredentials, AskClientForCrossOriginCr edentials, DoSecurityCheck, CheckContentSecurityPolicy, DocumentContext)); | 1375 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SniffContent, BufferDat a, AllowStoredCredentials, ClientRequestedCredentials, AskClientForCrossOriginCr edentials, DoSecurityCheck, CheckContentSecurityPolicy, DocumentContext)); |
| 1373 return options; | 1376 return options; |
| 1374 } | 1377 } |
| 1375 | 1378 |
| 1379 ResourceFetcher::DeadResourceStatsRecorder::DeadResourceStatsRecorder() | |
| 1380 : m_useCount(0) | |
| 1381 , m_revalidateCount(0) | |
| 1382 , m_loadCount(0) | |
| 1383 { | |
| 1376 } | 1384 } |
| 1385 | |
| 1386 ResourceFetcher::DeadResourceStatsRecorder::~DeadResourceStatsRecorder() | |
| 1387 { | |
| 1388 blink::Platform::current()->histogramCustomCounts( | |
| 1389 "WebCore.ResourceFetcher.HitCount", m_useCount, 0, 1000, 50); | |
| 1390 blink::Platform::current()->histogramCustomCounts( | |
| 1391 "WebCore.ResourceFetcher.RevalidateCount", m_revalidateCount, 0, 1000, 5 0); | |
| 1392 blink::Platform::current()->histogramCustomCounts( | |
| 1393 "WebCore.ResourceFetcher.LoadCount", m_loadCount, 0, 1000, 50); | |
| 1394 } | |
| 1395 | |
| 1396 void ResourceFetcher::DeadResourceStatsRecorder::update(RevalidationPolicy polic y) | |
| 1397 { | |
| 1398 switch (policy) { | |
| 1399 case Reload: | |
| 1400 // Fall through. | |
|
Nate Chapin
2014/01/29 18:19:56
Given that Reload and Load cases are identical, th
| |
| 1401 case Load: | |
| 1402 ++m_loadCount; | |
| 1403 break; | |
|
Nate Chapin
2014/01/29 18:19:56
return instead?
| |
| 1404 case Revalidate: | |
| 1405 ++m_revalidateCount; | |
| 1406 break; | |
| 1407 case Use: | |
| 1408 ++m_useCount; | |
| 1409 break; | |
| 1410 } | |
| 1411 } | |
| 1412 | |
| 1413 } | |
| OLD | NEW |