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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 FROM_HERE, | 163 FROM_HERE, |
164 base::Bind(&BackgroundSyncProvider::getPermissionStatus, | 164 base::Bind(&BackgroundSyncProvider::getPermissionStatus, |
165 base::Unretained(sync_provider_), periodicity, | 165 base::Unretained(sync_provider_), periodicity, |
166 service_worker_registration, | 166 service_worker_registration, |
167 new CallbackThreadAdapter<blink::WebSyncPermissionStatus*, | 167 new CallbackThreadAdapter<blink::WebSyncPermissionStatus*, |
168 blink::WebSyncError*>( | 168 blink::WebSyncError*>( |
169 make_scoped_ptr(callbacks), | 169 make_scoped_ptr(callbacks), |
170 WorkerTaskRunner::Instance()->CurrentWorkerId()))); | 170 WorkerTaskRunner::Instance()->CurrentWorkerId()))); |
171 } | 171 } |
172 | 172 |
| 173 void BackgroundSyncProviderThreadProxy::trackRegistration( |
| 174 blink::WebSyncRegistration* registration) { |
| 175 main_thread_task_runner_->PostTask( |
| 176 FROM_HERE, base::Bind(&BackgroundSyncProvider::trackRegistration, |
| 177 base::Unretained(sync_provider_), registration)); |
| 178 } |
| 179 |
| 180 void BackgroundSyncProviderThreadProxy::releaseRegistration(int64_t sync_id) { |
| 181 main_thread_task_runner_->PostTask( |
| 182 FROM_HERE, base::Bind(&BackgroundSyncProvider::releaseRegistration, |
| 183 base::Unretained(sync_provider_), sync_id)); |
| 184 } |
| 185 |
173 void BackgroundSyncProviderThreadProxy::OnWorkerRunLoopStopped() { | 186 void BackgroundSyncProviderThreadProxy::OnWorkerRunLoopStopped() { |
174 delete this; | 187 delete this; |
175 } | 188 } |
176 | 189 |
177 BackgroundSyncProviderThreadProxy::BackgroundSyncProviderThreadProxy( | 190 BackgroundSyncProviderThreadProxy::BackgroundSyncProviderThreadProxy( |
178 base::SingleThreadTaskRunner* main_thread_task_runner, | 191 base::SingleThreadTaskRunner* main_thread_task_runner, |
179 BackgroundSyncProvider* sync_provider) | 192 BackgroundSyncProvider* sync_provider) |
180 : main_thread_task_runner_(main_thread_task_runner), | 193 : main_thread_task_runner_(main_thread_task_runner), |
181 sync_provider_(sync_provider) { | 194 sync_provider_(sync_provider) { |
182 g_sync_provider_tls.Pointer()->Set(this); | 195 g_sync_provider_tls.Pointer()->Set(this); |
183 } | 196 } |
184 | 197 |
185 BackgroundSyncProviderThreadProxy::~BackgroundSyncProviderThreadProxy() { | 198 BackgroundSyncProviderThreadProxy::~BackgroundSyncProviderThreadProxy() { |
186 g_sync_provider_tls.Pointer()->Set(nullptr); | 199 g_sync_provider_tls.Pointer()->Set(nullptr); |
187 } | 200 } |
188 | 201 |
189 } // namespace content | 202 } // namespace content |
OLD | NEW |