| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 152 } |
| 153 | 153 |
| 154 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo
rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString&
origin, WebServicePortID portID) | 154 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo
rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString&
origin, WebServicePortID portID) |
| 155 { | 155 { |
| 156 ASSERT(m_workerGlobalScope); | 156 ASSERT(m_workerGlobalScope); |
| 157 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback
s); | 157 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback
s); |
| 158 ServicePortCollection* collection = WorkerNavigatorServices::services(m_work
erGlobalScope, *m_workerGlobalScope->navigator()); | 158 ServicePortCollection* collection = WorkerNavigatorServices::services(m_work
erGlobalScope, *m_workerGlobalScope->navigator()); |
| 159 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por
tID); | 159 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por
tID); |
| 160 } | 160 } |
| 161 | 161 |
| 162 // TODO(iclelland): Remove this method in favor of the two-parameter version | |
| 163 // below, once all call sites have been updated. | |
| 164 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID) | |
| 165 { | |
| 166 ASSERT(m_workerGlobalScope); | |
| 167 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { | |
| 168 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); | |
| 169 return; | |
| 170 } | |
| 171 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Sync, eventID); | |
| 172 // TODO(chasej) - Send registration as in crbug.com/482066 | |
| 173 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, null
ptr /* registration */, observer)); | |
| 174 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | |
| 175 } | |
| 176 | |
| 177 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebSync
Registration& registration) | 162 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebSync
Registration& registration) |
| 178 { | 163 { |
| 179 ASSERT(m_workerGlobalScope); | 164 ASSERT(m_workerGlobalScope); |
| 180 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { | 165 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { |
| 181 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); | 166 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); |
| 182 return; | 167 return; |
| 183 } | 168 } |
| 184 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Sync, eventID); | 169 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Sync, eventID); |
| 185 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, Sync
Registration::create(registration, m_workerGlobalScope->registration()), observe
r)); | 170 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, Sync
Registration::create(registration, m_workerGlobalScope->registration()), observe
r)); |
| 186 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | 171 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 236 |
| 252 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 237 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
| 253 : m_embeddedWorker(embeddedWorker) | 238 : m_embeddedWorker(embeddedWorker) |
| 254 , m_document(document) | 239 , m_document(document) |
| 255 , m_client(client) | 240 , m_client(client) |
| 256 , m_workerGlobalScope(0) | 241 , m_workerGlobalScope(0) |
| 257 { | 242 { |
| 258 } | 243 } |
| 259 | 244 |
| 260 } // namespace blink | 245 } // namespace blink |
| OLD | NEW |