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

Unified Diff: content/child/background_sync/background_sync_provider_thread_proxy.cc

Issue 1282013004: BackgroundSyncManager tracks client registrations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and address comments from PS17 Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698