Chromium Code Reviews| Index: content/renderer/background_sync/background_sync_client_impl.cc |
| diff --git a/content/renderer/background_sync/background_sync_client_impl.cc b/content/renderer/background_sync/background_sync_client_impl.cc |
| index 2eb1c40019da279279e19a5813eef0786524426b..14ac20c95d5948c608df2c1a34adc8fd14fb5a7f 100644 |
| --- a/content/renderer/background_sync/background_sync_client_impl.cc |
| +++ b/content/renderer/background_sync/background_sync_client_impl.cc |
| @@ -6,6 +6,8 @@ |
| #include "content/child/background_sync/background_sync_type_converters.h" |
| #include "content/renderer/service_worker/service_worker_context_client.h" |
| +#include "third_party/WebKit/public/platform/Platform.h" |
| +#include "third_party/WebKit/public/platform/modules/background_sync/WebSyncProvider.h" |
| #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegistration.h" |
| namespace content { |
| @@ -30,9 +32,22 @@ void BackgroundSyncClientImpl::Sync(content::SyncRegistrationPtr registration, |
| callback.Run(SERVICE_WORKER_EVENT_STATUS_ABORTED); |
| return; |
| } |
| - scoped_ptr<blink::WebSyncRegistration> reg = |
| + |
| + scoped_ptr<blink::WebSyncRegistration> web_registration = |
| mojo::ConvertTo<scoped_ptr<blink::WebSyncRegistration>>(registration); |
| - client->DispatchSyncEvent(*reg, callback); |
| + |
| + blink::WebSyncRegistration registration_copy = *web_registration; |
| + |
| + // The BackgroundSyncServiceImpl doesn't know about this registration yet, |
| + // inform it via trackRegistration. |
| + blink::WebSyncProvider* webSyncProvider = |
|
michaeln
2015/08/19 01:56:01
style nit: !camel_case
jkarlin
2015/08/19 12:47:06
Done.
|
| + blink::Platform::current()->backgroundSyncProvider(); |
| + DCHECK(webSyncProvider); |
| + |
| + // trackRegistration takes ownership of web_registration. |
| + webSyncProvider->trackRegistration(web_registration.release()); |
| + |
| + client->DispatchSyncEvent(registration_copy, callback); |
| } |
| } // namespace content |