| Index: Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
|
| diff --git a/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp b/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
|
| index 3af04a81b7690dda7fef14a5c822c0d19d849f5c..29c044cb90b7a494db91995aad9055a689adddef 100644
|
| --- a/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
|
| +++ b/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
|
| @@ -55,6 +55,7 @@
|
| #include "platform/network/ResourceRequest.h"
|
| #include "platform/weborigin/DatabaseIdentifier.h"
|
| #include "platform/weborigin/KURL.h"
|
| +#include "public/platform/Platform.h"
|
| #include "public/platform/WebServiceWorkerSkipWaitingCallbacks.h"
|
| #include "public/platform/WebURL.h"
|
| #include "wtf/CurrentTime.h"
|
| @@ -94,6 +95,9 @@ ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(const KURL& url, const String
|
| , m_didEvaluateScript(false)
|
| , m_hadErrorInTopLevelEventHandler(false)
|
| , m_eventNestingLevel(0)
|
| + , m_scriptCount(0)
|
| + , m_scriptTotalSize(0)
|
| + , m_scriptCachedMetadataTotalSize(0)
|
| {
|
| workerInspectorController()->registerModuleAgent(InspectorServiceWorkerCacheAgent::create(this));
|
| }
|
| @@ -104,6 +108,12 @@ 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);
|
| + }
|
| m_didEvaluateScript = true;
|
| }
|
|
|
| @@ -235,4 +245,11 @@ void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage,
|
| addMessageToWorkerConsole(consoleMessage.release());
|
| }
|
|
|
| +void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMetadataSize)
|
| +{
|
| + ++m_scriptCount;
|
| + m_scriptTotalSize += scriptSize;
|
| + m_scriptCachedMetadataTotalSize += cachedMetadataSize;
|
| +}
|
| +
|
| } // namespace blink
|
|
|