| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/child/background_sync/background_sync_provider_thread_proxy.h" | 5 #include "content/child/background_sync/background_sync_provider_thread_proxy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 BackgroundSyncProviderThreadProxy* instance = | 94 BackgroundSyncProviderThreadProxy* instance = |
| 95 new BackgroundSyncProviderThreadProxy(main_thread_task_runner, | 95 new BackgroundSyncProviderThreadProxy(main_thread_task_runner, |
| 96 sync_provider); | 96 sync_provider); |
| 97 WorkerTaskRunner::Instance()->AddStopObserver(instance); | 97 WorkerTaskRunner::Instance()->AddStopObserver(instance); |
| 98 return instance; | 98 return instance; |
| 99 } | 99 } |
| 100 | 100 |
| 101 void BackgroundSyncProviderThreadProxy::registerBackgroundSync( | 101 void BackgroundSyncProviderThreadProxy::registerBackgroundSync( |
| 102 const blink::WebSyncRegistration* options, | 102 const blink::WebSyncRegistration* options, |
| 103 blink::WebServiceWorkerRegistration* service_worker_registration, | 103 blink::WebServiceWorkerRegistration* service_worker_registration, |
| 104 bool requested_from_service_worker, | |
| 105 blink::WebSyncRegistrationCallbacks* callbacks) { | 104 blink::WebSyncRegistrationCallbacks* callbacks) { |
| 106 DCHECK(options); | 105 DCHECK(options); |
| 107 DCHECK(service_worker_registration); | 106 DCHECK(service_worker_registration); |
| 108 DCHECK(callbacks); | 107 DCHECK(callbacks); |
| 109 main_thread_task_runner_->PostTask( | 108 main_thread_task_runner_->PostTask( |
| 110 FROM_HERE, | 109 FROM_HERE, |
| 111 base::Bind(&BackgroundSyncProvider::registerBackgroundSync, | 110 base::Bind(&BackgroundSyncProvider::registerBackgroundSync, |
| 112 base::Unretained(sync_provider_), options, | 111 base::Unretained(sync_provider_), options, |
| 113 service_worker_registration, requested_from_service_worker, | 112 service_worker_registration, |
| 114 new CallbackThreadAdapter<blink::WebSyncRegistrationCallbacks>( | 113 new CallbackThreadAdapter<blink::WebSyncRegistrationCallbacks>( |
| 115 make_scoped_ptr(callbacks), | 114 make_scoped_ptr(callbacks), |
| 116 WorkerTaskRunner::Instance()->CurrentWorkerId()))); | 115 WorkerTaskRunner::Instance()->CurrentWorkerId()))); |
| 117 } | 116 } |
| 118 | 117 |
| 119 void BackgroundSyncProviderThreadProxy::unregisterBackgroundSync( | 118 void BackgroundSyncProviderThreadProxy::unregisterBackgroundSync( |
| 120 blink::WebSyncRegistration::Periodicity periodicity, | 119 blink::WebSyncRegistration::Periodicity periodicity, |
| 121 int64_t id, | 120 int64_t id, |
| 122 const blink::WebString& tag, | 121 const blink::WebString& tag, |
| 123 blink::WebServiceWorkerRegistration* service_worker_registration, | 122 blink::WebServiceWorkerRegistration* service_worker_registration, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 : main_thread_task_runner_(main_thread_task_runner), | 199 : main_thread_task_runner_(main_thread_task_runner), |
| 201 sync_provider_(sync_provider) { | 200 sync_provider_(sync_provider) { |
| 202 g_sync_provider_tls.Pointer()->Set(this); | 201 g_sync_provider_tls.Pointer()->Set(this); |
| 203 } | 202 } |
| 204 | 203 |
| 205 BackgroundSyncProviderThreadProxy::~BackgroundSyncProviderThreadProxy() { | 204 BackgroundSyncProviderThreadProxy::~BackgroundSyncProviderThreadProxy() { |
| 206 g_sync_provider_tls.Pointer()->Set(nullptr); | 205 g_sync_provider_tls.Pointer()->Set(nullptr); |
| 207 } | 206 } |
| 208 | 207 |
| 209 } // namespace content | 208 } // namespace content |
| OLD | NEW |