| 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) | 635 if (!resource) |
| 636 return 0; | 636 return 0; |
| 637 | 637 |
| 638 if (!resource->hasClients()) |
| 639 m_deadStatsRecorder.update(policy); |
| 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); |
| 645 resource->didChangePriority(priority); | 648 resource->didChangePriority(priority); |
| 646 } | 649 } |
| 647 } | 650 } |
| (...skipping 718 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 case Load: |
| 1401 ++m_loadCount; |
| 1402 return; |
| 1403 case Revalidate: |
| 1404 ++m_revalidateCount; |
| 1405 return; |
| 1406 case Use: |
| 1407 ++m_useCount; |
| 1408 return; |
| 1409 } |
| 1410 } |
| 1411 |
| 1412 } |
| OLD | NEW |