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

Side by Side Diff: content/renderer/background_sync/background_sync_client_impl.cc

Issue 1230213004: [Background Sync] Sent sync registration details to worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bgsync-event-mek
Patch Set: Validate safety of static_casts Created 5 years, 5 months 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "content/renderer/background_sync/background_sync_client_impl.h" 5 #include "content/renderer/background_sync/background_sync_client_impl.h"
6 6
7 #include "content/child/background_sync/background_sync_type_converters.h"
7 #include "content/renderer/service_worker/service_worker_context_client.h" 8 #include "content/renderer/service_worker/service_worker_context_client.h"
9 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi stration.h"
8 10
9 namespace content { 11 namespace content {
10 12
11 // static 13 // static
12 void BackgroundSyncClientImpl::Create( 14 void BackgroundSyncClientImpl::Create(
13 mojo::InterfaceRequest<BackgroundSyncServiceClient> request) { 15 mojo::InterfaceRequest<BackgroundSyncServiceClient> request) {
14 new BackgroundSyncClientImpl(request.Pass()); 16 new BackgroundSyncClientImpl(request.Pass());
15 } 17 }
16 18
17 BackgroundSyncClientImpl::~BackgroundSyncClientImpl() { 19 BackgroundSyncClientImpl::~BackgroundSyncClientImpl() {
18 } 20 }
19 21
20 BackgroundSyncClientImpl::BackgroundSyncClientImpl( 22 BackgroundSyncClientImpl::BackgroundSyncClientImpl(
21 mojo::InterfaceRequest<BackgroundSyncServiceClient> request) 23 mojo::InterfaceRequest<BackgroundSyncServiceClient> request)
22 : binding_(this, request.Pass()) { 24 : binding_(this, request.Pass()) {
23 } 25 }
24 26
25 void BackgroundSyncClientImpl::Sync(content::SyncRegistrationPtr registration, 27 void BackgroundSyncClientImpl::Sync(content::SyncRegistrationPtr registration,
26 const SyncCallback& callback) { 28 const SyncCallback& callback) {
27 ServiceWorkerContextClient* client = 29 ServiceWorkerContextClient* client =
28 ServiceWorkerContextClient::ThreadSpecificInstance(); 30 ServiceWorkerContextClient::ThreadSpecificInstance();
29 if (!client) { 31 if (!client) {
30 callback.Run(SERVICE_WORKER_EVENT_STATUS_ABORTED); 32 callback.Run(SERVICE_WORKER_EVENT_STATUS_ABORTED);
31 return; 33 return;
32 } 34 }
33 client->DispatchSyncEvent(callback); 35 scoped_ptr<blink::WebSyncRegistration> reg =
36 mojo::ConvertTo<scoped_ptr<blink::WebSyncRegistration>>(registration);
37 client->DispatchSyncEvent(*reg, callback);
34 } 38 }
35 39
36 } // namespace content 40 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698