| 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 24 matching lines...) Expand all Loading... |
| 35 #include "modules/ModulesExport.h" | 35 #include "modules/ModulesExport.h" |
| 36 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
| 37 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" | 37 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" |
| 38 #include "wtf/Assertions.h" | 38 #include "wtf/Assertions.h" |
| 39 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
| 40 #include <memory> | 40 #include <memory> |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 class Dictionary; | 44 class Dictionary; |
| 45 class IsolatedWorkerThread; |
| 45 class Request; | 46 class Request; |
| 46 class ScriptPromise; | 47 class ScriptPromise; |
| 47 class ScriptState; | 48 class ScriptState; |
| 48 class ServiceWorkerClients; | 49 class ServiceWorkerClients; |
| 49 class ServiceWorkerRegistration; | 50 class ServiceWorkerRegistration; |
| 50 class ServiceWorkerThread; | 51 class ServiceWorkerThread; |
| 51 class WaitUntilObserver; | 52 class WaitUntilObserver; |
| 52 class WorkerThreadStartupData; | 53 class WorkerThreadStartupData; |
| 53 | 54 |
| 54 typedef RequestOrUSVString RequestInfo; | 55 typedef RequestOrUSVString RequestInfo; |
| 55 | 56 |
| 56 class MODULES_EXPORT ServiceWorkerGlobalScope final : public WorkerGlobalScope { | 57 class MODULES_EXPORT ServiceWorkerGlobalScope final : public WorkerGlobalScope { |
| 57 DEFINE_WRAPPERTYPEINFO(); | 58 DEFINE_WRAPPERTYPEINFO(); |
| 58 public: | 59 public: |
| 60 static ServiceWorkerGlobalScope* create(IsolatedWorkerThread*, std::unique_p
tr<WorkerThreadStartupData>); |
| 59 static ServiceWorkerGlobalScope* create(ServiceWorkerThread*, std::unique_pt
r<WorkerThreadStartupData>); | 61 static ServiceWorkerGlobalScope* create(ServiceWorkerThread*, std::unique_pt
r<WorkerThreadStartupData>); |
| 60 | 62 |
| 61 ~ServiceWorkerGlobalScope() override; | 63 ~ServiceWorkerGlobalScope() override; |
| 62 bool isServiceWorkerGlobalScope() const override { return true; } | 64 bool isServiceWorkerGlobalScope() const override { return true; } |
| 63 | 65 |
| 64 // WorkerGlobalScope | 66 // WorkerGlobalScope |
| 65 void didEvaluateWorkerScript() override; | 67 void didEvaluateWorkerScript() override; |
| 66 | 68 |
| 67 // ServiceWorkerGlobalScope.idl | 69 // ServiceWorkerGlobalScope.idl |
| 68 ServiceWorkerClients* clients(); | 70 ServiceWorkerClients* clients(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 86 DEFINE_ATTRIBUTE_EVENT_LISTENER(foreignfetch); | 88 DEFINE_ATTRIBUTE_EVENT_LISTENER(foreignfetch); |
| 87 | 89 |
| 88 DECLARE_VIRTUAL_TRACE(); | 90 DECLARE_VIRTUAL_TRACE(); |
| 89 | 91 |
| 90 protected: | 92 protected: |
| 91 // EventTarget | 93 // EventTarget |
| 92 DispatchEventResult dispatchEventInternal(Event*) override; | 94 DispatchEventResult dispatchEventInternal(Event*) override; |
| 93 bool addEventListenerInternal(const AtomicString& eventType, EventListener*,
const AddEventListenerOptionsResolved&) override; | 95 bool addEventListenerInternal(const AtomicString& eventType, EventListener*,
const AddEventListenerOptionsResolved&) override; |
| 94 | 96 |
| 95 private: | 97 private: |
| 98 ServiceWorkerGlobalScope(const KURL&, const String& userAgent, IsolatedWorke
rThread*, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData>); |
| 96 ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorker
Thread*, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData>, Work
erClients*); | 99 ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorker
Thread*, double timeOrigin, std::unique_ptr<SecurityOrigin::PrivilegeData>, Work
erClients*); |
| 97 void importScripts(const Vector<String>& urls, ExceptionState&) override; | 100 void importScripts(const Vector<String>& urls, ExceptionState&) override; |
| 98 CachedMetadataHandler* createWorkerScriptCachedMetadataHandler(const KURL& s
criptURL, const Vector<char>* metaData) override; | 101 CachedMetadataHandler* createWorkerScriptCachedMetadataHandler(const KURL& s
criptURL, const Vector<char>* metaData) override; |
| 99 void exceptionThrown(ErrorEvent*) override; | 102 void exceptionThrown(ErrorEvent*) override; |
| 100 void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) override; | 103 void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) override; |
| 101 | 104 |
| 102 Member<ServiceWorkerClients> m_clients; | 105 Member<ServiceWorkerClients> m_clients; |
| 103 Member<ServiceWorkerRegistration> m_registration; | 106 Member<ServiceWorkerRegistration> m_registration; |
| 107 const bool m_isIsolatedWorkerGlobalScope; |
| 104 bool m_didEvaluateScript; | 108 bool m_didEvaluateScript; |
| 105 bool m_hadErrorInTopLevelEventHandler; | 109 bool m_hadErrorInTopLevelEventHandler; |
| 106 unsigned m_eventNestingLevel; | 110 unsigned m_eventNestingLevel; |
| 107 size_t m_scriptCount; | 111 size_t m_scriptCount; |
| 108 size_t m_scriptTotalSize; | 112 size_t m_scriptTotalSize; |
| 109 size_t m_scriptCachedMetadataTotalSize; | 113 size_t m_scriptCachedMetadataTotalSize; |
| 110 }; | 114 }; |
| 111 | 115 |
| 112 DEFINE_TYPE_CASTS(ServiceWorkerGlobalScope, ExecutionContext, context, context->
isServiceWorkerGlobalScope(), context.isServiceWorkerGlobalScope()); | 116 DEFINE_TYPE_CASTS(ServiceWorkerGlobalScope, ExecutionContext, context, context->
isServiceWorkerGlobalScope(), context.isServiceWorkerGlobalScope()); |
| 113 | 117 |
| 114 } // namespace blink | 118 } // namespace blink |
| 115 | 119 |
| 116 #endif // ServiceWorkerGlobalScope_h | 120 #endif // ServiceWorkerGlobalScope_h |
| OLD | NEW |