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

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: Removed test Created 5 years, 3 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 3d735fb399aaaed8dcf8db5fba774ae73e8ccd7e..cc8846cc22df8691cf6e301878bc49bcbf35c199 100644
--- a/content/child/background_sync/background_sync_provider_thread_proxy.cc
+++ b/content/child/background_sync/background_sync_provider_thread_proxy.cc
@@ -75,6 +75,24 @@ class CallbackThreadAdapter : public WebCallbacksMatcher<X>::WebCallbacks {
LazyInstance<ThreadLocalPointer<BackgroundSyncProviderThreadProxy>>::Leaky
g_sync_provider_tls = LAZY_INSTANCE_INITIALIZER;
+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())));
+}
+
} // anonymous namespace
// static
@@ -187,6 +205,24 @@ void BackgroundSyncProviderThreadProxy::getPermissionStatus(
make_scoped_ptr(callbacks), WorkerThread::GetCurrentId())));
}
+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,
+ const BackgroundSyncService::DuplicateRegistrationHandleCallback&
+ callback) {
+ main_thread_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&BackgroundSyncProvider::DuplicateRegistrationHandle,
+ base::Unretained(sync_provider_), handle_id,
+ base::Bind(&DuplicateRegistrationHandleCallbackOnMainThread,
+ WorkerThread::GetCurrentId(), callback)));
+}
+
void BackgroundSyncProviderThreadProxy::WillStopCurrentWorkerThread() {
delete this;
}

Powered by Google App Engine
This is Rietveld 408576698