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

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

Issue 2337003002: Worker: Notify WorkerThread lifecycle events via WorkerReportingProxy (Closed)
Patch Set: fix tests Created 4 years, 3 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 , m_scriptCount(0) 92 , m_scriptCount(0)
93 , m_scriptTotalSize(0) 93 , m_scriptTotalSize(0)
94 , m_scriptCachedMetadataTotalSize(0) 94 , m_scriptCachedMetadataTotalSize(0)
95 { 95 {
96 } 96 }
97 97
98 ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope() 98 ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope()
99 { 99 {
100 } 100 }
101 101
102 void ServiceWorkerGlobalScope::didLoadWorkerScript(size_t scriptSize, size_t cac hedMetadataSize)
103 {
104 ++m_scriptCount;
105 m_scriptTotalSize += scriptSize;
106 m_scriptCachedMetadataTotalSize += cachedMetadataSize;
107 }
108
102 void ServiceWorkerGlobalScope::didEvaluateWorkerScript() 109 void ServiceWorkerGlobalScope::didEvaluateWorkerScript()
103 { 110 {
104 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scriptCountHistogram, new CustomCountHistogram("ServiceWorker.ScriptCount", 1, 1000, 50)); 111 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scriptCountHistogram, new CustomCountHistogram("ServiceWorker.ScriptCount", 1, 1000, 50));
105 scriptCountHistogram.count(m_scriptCount); 112 scriptCountHistogram.count(m_scriptCount);
106 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scriptTotalSizeHistogr am, new CustomCountHistogram("ServiceWorker.ScriptTotalSize", 1000, 5000000, 50) ); 113 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scriptTotalSizeHistogr am, new CustomCountHistogram("ServiceWorker.ScriptTotalSize", 1000, 5000000, 50) );
107 scriptTotalSizeHistogram.count(m_scriptTotalSize); 114 scriptTotalSizeHistogram.count(m_scriptTotalSize);
108 if (m_scriptCachedMetadataTotalSize) { 115 if (m_scriptCachedMetadataTotalSize) {
109 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, cachedMetadataHist ogram, new CustomCountHistogram("ServiceWorker.ScriptCachedMetadataTotalSize", 1 000, 50000000, 50)); 116 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, cachedMetadataHist ogram, new CustomCountHistogram("ServiceWorker.ScriptCachedMetadataTotalSize", 1 000, 50000000, 50));
110 cachedMetadataHistogram.count(m_scriptCachedMetadataTotalSize); 117 cachedMetadataHistogram.count(m_scriptCachedMetadataTotalSize);
111 } 118 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 return ServiceWorkerScriptCachedMetadataHandler::create(this, scriptURL, met aData); 224 return ServiceWorkerScriptCachedMetadataHandler::create(this, scriptURL, met aData);
218 } 225 }
219 226
220 void ServiceWorkerGlobalScope::exceptionThrown(ErrorEvent* event) 227 void ServiceWorkerGlobalScope::exceptionThrown(ErrorEvent* event)
221 { 228 {
222 WorkerGlobalScope::exceptionThrown(event); 229 WorkerGlobalScope::exceptionThrown(event);
223 if (WorkerThreadDebugger* debugger = WorkerThreadDebugger::from(thread()->is olate())) 230 if (WorkerThreadDebugger* debugger = WorkerThreadDebugger::from(thread()->is olate()))
224 debugger->exceptionThrown(event); 231 debugger->exceptionThrown(event);
225 } 232 }
226 233
227 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta dataSize)
228 {
229 ++m_scriptCount;
230 m_scriptTotalSize += scriptSize;
231 m_scriptCachedMetadataTotalSize += cachedMetadataSize;
232 }
233
234 } // namespace blink 234 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698