| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "modules/notifications/NotificationEventInit.h" | 54 #include "modules/notifications/NotificationEventInit.h" |
| 55 #include "modules/push_messaging/PushEvent.h" | 55 #include "modules/push_messaging/PushEvent.h" |
| 56 #include "modules/push_messaging/PushMessageData.h" | 56 #include "modules/push_messaging/PushMessageData.h" |
| 57 #include "modules/serviceworkers/ExtendableEvent.h" | 57 #include "modules/serviceworkers/ExtendableEvent.h" |
| 58 #include "modules/serviceworkers/FetchEvent.h" | 58 #include "modules/serviceworkers/FetchEvent.h" |
| 59 #include "modules/serviceworkers/InstallEvent.h" | 59 #include "modules/serviceworkers/InstallEvent.h" |
| 60 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" | 60 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
| 61 #include "modules/serviceworkers/WaitUntilObserver.h" | 61 #include "modules/serviceworkers/WaitUntilObserver.h" |
| 62 #include "platform/RuntimeEnabledFeatures.h" | 62 #include "platform/RuntimeEnabledFeatures.h" |
| 63 #include "public/platform/WebCrossOriginServiceWorkerClient.h" | 63 #include "public/platform/WebCrossOriginServiceWorkerClient.h" |
| 64 #include "public/platform/modules/background_sync/WebSyncRegistration.h" |
| 64 #include "public/platform/modules/notifications/WebNotificationData.h" | 65 #include "public/platform/modules/notifications/WebNotificationData.h" |
| 65 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" | 66 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" |
| 66 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" | 67 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" |
| 67 #include "public/web/WebSerializedScriptValue.h" | 68 #include "public/web/WebSerializedScriptValue.h" |
| 68 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" | 69 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" |
| 69 #include "web/WebEmbeddedWorkerImpl.h" | 70 #include "web/WebEmbeddedWorkerImpl.h" |
| 70 #include "wtf/Assertions.h" | 71 #include "wtf/Assertions.h" |
| 71 #include "wtf/Functional.h" | 72 #include "wtf/Functional.h" |
| 72 #include "wtf/PassOwnPtr.h" | 73 #include "wtf/PassOwnPtr.h" |
| 73 | 74 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 171 } |
| 171 | 172 |
| 172 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebSync
Registration& registration, LastChanceOption lastChance) | 173 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebSync
Registration& registration, LastChanceOption lastChance) |
| 173 { | 174 { |
| 174 ASSERT(m_workerGlobalScope); | 175 ASSERT(m_workerGlobalScope); |
| 175 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { | 176 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { |
| 176 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); | 177 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); |
| 177 return; | 178 return; |
| 178 } | 179 } |
| 179 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Sync, eventID); | 180 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Sync, eventID); |
| 180 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, Sync
Registration::create(registration, m_workerGlobalScope->registration()), lastCha
nce == IsLastChance, observer)); | 181 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, regi
stration.tag, lastChance == IsLastChance, observer)); |
| 181 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | 182 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
| 182 } | 183 } |
| 183 | 184 |
| 184 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro
ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa
gePortChannelArray& webChannels) | 185 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro
ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa
gePortChannelArray& webChannels) |
| 185 { | 186 { |
| 186 ASSERT(m_workerGlobalScope); | 187 ASSERT(m_workerGlobalScope); |
| 187 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop
e, webChannels); | 188 MessagePortArray* ports = MessagePort::toMessagePortArray(m_workerGlobalScop
e, webChannels); |
| 188 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); | 189 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
| 189 // FIXME: Have proper source for this MessageEvent. | 190 // FIXME: Have proper source for this MessageEvent. |
| 190 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports, value,
webClient.origin.string()); | 191 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports, value,
webClient.origin.string()); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 247 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
| 247 : m_embeddedWorker(embeddedWorker) | 248 : m_embeddedWorker(embeddedWorker) |
| 248 , m_document(document) | 249 , m_document(document) |
| 249 , m_documentURL(document.url().copy()) | 250 , m_documentURL(document.url().copy()) |
| 250 , m_client(client) | 251 , m_client(client) |
| 251 , m_workerGlobalScope(nullptr) | 252 , m_workerGlobalScope(nullptr) |
| 252 { | 253 { |
| 253 } | 254 } |
| 254 | 255 |
| 255 } // namespace blink | 256 } // namespace blink |
| OLD | NEW |