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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp

Issue 1659053002: Remove custom counts histogram from the blink API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a few thread_safe_static_local -> static_local as per feedback in reviews Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "modules/EventTargetModules.h" 48 #include "modules/EventTargetModules.h"
49 #include "modules/cachestorage/CacheStorage.h" 49 #include "modules/cachestorage/CacheStorage.h"
50 #include "modules/cachestorage/InspectorCacheStorageAgent.h" 50 #include "modules/cachestorage/InspectorCacheStorageAgent.h"
51 #include "modules/fetch/GlobalFetch.h" 51 #include "modules/fetch/GlobalFetch.h"
52 #include "modules/serviceworkers/ServiceWorkerClients.h" 52 #include "modules/serviceworkers/ServiceWorkerClients.h"
53 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 53 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
54 #include "modules/serviceworkers/ServiceWorkerRegistration.h" 54 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
55 #include "modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h" 55 #include "modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h"
56 #include "modules/serviceworkers/ServiceWorkerThread.h" 56 #include "modules/serviceworkers/ServiceWorkerThread.h"
57 #include "modules/serviceworkers/WaitUntilObserver.h" 57 #include "modules/serviceworkers/WaitUntilObserver.h"
58 #include "platform/Histogram.h"
58 #include "platform/network/ResourceRequest.h" 59 #include "platform/network/ResourceRequest.h"
59 #include "platform/weborigin/DatabaseIdentifier.h" 60 #include "platform/weborigin/DatabaseIdentifier.h"
60 #include "platform/weborigin/KURL.h" 61 #include "platform/weborigin/KURL.h"
61 #include "public/platform/Platform.h" 62 #include "public/platform/Platform.h"
62 #include "public/platform/WebURL.h" 63 #include "public/platform/WebURL.h"
63 #include "wtf/CurrentTime.h" 64 #include "wtf/CurrentTime.h"
64 65
65 namespace blink { 66 namespace blink {
66 67
67 PassRefPtrWillBeRawPtr<ServiceWorkerGlobalScope> ServiceWorkerGlobalScope::creat e(ServiceWorkerThread* thread, PassOwnPtr<WorkerThreadStartupData> startupData) 68 PassRefPtrWillBeRawPtr<ServiceWorkerGlobalScope> ServiceWorkerGlobalScope::creat e(ServiceWorkerThread* thread, PassOwnPtr<WorkerThreadStartupData> startupData)
(...skipping 18 matching lines...) Expand all
86 , m_scriptCachedMetadataTotalSize(0) 87 , m_scriptCachedMetadataTotalSize(0)
87 { 88 {
88 } 89 }
89 90
90 ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope() 91 ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope()
91 { 92 {
92 } 93 }
93 94
94 void ServiceWorkerGlobalScope::didEvaluateWorkerScript() 95 void ServiceWorkerGlobalScope::didEvaluateWorkerScript()
95 { 96 {
96 if (Platform* platform = Platform::current()) { 97 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scriptCountHistogram, new CustomCountHistogram("ServiceWorker.ScriptCount", 1, 1000, 50));
97 platform->histogramCustomCounts("ServiceWorker.ScriptCount", m_scriptCou nt, 1, 1000, 50); 98 scriptCountHistogram.count(m_scriptCount);
98 platform->histogramCustomCounts("ServiceWorker.ScriptTotalSize", m_scrip tTotalSize, 1000, 5000000, 50); 99 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scriptTotalSizeHistogr am, new CustomCountHistogram("ServiceWorker.ScriptTotalSize", 1000, 5000000, 50) );
99 if (m_scriptCachedMetadataTotalSize) 100 scriptTotalSizeHistogram.count(m_scriptTotalSize);
100 platform->histogramCustomCounts("ServiceWorker.ScriptCachedMetadataT otalSize", m_scriptCachedMetadataTotalSize, 1000, 50000000, 50); 101 if (m_scriptCachedMetadataTotalSize) {
102 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, cachedMetadataHist ogram, new CustomCountHistogram("ServiceWorker.ScriptCachedMetadataTotalSize", 1 000, 50000000, 50));
103 cachedMetadataHistogram.count(m_scriptCachedMetadataTotalSize);
101 } 104 }
102 m_didEvaluateScript = true; 105 m_didEvaluateScript = true;
103 } 106 }
104 107
105 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const Re questInfo& input, const Dictionary& init, ExceptionState& exceptionState) 108 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const Re questInfo& input, const Dictionary& init, ExceptionState& exceptionState)
106 { 109 {
107 return GlobalFetch::fetch(scriptState, *this, input, init, exceptionState); 110 return GlobalFetch::fetch(scriptState, *this, input, init, exceptionState);
108 } 111 }
109 112
110 ServiceWorkerClients* ServiceWorkerGlobalScope::clients() 113 ServiceWorkerClients* ServiceWorkerGlobalScope::clients()
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 221 }
219 222
220 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta dataSize) 223 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta dataSize)
221 { 224 {
222 ++m_scriptCount; 225 ++m_scriptCount;
223 m_scriptTotalSize += scriptSize; 226 m_scriptTotalSize += scriptSize;
224 m_scriptCachedMetadataTotalSize += cachedMetadataSize; 227 m_scriptCachedMetadataTotalSize += cachedMetadataSize;
225 } 228 }
226 229
227 } // namespace blink 230 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698