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