Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: content/renderer/service_worker/service_worker_context_client.h

Issue 2569993002: [ServiceWorker] Mojofy PushEvent of Service Worker. (Closed)
Patch Set: Address comments from Peter and shimazu Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_
6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ 6 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 const ServiceWorkerVersionAttributes& attrs); 213 const ServiceWorkerVersionAttributes& attrs);
214 214
215 // mojom::ServiceWorkerEventDispatcher 215 // mojom::ServiceWorkerEventDispatcher
216 void DispatchExtendableMessageEvent( 216 void DispatchExtendableMessageEvent(
217 mojom::ExtendableMessageEventPtr event, 217 mojom::ExtendableMessageEventPtr event,
218 const DispatchExtendableMessageEventCallback& callback) override; 218 const DispatchExtendableMessageEventCallback& callback) override;
219 void DispatchFetchEvent(int fetch_event_id, 219 void DispatchFetchEvent(int fetch_event_id,
220 const ServiceWorkerFetchRequest& request, 220 const ServiceWorkerFetchRequest& request,
221 mojom::FetchEventPreloadHandlePtr preload_handle, 221 mojom::FetchEventPreloadHandlePtr preload_handle,
222 const DispatchFetchEventCallback& callback) override; 222 const DispatchFetchEventCallback& callback) override;
223 void DispatchPushEvent(const PushEventPayload& payload,
224 const DispatchPushEventCallback& callback) override;
223 void DispatchSyncEvent( 225 void DispatchSyncEvent(
224 const std::string& tag, 226 const std::string& tag,
225 blink::mojom::BackgroundSyncEventLastChance last_chance, 227 blink::mojom::BackgroundSyncEventLastChance last_chance,
226 const DispatchSyncEventCallback& callback) override; 228 const DispatchSyncEventCallback& callback) override;
227 229
228 void OnActivateEvent(int request_id); 230 void OnActivateEvent(int request_id);
229 void OnInstallEvent(int request_id); 231 void OnInstallEvent(int request_id);
230 void OnNotificationClickEvent( 232 void OnNotificationClickEvent(
231 int request_id, 233 int request_id,
232 const std::string& notification_id, 234 const std::string& notification_id,
233 const PlatformNotificationData& notification_data, 235 const PlatformNotificationData& notification_data,
234 int action_index, 236 int action_index,
235 const base::NullableString16& reply); 237 const base::NullableString16& reply);
236 void OnPushEvent(int request_id, const PushEventPayload& payload);
237 void OnNotificationCloseEvent( 238 void OnNotificationCloseEvent(
238 int request_id, 239 int request_id,
239 const std::string& notification_id, 240 const std::string& notification_id,
240 const PlatformNotificationData& notification_data); 241 const PlatformNotificationData& notification_data);
241 242
242 void OnDidGetClient(int request_id, const ServiceWorkerClientInfo& client); 243 void OnDidGetClient(int request_id, const ServiceWorkerClientInfo& client);
243 void OnDidGetClients( 244 void OnDidGetClients(
244 int request_id, const std::vector<ServiceWorkerClientInfo>& clients); 245 int request_id, const std::vector<ServiceWorkerClientInfo>& clients);
245 void OnOpenWindowResponse(int request_id, 246 void OnOpenWindowResponse(int request_id,
246 const ServiceWorkerClientInfo& client); 247 const ServiceWorkerClientInfo& client);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 // This is bound on the worker thread. 285 // This is bound on the worker thread.
285 mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_; 286 mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_;
286 287
287 // Renderer-side object corresponding to WebEmbeddedWorkerInstance 288 // Renderer-side object corresponding to WebEmbeddedWorkerInstance
288 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client_; 289 std::unique_ptr<EmbeddedWorkerInstanceClientImpl> embedded_worker_client_;
289 290
290 // Initialized on the worker thread in workerContextStarted and 291 // Initialized on the worker thread in workerContextStarted and
291 // destructed on the worker thread in willDestroyWorkerContext. 292 // destructed on the worker thread in willDestroyWorkerContext.
292 std::unique_ptr<WorkerContextData> context_; 293 std::unique_ptr<WorkerContextData> context_;
293 294
295 // Use this template in willDestroyWorkerContext to abort all the pending
296 // events callbacks.
297 template <typename T>
298 void AbortPendingEventCallbacks(T& x) {
299 for (typename T::iterator it(&x); !it.IsAtEnd(); it.Advance()) {
Peter Beverloo 2016/12/15 17:35:40 nit: s/x/callbacks/
xiaofengzhang 2016/12/16 02:15:49 Acknowledged.
300 it.GetCurrentValue()->Run(SERVICE_WORKER_ERROR_ABORT, base::Time::Now());
301 }
302 }
303
Peter Beverloo 2016/12/15 17:35:39 nit: I'd move this to service_worker_context_clien
xiaofengzhang 2016/12/16 02:15:49 Acknowledged.
294 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); 304 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient);
295 }; 305 };
296 306
297 } // namespace content 307 } // namespace content
298 308
299 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_ 309 #endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698