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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "core/workers/WorkerThreadStartupData.h" | 44 #include "core/workers/WorkerThreadStartupData.h" |
45 #include "modules/EventTargetModules.h" | 45 #include "modules/EventTargetModules.h" |
46 #include "modules/cachestorage/CacheStorage.h" | 46 #include "modules/cachestorage/CacheStorage.h" |
47 #include "modules/cachestorage/InspectorCacheStorageAgent.h" | 47 #include "modules/cachestorage/InspectorCacheStorageAgent.h" |
48 #include "modules/fetch/GlobalFetch.h" | 48 #include "modules/fetch/GlobalFetch.h" |
49 #include "modules/serviceworkers/ServiceWorkerClients.h" | 49 #include "modules/serviceworkers/ServiceWorkerClients.h" |
50 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" | 50 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" |
51 #include "modules/serviceworkers/ServiceWorkerRegistration.h" | 51 #include "modules/serviceworkers/ServiceWorkerRegistration.h" |
52 #include "modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h" | 52 #include "modules/serviceworkers/ServiceWorkerScriptCachedMetadataHandler.h" |
53 #include "modules/serviceworkers/ServiceWorkerThread.h" | 53 #include "modules/serviceworkers/ServiceWorkerThread.h" |
| 54 #include "modules/serviceworkers/StashedPortCollection.h" |
54 #include "modules/serviceworkers/WaitUntilObserver.h" | 55 #include "modules/serviceworkers/WaitUntilObserver.h" |
55 #include "platform/network/ResourceRequest.h" | 56 #include "platform/network/ResourceRequest.h" |
56 #include "platform/weborigin/DatabaseIdentifier.h" | 57 #include "platform/weborigin/DatabaseIdentifier.h" |
57 #include "platform/weborigin/KURL.h" | 58 #include "platform/weborigin/KURL.h" |
58 #include "public/platform/Platform.h" | 59 #include "public/platform/Platform.h" |
59 #include "public/platform/WebServiceWorkerSkipWaitingCallbacks.h" | 60 #include "public/platform/WebServiceWorkerSkipWaitingCallbacks.h" |
60 #include "public/platform/WebURL.h" | 61 #include "public/platform/WebURL.h" |
61 #include "wtf/CurrentTime.h" | 62 #include "wtf/CurrentTime.h" |
62 | 63 |
63 namespace blink { | 64 namespace blink { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 { | 110 { |
110 if (Platform* platform = Platform::current()) { | 111 if (Platform* platform = Platform::current()) { |
111 platform->histogramCustomCounts("ServiceWorker.ScriptCount", m_scriptCou
nt, 1, 1000, 50); | 112 platform->histogramCustomCounts("ServiceWorker.ScriptCount", m_scriptCou
nt, 1, 1000, 50); |
112 platform->histogramCustomCounts("ServiceWorker.ScriptTotalSize", m_scrip
tTotalSize, 1000, 5000000, 50); | 113 platform->histogramCustomCounts("ServiceWorker.ScriptTotalSize", m_scrip
tTotalSize, 1000, 5000000, 50); |
113 if (m_scriptCachedMetadataTotalSize) | 114 if (m_scriptCachedMetadataTotalSize) |
114 platform->histogramCustomCounts("ServiceWorker.ScriptCachedMetadataT
otalSize", m_scriptCachedMetadataTotalSize, 1000, 50000000, 50); | 115 platform->histogramCustomCounts("ServiceWorker.ScriptCachedMetadataT
otalSize", m_scriptCachedMetadataTotalSize, 1000, 50000000, 50); |
115 } | 116 } |
116 m_didEvaluateScript = true; | 117 m_didEvaluateScript = true; |
117 } | 118 } |
118 | 119 |
| 120 PassRefPtrWillBeRawPtr<StashedPortCollection> ServiceWorkerGlobalScope::ports() |
| 121 { |
| 122 if (!m_ports) |
| 123 m_ports = StashedPortCollection::create(this); |
| 124 return m_ports; |
| 125 } |
| 126 |
119 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const Re
questInfo& input, const Dictionary& init, ExceptionState& exceptionState) | 127 ScriptPromise ServiceWorkerGlobalScope::fetch(ScriptState* scriptState, const Re
questInfo& input, const Dictionary& init, ExceptionState& exceptionState) |
120 { | 128 { |
121 return GlobalFetch::fetch(scriptState, *this, input, init, exceptionState); | 129 return GlobalFetch::fetch(scriptState, *this, input, init, exceptionState); |
122 } | 130 } |
123 | 131 |
124 ServiceWorkerClients* ServiceWorkerGlobalScope::clients() | 132 ServiceWorkerClients* ServiceWorkerGlobalScope::clients() |
125 { | 133 { |
126 if (!m_clients) | 134 if (!m_clients) |
127 m_clients = ServiceWorkerClients::create(); | 135 m_clients = ServiceWorkerClients::create(); |
128 return m_clients; | 136 return m_clients; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 242 } |
235 | 243 |
236 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta
dataSize) | 244 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta
dataSize) |
237 { | 245 { |
238 ++m_scriptCount; | 246 ++m_scriptCount; |
239 m_scriptTotalSize += scriptSize; | 247 m_scriptTotalSize += scriptSize; |
240 m_scriptCachedMetadataTotalSize += cachedMetadataSize; | 248 m_scriptCachedMetadataTotalSize += cachedMetadataSize; |
241 } | 249 } |
242 | 250 |
243 } // namespace blink | 251 } // namespace blink |
OLD | NEW |