Index: content/child/background_sync/background_sync_provider_thread_proxy.cc |
diff --git a/content/child/background_sync/background_sync_provider_thread_proxy.cc b/content/child/background_sync/background_sync_provider_thread_proxy.cc |
index 97466b23bf18dc84ee0787d8d4c817ea9fda156a..246e4cfdfe5e6ca13008fd2e2a828ecbb67431bd 100644 |
--- a/content/child/background_sync/background_sync_provider_thread_proxy.cc |
+++ b/content/child/background_sync/background_sync_provider_thread_proxy.cc |
@@ -20,6 +20,24 @@ namespace content { |
namespace { |
+void DuplicateRegistrationHandleCallbackOnSWThread( |
+ const BackgroundSyncService::DuplicateRegistrationHandleCallback& callback, |
+ BackgroundSyncError error, |
+ SyncRegistrationPtr registration) { |
+ callback.Run(error, registration.Pass()); |
+} |
+ |
+void DuplicateRegistrationHandleCallbackOnMainThread( |
+ int worker_thread_id, |
+ const BackgroundSyncService::DuplicateRegistrationHandleCallback& callback, |
+ BackgroundSyncError error, |
+ SyncRegistrationPtr registration) { |
+ WorkerTaskRunner::Instance()->PostTask( |
+ worker_thread_id, |
+ base::Bind(&DuplicateRegistrationHandleCallbackOnSWThread, callback, |
+ error, base::Passed(registration.Pass()))); |
+} |
+ |
// CallbackThreadAdapter<S,T> is a wrapper for WebCallbacks<S,T> which |
// switches to a specific thread before calling the wrapped callback's |
// onSuccess or onError methods. |
@@ -176,6 +194,27 @@ void BackgroundSyncProviderThreadProxy::getPermissionStatus( |
WorkerTaskRunner::Instance()->CurrentWorkerId()))); |
} |
+void BackgroundSyncProviderThreadProxy::releaseRegistration(int64_t handle_id) { |
+ main_thread_task_runner_->PostTask( |
+ FROM_HERE, base::Bind(&BackgroundSyncProvider::releaseRegistration, |
+ base::Unretained(sync_provider_), handle_id)); |
+} |
+ |
+void BackgroundSyncProviderThreadProxy::DuplicateRegistrationHandle( |
+ int64 handle_id, |
+ int64 service_worker_registration_id, |
+ const BackgroundSyncService::DuplicateRegistrationHandleCallback& |
+ callback) { |
+ main_thread_task_runner_->PostTask( |
+ FROM_HERE, |
+ base::Bind(&BackgroundSyncProvider::DuplicateRegistrationHandle, |
+ base::Unretained(sync_provider_), handle_id, |
+ service_worker_registration_id, |
+ base::Bind(&DuplicateRegistrationHandleCallbackOnMainThread, |
+ WorkerTaskRunner::Instance()->CurrentWorkerId(), |
+ callback))); |
+} |
+ |
void BackgroundSyncProviderThreadProxy::OnWorkerRunLoopStopped() { |
delete this; |
} |