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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::NotificationError, eventID); | 133 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::NotificationError, eventID); |
134 // FIXME: Initialize a Notification object based on |data|. | 134 // FIXME: Initialize a Notification object based on |data|. |
135 NotificationEventInit eventInit; | 135 NotificationEventInit eventInit; |
136 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no
tificationerror, eventInit, observer)); | 136 RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::no
tificationerror, eventInit, observer)); |
137 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | 137 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
138 } | 138 } |
139 | 139 |
140 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ng& data) | 140 void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ng& data) |
141 { | 141 { |
142 ASSERT(m_workerGlobalScope); | 142 ASSERT(m_workerGlobalScope); |
143 m_workerGlobalScope->dispatchEvent(PushEvent::create(EventTypeNames::push, d
ata)); | 143 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Push, eventID); |
144 // TODO(mvanouwerkerk): Instead of calling didHandlePushEvent here, it | 144 RefPtrWillBeRawPtr<Event> event(PushEvent::create(EventTypeNames::push, data
, observer)); |
145 // should get called from WaitUntilObserver::decrementPendingActivity once | 145 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
146 // the push event is hooked up to event.waitUntil (crbug.com/430888). | |
147 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandlePushEven
t(eventID, WebServiceWorkerEventResultCompleted); | |
148 } | 146 } |
149 | 147 |
150 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID) | 148 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID) |
151 { | 149 { |
152 ASSERT(m_workerGlobalScope); | 150 ASSERT(m_workerGlobalScope); |
153 if (RuntimeEnabledFeatures::backgroundSyncEnabled()) | 151 if (RuntimeEnabledFeatures::backgroundSyncEnabled()) |
154 m_workerGlobalScope->dispatchEvent(Event::create(EventTypeNames::sync)); | 152 m_workerGlobalScope->dispatchEvent(Event::create(EventTypeNames::sync)); |
155 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSyncEven
t(eventID); | 153 ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSyncEven
t(eventID); |
156 } | 154 } |
157 | 155 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 198 |
201 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 199 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
202 : m_embeddedWorker(embeddedWorker) | 200 : m_embeddedWorker(embeddedWorker) |
203 , m_document(document) | 201 , m_document(document) |
204 , m_client(client) | 202 , m_client(client) |
205 , m_workerGlobalScope(0) | 203 , m_workerGlobalScope(0) |
206 { | 204 { |
207 } | 205 } |
208 | 206 |
209 } // namespace blink | 207 } // namespace blink |
OLD | NEW |