Chromium Code Reviews| Index: Source/core/fetch/ResourceFetcher.cpp |
| diff --git a/Source/core/fetch/ResourceFetcher.cpp b/Source/core/fetch/ResourceFetcher.cpp |
| index ea44911232428333aea6d34d69eedae383194cb6..66c9e0ff0f3bdd089fa1095f2e7ab6c4536c71bd 100644 |
| --- a/Source/core/fetch/ResourceFetcher.cpp |
| +++ b/Source/core/fetch/ResourceFetcher.cpp |
| @@ -632,6 +632,9 @@ ResourcePtr<Resource> ResourceFetcher::requestResource(Resource::Type type, Fetc |
| break; |
| } |
| + if (!resource->hasClients()) |
|
Nate Chapin
2014/01/29 18:19:56
We null-check resource just below this. Either thi
|
| + m_deadStatsRecorder.update(policy); |
| + |
| if (!resource) |
| return 0; |
| @@ -1373,4 +1376,38 @@ const ResourceLoaderOptions& ResourceFetcher::defaultResourceOptions() |
| return options; |
| } |
| +ResourceFetcher::DeadResourceStatsRecorder::DeadResourceStatsRecorder() |
| + : m_useCount(0) |
| + , m_revalidateCount(0) |
| + , m_loadCount(0) |
| +{ |
| +} |
| + |
| +ResourceFetcher::DeadResourceStatsRecorder::~DeadResourceStatsRecorder() |
| +{ |
| + blink::Platform::current()->histogramCustomCounts( |
| + "WebCore.ResourceFetcher.HitCount", m_useCount, 0, 1000, 50); |
| + blink::Platform::current()->histogramCustomCounts( |
| + "WebCore.ResourceFetcher.RevalidateCount", m_revalidateCount, 0, 1000, 50); |
| + blink::Platform::current()->histogramCustomCounts( |
| + "WebCore.ResourceFetcher.LoadCount", m_loadCount, 0, 1000, 50); |
| +} |
| + |
| +void ResourceFetcher::DeadResourceStatsRecorder::update(RevalidationPolicy policy) |
| +{ |
| + switch (policy) { |
| + case Reload: |
| + // Fall through. |
|
Nate Chapin
2014/01/29 18:19:56
Given that Reload and Load cases are identical, th
|
| + case Load: |
| + ++m_loadCount; |
| + break; |
|
Nate Chapin
2014/01/29 18:19:56
return instead?
|
| + case Revalidate: |
| + ++m_revalidateCount; |
| + break; |
| + case Use: |
| + ++m_useCount; |
| + break; |
| + } |
| +} |
| + |
| } |