Chromium Code Reviews| Index: Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp |
| diff --git a/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp b/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp |
| index 3af04a81b7690dda7fef14a5c822c0d19d849f5c..31e53d86f29e5675a332407918a313d30933a1c0 100644 |
| --- a/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp |
| +++ b/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp |
| @@ -94,6 +94,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 +107,10 @@ ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope() |
| void ServiceWorkerGlobalScope::didEvaluateWorkerScript() |
| { |
| + Platform::current()->histogramCustomCounts("ServiceWorker.ScriptCount", m_scriptCount, 1, 1000, 50); |
|
haraken
2015/04/03 09:16:53
Do we probably need if(Platform::current()) check
horo
2015/04/03 09:27:01
Done.
|
| + Platform::current()->histogramCustomCounts("ServiceWorker.ScriptTotalSize", m_scriptTotalSize, 1000, 5000000, 50); |
| + if (m_scriptCachedMetadataTotalSize) |
| + Platform::current()->histogramCustomCounts("ServiceWorker.ScriptCachedMetadataTotalSize", m_scriptCachedMetadataTotalSize, 1000, 50000000, 50); |
| m_didEvaluateScript = true; |
| } |
| @@ -235,4 +242,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 |