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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 FROM_HERE, | 169 FROM_HERE, |
170 base::Bind(&BackgroundSyncProvider::getPermissionStatus, | 170 base::Bind(&BackgroundSyncProvider::getPermissionStatus, |
171 base::Unretained(sync_provider_), periodicity, | 171 base::Unretained(sync_provider_), periodicity, |
172 service_worker_registration, | 172 service_worker_registration, |
173 new CallbackThreadAdapter<blink::WebSyncPermissionStatus*, | 173 new CallbackThreadAdapter<blink::WebSyncPermissionStatus*, |
174 blink::WebSyncError*>( | 174 blink::WebSyncError*>( |
175 make_scoped_ptr(callbacks), | 175 make_scoped_ptr(callbacks), |
176 WorkerTaskRunner::Instance()->CurrentWorkerId()))); | 176 WorkerTaskRunner::Instance()->CurrentWorkerId()))); |
177 } | 177 } |
178 | 178 |
179 void BackgroundSyncProviderThreadProxy::trackRegistration( | |
michaeln
2015/08/21 02:39:25
adoptRegistrationHandle(handle_id)
jkarlin
2015/08/25 17:32:58
Changed to "GetRegistrationForHandleId" as it now
| |
180 blink::WebSyncRegistration* registration) { | |
181 main_thread_task_runner_->PostTask( | |
182 FROM_HERE, base::Bind(&BackgroundSyncProvider::trackRegistration, | |
183 base::Unretained(sync_provider_), registration)); | |
michaeln
2015/08/21 02:39:25
it'd be good to indicate xfer of ownership of |reg
jkarlin
2015/08/25 17:32:58
OBE. The new method takes a HandleId.
| |
184 } | |
185 | |
186 void BackgroundSyncProviderThreadProxy::releaseRegistration(int64_t sync_id) { | |
michaeln
2015/08/21 02:39:25
releaseRegistrationHandle(handle_id)
jkarlin
2015/08/25 17:32:58
Changed sync_id to handle_id. Added a TODO to upda
| |
187 main_thread_task_runner_->PostTask( | |
188 FROM_HERE, base::Bind(&BackgroundSyncProvider::releaseRegistration, | |
189 base::Unretained(sync_provider_), sync_id)); | |
190 } | |
191 | |
179 void BackgroundSyncProviderThreadProxy::OnWorkerRunLoopStopped() { | 192 void BackgroundSyncProviderThreadProxy::OnWorkerRunLoopStopped() { |
180 delete this; | 193 delete this; |
181 } | 194 } |
182 | 195 |
183 BackgroundSyncProviderThreadProxy::BackgroundSyncProviderThreadProxy( | 196 BackgroundSyncProviderThreadProxy::BackgroundSyncProviderThreadProxy( |
184 base::SingleThreadTaskRunner* main_thread_task_runner, | 197 base::SingleThreadTaskRunner* main_thread_task_runner, |
185 BackgroundSyncProvider* sync_provider) | 198 BackgroundSyncProvider* sync_provider) |
186 : main_thread_task_runner_(main_thread_task_runner), | 199 : main_thread_task_runner_(main_thread_task_runner), |
187 sync_provider_(sync_provider) { | 200 sync_provider_(sync_provider) { |
188 g_sync_provider_tls.Pointer()->Set(this); | 201 g_sync_provider_tls.Pointer()->Set(this); |
189 } | 202 } |
190 | 203 |
191 BackgroundSyncProviderThreadProxy::~BackgroundSyncProviderThreadProxy() { | 204 BackgroundSyncProviderThreadProxy::~BackgroundSyncProviderThreadProxy() { |
192 g_sync_provider_tls.Pointer()->Set(nullptr); | 205 g_sync_provider_tls.Pointer()->Set(nullptr); |
193 } | 206 } |
194 | 207 |
195 } // namespace content | 208 } // namespace content |
OLD | NEW |