| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 class ServiceWorkerRegistration; | 49 class ServiceWorkerRegistration; |
| 50 class ServiceWorkerThread; | 50 class ServiceWorkerThread; |
| 51 class WaitUntilObserver; | 51 class WaitUntilObserver; |
| 52 class WorkerThreadStartupData; | 52 class WorkerThreadStartupData; |
| 53 | 53 |
| 54 typedef RequestOrUSVString RequestInfo; | 54 typedef RequestOrUSVString RequestInfo; |
| 55 | 55 |
| 56 class MODULES_EXPORT ServiceWorkerGlobalScope final : public WorkerGlobalScope { | 56 class MODULES_EXPORT ServiceWorkerGlobalScope final : public WorkerGlobalScope { |
| 57 DEFINE_WRAPPERTYPEINFO(); | 57 DEFINE_WRAPPERTYPEINFO(); |
| 58 public: | 58 public: |
| 59 static RawPtr<ServiceWorkerGlobalScope> create(ServiceWorkerThread*, PassOwn
Ptr<WorkerThreadStartupData>); | 59 static ServiceWorkerGlobalScope* create(ServiceWorkerThread*, PassOwnPtr<Wor
kerThreadStartupData>); |
| 60 | 60 |
| 61 ~ServiceWorkerGlobalScope() override; | 61 ~ServiceWorkerGlobalScope() override; |
| 62 bool isServiceWorkerGlobalScope() const override { return true; } | 62 bool isServiceWorkerGlobalScope() const override { return true; } |
| 63 | 63 |
| 64 // WorkerGlobalScope | 64 // WorkerGlobalScope |
| 65 void didEvaluateWorkerScript() override; | 65 void didEvaluateWorkerScript() override; |
| 66 | 66 |
| 67 // ServiceWorkerGlobalScope.idl | 67 // ServiceWorkerGlobalScope.idl |
| 68 ServiceWorkerClients* clients(); | 68 ServiceWorkerClients* clients(); |
| 69 ServiceWorkerRegistration* registration(); | 69 ServiceWorkerRegistration* registration(); |
| 70 | 70 |
| 71 ScriptPromise fetch(ScriptState*, const RequestInfo&, const Dictionary&, Exc
eptionState&); | 71 ScriptPromise fetch(ScriptState*, const RequestInfo&, const Dictionary&, Exc
eptionState&); |
| 72 | 72 |
| 73 void close(ExceptionState&); | 73 void close(ExceptionState&); |
| 74 | 74 |
| 75 ScriptPromise skipWaiting(ScriptState*); | 75 ScriptPromise skipWaiting(ScriptState*); |
| 76 | 76 |
| 77 void setRegistration(WebPassOwnPtr<WebServiceWorkerRegistration::Handle>); | 77 void setRegistration(WebPassOwnPtr<WebServiceWorkerRegistration::Handle>); |
| 78 | 78 |
| 79 // EventTarget | 79 // EventTarget |
| 80 const AtomicString& interfaceName() const override; | 80 const AtomicString& interfaceName() const override; |
| 81 | 81 |
| 82 void dispatchExtendableEvent(RawPtr<Event>, WaitUntilObserver*); | 82 void dispatchExtendableEvent(Event*, WaitUntilObserver*); |
| 83 | 83 |
| 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(install); | 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(install); |
| 85 DEFINE_ATTRIBUTE_EVENT_LISTENER(activate); | 85 DEFINE_ATTRIBUTE_EVENT_LISTENER(activate); |
| 86 DEFINE_ATTRIBUTE_EVENT_LISTENER(fetch); | 86 DEFINE_ATTRIBUTE_EVENT_LISTENER(fetch); |
| 87 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 87 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
| 88 DEFINE_ATTRIBUTE_EVENT_LISTENER(foreignfetch); | 88 DEFINE_ATTRIBUTE_EVENT_LISTENER(foreignfetch); |
| 89 | 89 |
| 90 DECLARE_VIRTUAL_TRACE(); | 90 DECLARE_VIRTUAL_TRACE(); |
| 91 | 91 |
| 92 protected: | 92 protected: |
| 93 // EventTarget | 93 // EventTarget |
| 94 DispatchEventResult dispatchEventInternal(Event*) override; | 94 DispatchEventResult dispatchEventInternal(Event*) override; |
| 95 bool addEventListenerInternal(const AtomicString& eventType, EventListener*,
const EventListenerOptions&) override; | 95 bool addEventListenerInternal(const AtomicString& eventType, EventListener*,
const EventListenerOptions&) override; |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorker
Thread*, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData>, RawPtr<Wo
rkerClients>); | 98 ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorker
Thread*, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData>, WorkerCli
ents*); |
| 99 void importScripts(const Vector<String>& urls, ExceptionState&) override; | 99 void importScripts(const Vector<String>& urls, ExceptionState&) override; |
| 100 RawPtr<CachedMetadataHandler> createWorkerScriptCachedMetadataHandler(const
KURL& scriptURL, const Vector<char>* metaData) override; | 100 RawPtr<CachedMetadataHandler> createWorkerScriptCachedMetadataHandler(const
KURL& scriptURL, const Vector<char>* metaData) override; |
| 101 void logExceptionToConsole(const String& errorMessage, int scriptId, const S
tring& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>)
override; | 101 void logExceptionToConsole(const String& errorMessage, int scriptId, const S
tring& sourceURL, int lineNumber, int columnNumber, PassRefPtr<ScriptCallStack>)
override; |
| 102 void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) override; | 102 void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) override; |
| 103 | 103 |
| 104 Member<ServiceWorkerClients> m_clients; | 104 Member<ServiceWorkerClients> m_clients; |
| 105 Member<ServiceWorkerRegistration> m_registration; | 105 Member<ServiceWorkerRegistration> m_registration; |
| 106 bool m_didEvaluateScript; | 106 bool m_didEvaluateScript; |
| 107 bool m_hadErrorInTopLevelEventHandler; | 107 bool m_hadErrorInTopLevelEventHandler; |
| 108 unsigned m_eventNestingLevel; | 108 unsigned m_eventNestingLevel; |
| 109 size_t m_scriptCount; | 109 size_t m_scriptCount; |
| 110 size_t m_scriptTotalSize; | 110 size_t m_scriptTotalSize; |
| 111 size_t m_scriptCachedMetadataTotalSize; | 111 size_t m_scriptCachedMetadataTotalSize; |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 DEFINE_TYPE_CASTS(ServiceWorkerGlobalScope, ExecutionContext, context, context->
isServiceWorkerGlobalScope(), context.isServiceWorkerGlobalScope()); | 114 DEFINE_TYPE_CASTS(ServiceWorkerGlobalScope, ExecutionContext, context, context->
isServiceWorkerGlobalScope(), context.isServiceWorkerGlobalScope()); |
| 115 | 115 |
| 116 } // namespace blink | 116 } // namespace blink |
| 117 | 117 |
| 118 #endif // ServiceWorkerGlobalScope_h | 118 #endif // ServiceWorkerGlobalScope_h |
| OLD | NEW |