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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 void close(ExceptionState&); | 75 void close(ExceptionState&); |
76 | 76 |
77 ScriptPromise skipWaiting(ScriptState*); | 77 ScriptPromise skipWaiting(ScriptState*); |
78 | 78 |
79 void setRegistration(WebServiceWorkerRegistration*); | 79 void setRegistration(WebServiceWorkerRegistration*); |
80 | 80 |
81 // EventTarget | 81 // EventTarget |
82 bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListene
r>, bool useCapture = false) override; | 82 bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListene
r>, bool useCapture = false) override; |
83 const AtomicString& interfaceName() const override; | 83 const AtomicString& interfaceName() const override; |
84 bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) override; | |
85 | 84 |
86 void dispatchExtendableEvent(PassRefPtrWillBeRawPtr<Event>, WaitUntilObserve
r*); | 85 void dispatchExtendableEvent(PassRefPtrWillBeRawPtr<Event>, WaitUntilObserve
r*); |
87 | 86 |
88 DEFINE_ATTRIBUTE_EVENT_LISTENER(install); | 87 DEFINE_ATTRIBUTE_EVENT_LISTENER(install); |
89 DEFINE_ATTRIBUTE_EVENT_LISTENER(activate); | 88 DEFINE_ATTRIBUTE_EVENT_LISTENER(activate); |
90 DEFINE_ATTRIBUTE_EVENT_LISTENER(fetch); | 89 DEFINE_ATTRIBUTE_EVENT_LISTENER(fetch); |
91 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 90 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
92 DEFINE_ATTRIBUTE_EVENT_LISTENER(sync); | 91 DEFINE_ATTRIBUTE_EVENT_LISTENER(sync); |
93 | 92 |
94 DECLARE_VIRTUAL_TRACE(); | 93 DECLARE_VIRTUAL_TRACE(); |
95 | 94 |
| 95 protected: |
| 96 // EventTarget |
| 97 bool dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>) override; |
| 98 |
96 private: | 99 private: |
97 class SkipWaitingCallback; | 100 class SkipWaitingCallback; |
98 | 101 |
99 ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorker
Thread*, double timeOrigin, const SecurityOrigin*, PassOwnPtrWillBeRawPtr<Worker
Clients>); | 102 ServiceWorkerGlobalScope(const KURL&, const String& userAgent, ServiceWorker
Thread*, double timeOrigin, const SecurityOrigin*, PassOwnPtrWillBeRawPtr<Worker
Clients>); |
100 void importScripts(const Vector<String>& urls, ExceptionState&) override; | 103 void importScripts(const Vector<String>& urls, ExceptionState&) override; |
101 PassOwnPtr<CachedMetadataHandler> createWorkerScriptCachedMetadataHandler(co
nst KURL& scriptURL, const Vector<char>* metaData) override; | 104 PassOwnPtr<CachedMetadataHandler> createWorkerScriptCachedMetadataHandler(co
nst KURL& scriptURL, const Vector<char>* metaData) override; |
102 void logExceptionToConsole(const String& errorMessage, int scriptId, const S
tring& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<Scrip
tCallStack>) override; | 105 void logExceptionToConsole(const String& errorMessage, int scriptId, const S
tring& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<Scrip
tCallStack>) override; |
103 void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) override; | 106 void scriptLoaded(size_t scriptSize, size_t cachedMetadataSize) override; |
104 | 107 |
105 PersistentWillBeMember<ServiceWorkerClients> m_clients; | 108 PersistentWillBeMember<ServiceWorkerClients> m_clients; |
106 PersistentWillBeMember<ServiceWorkerRegistration> m_registration; | 109 PersistentWillBeMember<ServiceWorkerRegistration> m_registration; |
107 PersistentWillBeMember<StashedPortCollection> m_ports; | 110 PersistentWillBeMember<StashedPortCollection> m_ports; |
108 bool m_didEvaluateScript; | 111 bool m_didEvaluateScript; |
109 bool m_hadErrorInTopLevelEventHandler; | 112 bool m_hadErrorInTopLevelEventHandler; |
110 unsigned m_eventNestingLevel; | 113 unsigned m_eventNestingLevel; |
111 size_t m_scriptCount; | 114 size_t m_scriptCount; |
112 size_t m_scriptTotalSize; | 115 size_t m_scriptTotalSize; |
113 size_t m_scriptCachedMetadataTotalSize; | 116 size_t m_scriptCachedMetadataTotalSize; |
114 }; | 117 }; |
115 | 118 |
116 DEFINE_TYPE_CASTS(ServiceWorkerGlobalScope, ExecutionContext, context, context->
isServiceWorkerGlobalScope(), context.isServiceWorkerGlobalScope()); | 119 DEFINE_TYPE_CASTS(ServiceWorkerGlobalScope, ExecutionContext, context, context->
isServiceWorkerGlobalScope(), context.isServiceWorkerGlobalScope()); |
117 | 120 |
118 } // namespace blink | 121 } // namespace blink |
119 | 122 |
120 #endif // ServiceWorkerGlobalScope_h | 123 #endif // ServiceWorkerGlobalScope_h |
OLD | NEW |