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..9b4c3b2230be9de49b92074759c6931b88ddea65 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* web_sync_provider = |
| + blink::Platform::current()->backgroundSyncProvider(); |
| + DCHECK(web_sync_provider); |
| + |
| + // trackRegistration takes ownership of web_registration. |
| + web_sync_provider->trackRegistration(web_registration.release()); |
|
michaeln
2015/08/21 02:39:25
track is an odd verb? take adopt acquire grab?
jkarlin
2015/08/25 17:32:59
went with DuplicateRegistrationHandle
|
| + |
| + client->DispatchSyncEvent(registration_copy, callback); |
| } |
| } // namespace content |