OLD | NEW |
---|---|
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 context->applyContentSecurityPolicyFromString(startupData->m_contentSecurity Policy, startupData->m_contentSecurityPolicyType); | 87 context->applyContentSecurityPolicyFromString(startupData->m_contentSecurity Policy, startupData->m_contentSecurityPolicyType); |
88 | 88 |
89 return context.release(); | 89 return context.release(); |
90 } | 90 } |
91 | 91 |
92 ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(const KURL& url, const String & userAgent, ServiceWorkerThread* thread, double timeOrigin, const SecurityOrigi n* starterOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> workerClients) | 92 ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(const KURL& url, const String & userAgent, ServiceWorkerThread* thread, double timeOrigin, const SecurityOrigi n* starterOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> workerClients) |
93 : WorkerGlobalScope(url, userAgent, thread, timeOrigin, starterOrigin, worke rClients) | 93 : WorkerGlobalScope(url, userAgent, thread, timeOrigin, starterOrigin, worke rClients) |
94 , m_didEvaluateScript(false) | 94 , m_didEvaluateScript(false) |
95 , m_hadErrorInTopLevelEventHandler(false) | 95 , m_hadErrorInTopLevelEventHandler(false) |
96 , m_eventNestingLevel(0) | 96 , m_eventNestingLevel(0) |
97 , m_scriptCount(0) | |
98 , m_scriptTotalSize(0) | |
99 , m_scriptCachedMetadataTotalSize(0) | |
97 { | 100 { |
98 workerInspectorController()->registerModuleAgent(InspectorServiceWorkerCache Agent::create(this)); | 101 workerInspectorController()->registerModuleAgent(InspectorServiceWorkerCache Agent::create(this)); |
99 } | 102 } |
100 | 103 |
101 ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope() | 104 ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope() |
102 { | 105 { |
103 } | 106 } |
104 | 107 |
105 void ServiceWorkerGlobalScope::didEvaluateWorkerScript() | 108 void ServiceWorkerGlobalScope::didEvaluateWorkerScript() |
106 { | 109 { |
110 Platform::current()->histogramCustomCounts("ServiceWorker.ScriptCount", m_sc riptCount, 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.
| |
111 Platform::current()->histogramCustomCounts("ServiceWorker.ScriptTotalSize", m_scriptTotalSize, 1000, 5000000, 50); | |
112 if (m_scriptCachedMetadataTotalSize) | |
113 Platform::current()->histogramCustomCounts("ServiceWorker.ScriptCachedMe tadataTotalSize", m_scriptCachedMetadataTotalSize, 1000, 50000000, 50); | |
107 m_didEvaluateScript = true; | 114 m_didEvaluateScript = true; |
108 } | 115 } |
109 | 116 |
110 CacheStorage* ServiceWorkerGlobalScope::caches(ExecutionContext* context) | 117 CacheStorage* ServiceWorkerGlobalScope::caches(ExecutionContext* context) |
111 { | 118 { |
112 if (!m_caches) { | 119 if (!m_caches) { |
113 String identifier = createDatabaseIdentifierFromSecurityOrigin(context-> securityOrigin()); | 120 String identifier = createDatabaseIdentifierFromSecurityOrigin(context-> securityOrigin()); |
114 ASSERT(!identifier.isEmpty()); | 121 ASSERT(!identifier.isEmpty()); |
115 m_caches = CacheStorage::create(Platform::current()->cacheStorage(identi fier)); | 122 m_caches = CacheStorage::create(Platform::current()->cacheStorage(identi fier)); |
116 } | 123 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 | 235 |
229 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe fPtrWillBeRawPtr<ScriptCallStack> callStack) | 236 void ServiceWorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int scriptId, const String& sourceURL, int lineNumber, int columnNumber, PassRe fPtrWillBeRawPtr<ScriptCallStack> callStack) |
230 { | 237 { |
231 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL, lineNumber, columnNumber, callStack); | 238 WorkerGlobalScope::logExceptionToConsole(errorMessage, scriptId, sourceURL, lineNumber, columnNumber, callStack); |
232 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); | 239 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(J SMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber); |
233 consoleMessage->setScriptId(scriptId); | 240 consoleMessage->setScriptId(scriptId); |
234 consoleMessage->setCallStack(callStack); | 241 consoleMessage->setCallStack(callStack); |
235 addMessageToWorkerConsole(consoleMessage.release()); | 242 addMessageToWorkerConsole(consoleMessage.release()); |
236 } | 243 } |
237 | 244 |
245 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta dataSize) | |
246 { | |
247 ++m_scriptCount; | |
248 m_scriptTotalSize += scriptSize; | |
249 m_scriptCachedMetadataTotalSize += cachedMetadataSize; | |
250 } | |
251 | |
238 } // namespace blink | 252 } // namespace blink |
OLD | NEW |