| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 #include "config.h" | 30 #include "config.h" |
| 31 #include "ServiceWorkerGlobalScope.h" | 31 #include "ServiceWorkerGlobalScope.h" |
| 32 | 32 |
| 33 #include "CachePolyfill.h" | 33 #include "CachePolyfill.h" |
| 34 #include "CacheStoragePolyfill.h" |
| 34 #include "FetchPolyfill.h" | 35 #include "FetchPolyfill.h" |
| 35 #include "core/workers/WorkerClients.h" | 36 #include "core/workers/WorkerClients.h" |
| 36 #include "core/workers/WorkerThreadStartupData.h" | 37 #include "core/workers/WorkerThreadStartupData.h" |
| 37 #include "modules/EventTargetModules.h" | 38 #include "modules/EventTargetModules.h" |
| 38 #include "modules/serviceworkers/ServiceWorkerClients.h" | 39 #include "modules/serviceworkers/ServiceWorkerClients.h" |
| 39 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" | 40 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" |
| 40 #include "modules/serviceworkers/ServiceWorkerThread.h" | 41 #include "modules/serviceworkers/ServiceWorkerThread.h" |
| 41 #include "platform/weborigin/KURL.h" | 42 #include "platform/weborigin/KURL.h" |
| 42 #include "public/platform/WebURL.h" | 43 #include "public/platform/WebURL.h" |
| 43 #include "wtf/CurrentTime.h" | 44 #include "wtf/CurrentTime.h" |
| 44 | 45 |
| 45 namespace WebCore { | 46 namespace WebCore { |
| 46 | 47 |
| 47 PassRefPtrWillBeRawPtr<ServiceWorkerGlobalScope> ServiceWorkerGlobalScope::creat
e(ServiceWorkerThread* thread, PassOwnPtrWillBeRawPtr<WorkerThreadStartupData> s
tartupData) | 48 PassRefPtrWillBeRawPtr<ServiceWorkerGlobalScope> ServiceWorkerGlobalScope::creat
e(ServiceWorkerThread* thread, PassOwnPtrWillBeRawPtr<WorkerThreadStartupData> s
tartupData) |
| 48 { | 49 { |
| 49 RefPtrWillBeRawPtr<ServiceWorkerGlobalScope> context = adoptRefWillBeRefCoun
tedGarbageCollected(new ServiceWorkerGlobalScope(startupData->m_scriptURL, start
upData->m_userAgent, thread, monotonicallyIncreasingTime(), startupData->m_worke
rClients.release())); | 50 RefPtrWillBeRawPtr<ServiceWorkerGlobalScope> context = adoptRefWillBeRefCoun
tedGarbageCollected(new ServiceWorkerGlobalScope(startupData->m_scriptURL, start
upData->m_userAgent, thread, monotonicallyIncreasingTime(), startupData->m_worke
rClients.release())); |
| 50 | 51 |
| 51 context->applyContentSecurityPolicyFromString(startupData->m_contentSecurity
Policy, startupData->m_contentSecurityPolicyType); | 52 context->applyContentSecurityPolicyFromString(startupData->m_contentSecurity
Policy, startupData->m_contentSecurityPolicyType); |
| 52 | 53 |
| 53 context->script()->evaluate(String(fetchPolyfillJs, sizeof(fetchPolyfillJs))
); | 54 context->script()->evaluate(String(fetchPolyfillJs, sizeof(fetchPolyfillJs))
); |
| 54 context->script()->evaluate(String(cachePolyfillJs, sizeof(cachePolyfillJs))
); | 55 context->script()->evaluate(String(cachePolyfillJs, sizeof(cachePolyfillJs))
); |
| 56 context->script()->evaluate(String(cacheStoragePolyfillJs, sizeof(cacheStora
gePolyfillJs))); |
| 55 | 57 |
| 56 return context.release(); | 58 return context.release(); |
| 57 } | 59 } |
| 58 | 60 |
| 59 ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(const KURL& url, const String
& userAgent, ServiceWorkerThread* thread, double timeOrigin, PassOwnPtrWillBeRaw
Ptr<WorkerClients> workerClients) | 61 ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(const KURL& url, const String
& userAgent, ServiceWorkerThread* thread, double timeOrigin, PassOwnPtrWillBeRaw
Ptr<WorkerClients> workerClients) |
| 60 : WorkerGlobalScope(url, userAgent, thread, timeOrigin, workerClients) | 62 : WorkerGlobalScope(url, userAgent, thread, timeOrigin, workerClients) |
| 61 { | 63 { |
| 62 ScriptWrappable::init(this); | 64 ScriptWrappable::init(this); |
| 63 } | 65 } |
| 64 | 66 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 82 { | 84 { |
| 83 return EventTargetNames::ServiceWorkerGlobalScope; | 85 return EventTargetNames::ServiceWorkerGlobalScope; |
| 84 } | 86 } |
| 85 | 87 |
| 86 void ServiceWorkerGlobalScope::trace(Visitor* visitor) | 88 void ServiceWorkerGlobalScope::trace(Visitor* visitor) |
| 87 { | 89 { |
| 88 WorkerGlobalScope::trace(visitor); | 90 WorkerGlobalScope::trace(visitor); |
| 89 } | 91 } |
| 90 | 92 |
| 91 } // namespace WebCore | 93 } // namespace WebCore |
| OLD | NEW |