Index: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp |
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp |
index 4aa783b33ee42bb4d96b033cce0537fcb5c54adf..8fdb935c43cc41dc37c59eedf778f1aa1546ec21 100644 |
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp |
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp |
@@ -55,6 +55,7 @@ |
#include "modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h" |
#include "modules/serviceworkers/ServiceWorkerThread.h" |
#include "modules/serviceworkers/WaitUntilObserver.h" |
+#include "platform/Histogram.h" |
#include "platform/network/ResourceRequest.h" |
#include "platform/weborigin/DatabaseIdentifier.h" |
#include "platform/weborigin/KURL.h" |
@@ -93,11 +94,13 @@ ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope() |
void ServiceWorkerGlobalScope::didEvaluateWorkerScript() |
{ |
- if (Platform* platform = Platform::current()) { |
- platform->histogramCustomCounts("ServiceWorker.ScriptCount", m_scriptCount, 1, 1000, 50); |
- platform->histogramCustomCounts("ServiceWorker.ScriptTotalSize", m_scriptTotalSize, 1000, 5000000, 50); |
- if (m_scriptCachedMetadataTotalSize) |
- platform->histogramCustomCounts("ServiceWorker.ScriptCachedMetadataTotalSize", m_scriptCachedMetadataTotalSize, 1000, 50000000, 50); |
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scriptCountHistogram, new CustomCountHistogram("ServiceWorker.ScriptCount", 1, 1000, 50)); |
+ scriptCountHistogram.count(m_scriptCount); |
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scriptTotalSizeHistogram, new CustomCountHistogram("ServiceWorker.ScriptTotalSize", 1000, 5000000, 50)); |
+ scriptTotalSizeHistogram.count(m_scriptTotalSize); |
+ if (m_scriptCachedMetadataTotalSize) { |
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, cachedMetadataHistogram, new CustomCountHistogram("ServiceWorker.ScriptCachedMetadataTotalSize", 1000, 50000000, 50)); |
+ cachedMetadataHistogram.count(m_scriptCachedMetadataTotalSize); |
} |
m_didEvaluateScript = true; |
} |