| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size())) | 150 if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size())) |
| 151 eventInit.setAction(data.actions[actionIndex].action); | 151 eventInit.setAction(data.actions[actionIndex].action); |
| 152 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no
tificationclick, eventInit, observer)); | 152 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no
tificationclick, eventInit, observer)); |
| 153 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | 153 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ng& data) | 156 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ng& data) |
| 157 { | 157 { |
| 158 ASSERT(m_workerGlobalScope); | 158 ASSERT(m_workerGlobalScope); |
| 159 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Push, eventID); | 159 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Push, eventID); |
| 160 RefPtrWillBeRawPtr<Event> event(PushEvent::create(EventTypeNames::push, Push
MessageData::create(data), observer)); | 160 NonThrowableExceptionState exceptionState; |
| 161 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | 161 PushMessageData* messageData = PushMessageData::create(data, exceptionState)
; |
| 162 // Fail silently by dropping the event when the allocation of PushMessageDat
a fails (out of memory), which results in an exception |
| 163 if (!exceptionState.hadException()) { |
| 164 RefPtrWillBeRawPtr<Event> event(PushEvent::create(EventTypeNames::push,
messageData, observer)); |
| 165 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
| 166 } |
| 162 } | 167 } |
| 163 | 168 |
| 164 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo
rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString&
origin, WebServicePortID portID) | 169 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo
rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString&
origin, WebServicePortID portID) |
| 165 { | 170 { |
| 166 ASSERT(m_workerGlobalScope); | 171 ASSERT(m_workerGlobalScope); |
| 167 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback
s); | 172 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback
s); |
| 168 ServicePortCollection* collection = WorkerNavigatorServices::services(m_work
erGlobalScope, *m_workerGlobalScope->navigator()); | 173 ServicePortCollection* collection = WorkerNavigatorServices::services(m_work
erGlobalScope, *m_workerGlobalScope->navigator()); |
| 169 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por
tID); | 174 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por
tID); |
| 170 } | 175 } |
| 171 | 176 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 251 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
| 247 : m_embeddedWorker(embeddedWorker) | 252 : m_embeddedWorker(embeddedWorker) |
| 248 , m_document(document) | 253 , m_document(document) |
| 249 , m_documentURL(document.url().copy()) | 254 , m_documentURL(document.url().copy()) |
| 250 , m_client(client) | 255 , m_client(client) |
| 251 , m_workerGlobalScope(nullptr) | 256 , m_workerGlobalScope(nullptr) |
| 252 { | 257 { |
| 253 } | 258 } |
| 254 | 259 |
| 255 } // namespace blink | 260 } // namespace blink |
| OLD | NEW |