| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 179 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo
rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString&
origin, WebServicePortID portID) | 182 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo
rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString&
origin, WebServicePortID portID) |
| 183 { | 183 { |
| 184 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback
s); | 184 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback
s); |
| 185 ServicePortCollection* collection = WorkerNavigatorServices::services(worker
GlobalScope(), *workerGlobalScope()->navigator()); | 185 ServicePortCollection* collection = WorkerNavigatorServices::services(worker
GlobalScope(), *workerGlobalScope()->navigator()); |
| 186 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por
tID); | 186 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por
tID); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebSync
Registration& registration, LastChanceOption lastChance) | 189 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebStri
ng& tag, LastChanceOption lastChance) |
| 190 { | 190 { |
| 191 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { | 191 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { |
| 192 ServiceWorkerGlobalScopeClient::from(workerGlobalScope())->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); | 192 ServiceWorkerGlobalScopeClient::from(workerGlobalScope())->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); |
| 193 return; | 193 return; |
| 194 } | 194 } |
| 195 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Sync, eventID); | 195 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Sync, eventID); |
| 196 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, regi
stration.tag, lastChance == IsLastChance, observer)); | 196 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, tag,
lastChance == IsLastChance, observer)); |
| 197 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 197 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro
ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa
gePortChannelArray& webChannels) | 200 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro
ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa
gePortChannelArray& webChannels) |
| 201 { | 201 { |
| 202 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope(
), webChannels); | 202 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope(
), webChannels); |
| 203 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); | 203 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
| 204 // FIXME: Have proper source for this MessageEvent. | 204 // FIXME: Have proper source for this MessageEvent. |
| 205 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports, value,
webClient.origin.string()); | 205 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports, value,
webClient.origin.string()); |
| 206 event->setType(EventTypeNames::crossoriginmessage); | 206 event->setType(EventTypeNames::crossoriginmessage); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 eventInit.setCancelable(true); | 302 eventInit.setCancelable(true); |
| 303 eventInit.setRequest(request); | 303 eventInit.setRequest(request); |
| 304 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); | 304 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); |
| 305 eventInit.setIsReload(webRequest.isReload()); | 305 eventInit.setIsReload(webRequest.isReload()); |
| 306 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName,
eventInit, observer)); | 306 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName,
eventInit, observer)); |
| 307 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent.release()); | 307 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent.release()); |
| 308 observer->didDispatchEvent(dispatchResult); | 308 observer->didDispatchEvent(dispatchResult); |
| 309 } | 309 } |
| 310 | 310 |
| 311 } // namespace blink | 311 } // namespace blink |
| OLD | NEW |