Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp

Issue 1059193002: Add UMA to understand the typical total size of ServiceWorker script [1/2 blink] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerGlobalScope.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerGlobalScope.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698