| 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 22 matching lines...) Expand all Loading... |
| 33 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 33 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| 34 #include "core/dom/CrossThreadTask.h" | 34 #include "core/dom/CrossThreadTask.h" |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/dom/ExecutionContext.h" | 36 #include "core/dom/ExecutionContext.h" |
| 37 #include "core/dom/MessagePort.h" | 37 #include "core/dom/MessagePort.h" |
| 38 #include "core/inspector/ConsoleMessage.h" | 38 #include "core/inspector/ConsoleMessage.h" |
| 39 #include "core/workers/WorkerGlobalScope.h" | 39 #include "core/workers/WorkerGlobalScope.h" |
| 40 #include "core/workers/WorkerThread.h" | 40 #include "core/workers/WorkerThread.h" |
| 41 #include "modules/background_sync/SyncEvent.h" | 41 #include "modules/background_sync/SyncEvent.h" |
| 42 #include "modules/fetch/Headers.h" | 42 #include "modules/fetch/Headers.h" |
| 43 #include "modules/geofencing/CircularGeofencingRegion.h" | |
| 44 #include "modules/geofencing/GeofencingEvent.h" | |
| 45 #include "modules/notifications/Notification.h" | 43 #include "modules/notifications/Notification.h" |
| 46 #include "modules/notifications/NotificationEvent.h" | 44 #include "modules/notifications/NotificationEvent.h" |
| 47 #include "modules/notifications/NotificationEventInit.h" | 45 #include "modules/notifications/NotificationEventInit.h" |
| 48 #include "modules/push_messaging/PushEvent.h" | 46 #include "modules/push_messaging/PushEvent.h" |
| 49 #include "modules/push_messaging/PushMessageData.h" | 47 #include "modules/push_messaging/PushMessageData.h" |
| 50 #include "modules/serviceworkers/ExtendableEvent.h" | 48 #include "modules/serviceworkers/ExtendableEvent.h" |
| 51 #include "modules/serviceworkers/ExtendableMessageEvent.h" | 49 #include "modules/serviceworkers/ExtendableMessageEvent.h" |
| 52 #include "modules/serviceworkers/FetchEvent.h" | 50 #include "modules/serviceworkers/FetchEvent.h" |
| 53 #include "modules/serviceworkers/ForeignFetchEvent.h" | 51 #include "modules/serviceworkers/ForeignFetchEvent.h" |
| 54 #include "modules/serviceworkers/InstallEvent.h" | 52 #include "modules/serviceworkers/InstallEvent.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 Request* request = Request::create(workerGlobalScope()->scriptController()->
getScriptState(), webRequest); | 151 Request* request = Request::create(workerGlobalScope()->scriptController()->
getScriptState(), webRequest); |
| 154 request->getHeaders()->setGuard(Headers::ImmutableGuard); | 152 request->getHeaders()->setGuard(Headers::ImmutableGuard); |
| 155 ForeignFetchEventInit eventInit; | 153 ForeignFetchEventInit eventInit; |
| 156 eventInit.setCancelable(true); | 154 eventInit.setCancelable(true); |
| 157 eventInit.setRequest(request); | 155 eventInit.setRequest(request); |
| 158 ForeignFetchEvent* fetchEvent = ForeignFetchEvent::create(EventTypeNames::fo
reignfetch, eventInit, observer); | 156 ForeignFetchEvent* fetchEvent = ForeignFetchEvent::create(EventTypeNames::fo
reignfetch, eventInit, observer); |
| 159 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); | 157 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); |
| 160 observer->didDispatchEvent(dispatchResult); | 158 observer->didDispatchEvent(dispatchResult); |
| 161 } | 159 } |
| 162 | 160 |
| 163 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof
encingEventType eventType, const WebString& regionID, const WebCircularGeofencin
gRegion& region) | |
| 164 { | |
| 165 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT
ypeNames::geofenceenter : EventTypeNames::geofenceleave; | |
| 166 workerGlobalScope()->dispatchEvent(GeofencingEvent::create(type, regionID, C
ircularGeofencingRegion::create(regionID, region))); | |
| 167 } | |
| 168 | |
| 169 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) | 161 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) |
| 170 { | 162 { |
| 171 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Install, eventID); | 163 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Install, eventID); |
| 172 Event* event; | 164 Event* event; |
| 173 if (RuntimeEnabledFeatures::foreignFetchEnabled()) | 165 if (RuntimeEnabledFeatures::foreignFetchEnabled()) |
| 174 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni
t(), observer); | 166 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni
t(), observer); |
| 175 else | 167 else |
| 176 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent
Init(), observer); | 168 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent
Init(), observer); |
| 177 workerGlobalScope()->dispatchExtendableEvent(event, observer); | 169 workerGlobalScope()->dispatchExtendableEvent(event, observer); |
| 178 } | 170 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 return *m_document; | 288 return *m_document; |
| 297 } | 289 } |
| 298 | 290 |
| 299 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st | 291 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st |
| 300 { | 292 { |
| 301 DCHECK(m_workerGlobalScope); | 293 DCHECK(m_workerGlobalScope); |
| 302 return m_workerGlobalScope; | 294 return m_workerGlobalScope; |
| 303 } | 295 } |
| 304 | 296 |
| 305 } // namespace blink | 297 } // namespace blink |
| OLD | NEW |