| 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 23 matching lines...) Expand all Loading... |
| 34 #include "bindings/core/v8/ScriptState.h" | 34 #include "bindings/core/v8/ScriptState.h" |
| 35 #include "bindings/core/v8/V8ThrowException.h" | 35 #include "bindings/core/v8/V8ThrowException.h" |
| 36 #include "core/events/Event.h" | 36 #include "core/events/Event.h" |
| 37 #include "core/fetch/MemoryCache.h" | 37 #include "core/fetch/MemoryCache.h" |
| 38 #include "core/fetch/ResourceLoaderOptions.h" | 38 #include "core/fetch/ResourceLoaderOptions.h" |
| 39 #include "core/inspector/ConsoleMessage.h" | 39 #include "core/inspector/ConsoleMessage.h" |
| 40 #include "core/inspector/ScriptCallStack.h" | 40 #include "core/inspector/ScriptCallStack.h" |
| 41 #include "core/inspector/WorkerInspectorController.h" | 41 #include "core/inspector/WorkerInspectorController.h" |
| 42 #include "core/loader/ThreadableLoader.h" | 42 #include "core/loader/ThreadableLoader.h" |
| 43 #include "core/workers/WorkerClients.h" | 43 #include "core/workers/WorkerClients.h" |
| 44 #include "core/workers/WorkerThreadStartupData.h" | 44 #include "core/workers/WorkerScriptStartupData.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/WaitUntilObserver.h" | 54 #include "modules/serviceworkers/WaitUntilObserver.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 71 | 71 |
| 72 void onSuccess() override | 72 void onSuccess() override |
| 73 { | 73 { |
| 74 m_resolver->resolve(); | 74 m_resolver->resolve(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; | 78 RefPtrWillBePersistent<ScriptPromiseResolver> m_resolver; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 PassRefPtrWillBeRawPtr<ServiceWorkerGlobalScope> ServiceWorkerGlobalScope::creat
e(ServiceWorkerThread* thread, PassOwnPtr<WorkerThreadStartupData> startupData) | 81 PassRefPtrWillBeRawPtr<ServiceWorkerGlobalScope> ServiceWorkerGlobalScope::creat
e(ServiceWorkerThread* thread, PassOwnPtr<WorkerScriptStartupData> startupData) |
| 82 { | 82 { |
| 83 // Note: startupData is finalized on return. After the relevant parts has be
en | 83 // Note: startupData is finalized on return. After the relevant parts has be
en |
| 84 // passed along to the created 'context'. | 84 // passed along to the created 'context'. |
| 85 RefPtrWillBeRawPtr<ServiceWorkerGlobalScope> context = adoptRefWillBeNoop(ne
w ServiceWorkerGlobalScope(startupData->m_scriptURL, startupData->m_userAgent, t
hread, monotonicallyIncreasingTime(), startupData->m_starterOrigin, startupData-
>m_workerClients.release())); | 85 RefPtrWillBeRawPtr<ServiceWorkerGlobalScope> context = adoptRefWillBeNoop(ne
w ServiceWorkerGlobalScope(startupData->m_scriptURL, startupData->m_userAgent, t
hread, monotonicallyIncreasingTime(), startupData->m_starterOrigin, startupData-
>m_workerClients.release())); |
| 86 | 86 |
| 87 context->setV8CacheOptions(startupData->m_v8CacheOptions); | 87 context->setV8CacheOptions(startupData->m_v8CacheOptions); |
| 88 context->applyContentSecurityPolicyFromString(startupData->m_contentSecurity
Policy, startupData->m_contentSecurityPolicyType); | 88 context->applyContentSecurityPolicyFromString(startupData->m_contentSecurity
Policy, startupData->m_contentSecurityPolicyType); |
| 89 | 89 |
| 90 return context.release(); | 90 return context.release(); |
| 91 } | 91 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 return result; | 190 return result; |
| 191 } | 191 } |
| 192 | 192 |
| 193 void ServiceWorkerGlobalScope::dispatchExtendableEvent(PassRefPtrWillBeRawPtr<Ev
ent> event, WaitUntilObserver* observer) | 193 void ServiceWorkerGlobalScope::dispatchExtendableEvent(PassRefPtrWillBeRawPtr<Ev
ent> event, WaitUntilObserver* observer) |
| 194 { | 194 { |
| 195 ASSERT(m_eventNestingLevel == 0); | 195 ASSERT(m_eventNestingLevel == 0); |
| 196 m_hadErrorInTopLevelEventHandler = false; | 196 m_hadErrorInTopLevelEventHandler = false; |
| 197 | 197 |
| 198 observer->willDispatchEvent(); | 198 observer->willDispatchEvent(); |
| 199 dispatchEvent(event); | 199 dispatchEvent(event); |
| 200 if (thread()->terminated()) | 200 if (script()->terminated()) |
| 201 m_hadErrorInTopLevelEventHandler = true; | 201 m_hadErrorInTopLevelEventHandler = true; |
| 202 observer->didDispatchEvent(m_hadErrorInTopLevelEventHandler); | 202 observer->didDispatchEvent(m_hadErrorInTopLevelEventHandler); |
| 203 } | 203 } |
| 204 | 204 |
| 205 DEFINE_TRACE(ServiceWorkerGlobalScope) | 205 DEFINE_TRACE(ServiceWorkerGlobalScope) |
| 206 { | 206 { |
| 207 visitor->trace(m_clients); | 207 visitor->trace(m_clients); |
| 208 visitor->trace(m_registration); | 208 visitor->trace(m_registration); |
| 209 WorkerGlobalScope::trace(visitor); | 209 WorkerGlobalScope::trace(visitor); |
| 210 } | 210 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 234 } | 234 } |
| 235 | 235 |
| 236 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta
dataSize) | 236 void ServiceWorkerGlobalScope::scriptLoaded(size_t scriptSize, size_t cachedMeta
dataSize) |
| 237 { | 237 { |
| 238 ++m_scriptCount; | 238 ++m_scriptCount; |
| 239 m_scriptTotalSize += scriptSize; | 239 m_scriptTotalSize += scriptSize; |
| 240 m_scriptCachedMetadataTotalSize += cachedMetadataSize; | 240 m_scriptCachedMetadataTotalSize += cachedMetadataSize; |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace blink | 243 } // namespace blink |
| OLD | NEW |