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/browser/background_sync/background_sync_manager.h" | 5 #include "content/browser/background_sync/background_sync_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/barrier_closure.h" | 9 #include "base/barrier_closure.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/memory/ptr_util.h" |
12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
13 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
14 #include "base/time/default_clock.h" | 15 #include "base/time/default_clock.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "content/browser/background_sync/background_sync_metrics.h" | 17 #include "content/browser/background_sync/background_sync_metrics.h" |
17 #include "content/browser/background_sync/background_sync_network_observer.h" | 18 #include "content/browser/background_sync/background_sync_network_observer.h" |
18 #include "content/browser/background_sync/background_sync_registration_options.h
" | 19 #include "content/browser/background_sync/background_sync_registration_options.h
" |
19 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 20 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
20 #include "content/browser/service_worker/service_worker_storage.h" | 21 #include "content/browser/service_worker/service_worker_storage.h" |
21 #include "content/browser/storage_partition_impl.h" | 22 #include "content/browser/storage_partition_impl.h" |
(...skipping 17 matching lines...) Expand all Loading... |
39 const char kBackgroundSyncUserDataKey[] = "BackgroundSyncUserData"; | 40 const char kBackgroundSyncUserDataKey[] = "BackgroundSyncUserData"; |
40 | 41 |
41 void RecordFailureAndPostError( | 42 void RecordFailureAndPostError( |
42 BackgroundSyncStatus status, | 43 BackgroundSyncStatus status, |
43 const BackgroundSyncManager::StatusAndRegistrationCallback& callback) { | 44 const BackgroundSyncManager::StatusAndRegistrationCallback& callback) { |
44 BackgroundSyncMetrics::CountRegisterFailure(status); | 45 BackgroundSyncMetrics::CountRegisterFailure(status); |
45 | 46 |
46 base::ThreadTaskRunnerHandle::Get()->PostTask( | 47 base::ThreadTaskRunnerHandle::Get()->PostTask( |
47 FROM_HERE, | 48 FROM_HERE, |
48 base::Bind(callback, status, | 49 base::Bind(callback, status, |
49 base::Passed(scoped_ptr<BackgroundSyncRegistration>()))); | 50 base::Passed(std::unique_ptr<BackgroundSyncRegistration>()))); |
50 } | 51 } |
51 | 52 |
52 // Returns nullptr if the browser context cannot be accessed for any reason. | 53 // Returns nullptr if the browser context cannot be accessed for any reason. |
53 BrowserContext* GetBrowserContextOnUIThread( | 54 BrowserContext* GetBrowserContextOnUIThread( |
54 const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context) { | 55 const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context) { |
55 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 56 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
56 | 57 |
57 if (!service_worker_context) | 58 if (!service_worker_context) |
58 return nullptr; | 59 return nullptr; |
59 StoragePartitionImpl* storage_partition_impl = | 60 StoragePartitionImpl* storage_partition_impl = |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 int64_t min_ms) { | 120 int64_t min_ms) { |
120 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 121 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
121 | 122 |
122 BackgroundSyncController* background_sync_controller = | 123 BackgroundSyncController* background_sync_controller = |
123 GetBackgroundSyncControllerOnUIThread(sw_context_wrapper); | 124 GetBackgroundSyncControllerOnUIThread(sw_context_wrapper); |
124 if (background_sync_controller) { | 125 if (background_sync_controller) { |
125 background_sync_controller->RunInBackground(enabled, min_ms); | 126 background_sync_controller->RunInBackground(enabled, min_ms); |
126 } | 127 } |
127 } | 128 } |
128 | 129 |
129 scoped_ptr<BackgroundSyncParameters> GetControllerParameters( | 130 std::unique_ptr<BackgroundSyncParameters> GetControllerParameters( |
130 const scoped_refptr<ServiceWorkerContextWrapper>& sw_context_wrapper, | 131 const scoped_refptr<ServiceWorkerContextWrapper>& sw_context_wrapper, |
131 scoped_ptr<BackgroundSyncParameters> parameters) { | 132 std::unique_ptr<BackgroundSyncParameters> parameters) { |
132 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 133 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
133 | 134 |
134 BackgroundSyncController* background_sync_controller = | 135 BackgroundSyncController* background_sync_controller = |
135 GetBackgroundSyncControllerOnUIThread(sw_context_wrapper); | 136 GetBackgroundSyncControllerOnUIThread(sw_context_wrapper); |
136 | 137 |
137 if (!background_sync_controller) { | 138 if (!background_sync_controller) { |
138 // If there is no controller then BackgroundSync can't run in the | 139 // If there is no controller then BackgroundSync can't run in the |
139 // background, disable it. | 140 // background, disable it. |
140 parameters->disable = true; | 141 parameters->disable = true; |
141 return parameters; | 142 return parameters; |
(...skipping 24 matching lines...) Expand all Loading... |
166 } | 167 } |
167 | 168 |
168 BackgroundSyncManager::BackgroundSyncRegistrations::BackgroundSyncRegistrations( | 169 BackgroundSyncManager::BackgroundSyncRegistrations::BackgroundSyncRegistrations( |
169 const BackgroundSyncRegistrations& other) = default; | 170 const BackgroundSyncRegistrations& other) = default; |
170 | 171 |
171 BackgroundSyncManager::BackgroundSyncRegistrations:: | 172 BackgroundSyncManager::BackgroundSyncRegistrations:: |
172 ~BackgroundSyncRegistrations() { | 173 ~BackgroundSyncRegistrations() { |
173 } | 174 } |
174 | 175 |
175 // static | 176 // static |
176 scoped_ptr<BackgroundSyncManager> BackgroundSyncManager::Create( | 177 std::unique_ptr<BackgroundSyncManager> BackgroundSyncManager::Create( |
177 const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context) { | 178 const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context) { |
178 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 179 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
179 | 180 |
180 BackgroundSyncManager* sync_manager = | 181 BackgroundSyncManager* sync_manager = |
181 new BackgroundSyncManager(service_worker_context); | 182 new BackgroundSyncManager(service_worker_context); |
182 sync_manager->Init(); | 183 sync_manager->Init(); |
183 return make_scoped_ptr(sync_manager); | 184 return base::WrapUnique(sync_manager); |
184 } | 185 } |
185 | 186 |
186 BackgroundSyncManager::~BackgroundSyncManager() { | 187 BackgroundSyncManager::~BackgroundSyncManager() { |
187 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 188 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
188 | 189 |
189 service_worker_context_->RemoveObserver(this); | 190 service_worker_context_->RemoveObserver(this); |
190 } | 191 } |
191 | 192 |
192 void BackgroundSyncManager::Register( | 193 void BackgroundSyncManager::Register( |
193 int64_t sw_registration_id, | 194 int64_t sw_registration_id, |
(...skipping 15 matching lines...) Expand all Loading... |
209 void BackgroundSyncManager::GetRegistrations( | 210 void BackgroundSyncManager::GetRegistrations( |
210 int64_t sw_registration_id, | 211 int64_t sw_registration_id, |
211 const StatusAndRegistrationsCallback& callback) { | 212 const StatusAndRegistrationsCallback& callback) { |
212 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 213 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
213 | 214 |
214 if (disabled_) { | 215 if (disabled_) { |
215 base::ThreadTaskRunnerHandle::Get()->PostTask( | 216 base::ThreadTaskRunnerHandle::Get()->PostTask( |
216 FROM_HERE, | 217 FROM_HERE, |
217 base::Bind( | 218 base::Bind( |
218 callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR, | 219 callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR, |
219 base::Passed(scoped_ptr<ScopedVector<BackgroundSyncRegistration>>( | 220 base::Passed( |
220 new ScopedVector<BackgroundSyncRegistration>())))); | 221 std::unique_ptr<ScopedVector<BackgroundSyncRegistration>>( |
| 222 new ScopedVector<BackgroundSyncRegistration>())))); |
221 return; | 223 return; |
222 } | 224 } |
223 | 225 |
224 op_scheduler_.ScheduleOperation( | 226 op_scheduler_.ScheduleOperation( |
225 base::Bind(&BackgroundSyncManager::GetRegistrationsImpl, | 227 base::Bind(&BackgroundSyncManager::GetRegistrationsImpl, |
226 weak_ptr_factory_.GetWeakPtr(), sw_registration_id, | 228 weak_ptr_factory_.GetWeakPtr(), sw_registration_id, |
227 MakeStatusAndRegistrationsCompletion(callback))); | 229 MakeStatusAndRegistrationsCompletion(callback))); |
228 } | 230 } |
229 | 231 |
230 void BackgroundSyncManager::OnRegistrationDeleted(int64_t sw_registration_id, | 232 void BackgroundSyncManager::OnRegistrationDeleted(int64_t sw_registration_id, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 295 |
294 void BackgroundSyncManager::InitImpl(const base::Closure& callback) { | 296 void BackgroundSyncManager::InitImpl(const base::Closure& callback) { |
295 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 297 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
296 | 298 |
297 if (disabled_) { | 299 if (disabled_) { |
298 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 300 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
299 base::Bind(callback)); | 301 base::Bind(callback)); |
300 return; | 302 return; |
301 } | 303 } |
302 | 304 |
303 scoped_ptr<BackgroundSyncParameters> parameters_copy( | 305 std::unique_ptr<BackgroundSyncParameters> parameters_copy( |
304 new BackgroundSyncParameters(*parameters_)); | 306 new BackgroundSyncParameters(*parameters_)); |
305 | 307 |
306 BrowserThread::PostTaskAndReplyWithResult( | 308 BrowserThread::PostTaskAndReplyWithResult( |
307 BrowserThread::UI, FROM_HERE, | 309 BrowserThread::UI, FROM_HERE, |
308 base::Bind(&GetControllerParameters, service_worker_context_, | 310 base::Bind(&GetControllerParameters, service_worker_context_, |
309 base::Passed(std::move(parameters_copy))), | 311 base::Passed(std::move(parameters_copy))), |
310 base::Bind(&BackgroundSyncManager::InitDidGetControllerParameters, | 312 base::Bind(&BackgroundSyncManager::InitDidGetControllerParameters, |
311 weak_ptr_factory_.GetWeakPtr(), callback)); | 313 weak_ptr_factory_.GetWeakPtr(), callback)); |
312 } | 314 } |
313 | 315 |
314 void BackgroundSyncManager::InitDidGetControllerParameters( | 316 void BackgroundSyncManager::InitDidGetControllerParameters( |
315 const base::Closure& callback, | 317 const base::Closure& callback, |
316 scoped_ptr<BackgroundSyncParameters> updated_parameters) { | 318 std::unique_ptr<BackgroundSyncParameters> updated_parameters) { |
317 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 319 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
318 | 320 |
319 parameters_ = std::move(updated_parameters); | 321 parameters_ = std::move(updated_parameters); |
320 if (parameters_->disable) { | 322 if (parameters_->disable) { |
321 disabled_ = true; | 323 disabled_ = true; |
322 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 324 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
323 base::Bind(callback)); | 325 base::Bind(callback)); |
324 return; | 326 return; |
325 } | 327 } |
326 | 328 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 BackgroundSyncMetrics::REGISTRATION_IS_DUPLICATE); | 504 BackgroundSyncMetrics::REGISTRATION_IS_DUPLICATE); |
503 | 505 |
504 if (existing_registration->IsFiring()) { | 506 if (existing_registration->IsFiring()) { |
505 existing_registration->set_sync_state( | 507 existing_registration->set_sync_state( |
506 mojom::BackgroundSyncState::REREGISTERED_WHILE_FIRING); | 508 mojom::BackgroundSyncState::REREGISTERED_WHILE_FIRING); |
507 } | 509 } |
508 | 510 |
509 base::ThreadTaskRunnerHandle::Get()->PostTask( | 511 base::ThreadTaskRunnerHandle::Get()->PostTask( |
510 FROM_HERE, | 512 FROM_HERE, |
511 base::Bind(callback, BACKGROUND_SYNC_STATUS_OK, | 513 base::Bind(callback, BACKGROUND_SYNC_STATUS_OK, |
512 base::Passed(make_scoped_ptr(new BackgroundSyncRegistration( | 514 base::Passed(base::WrapUnique(new BackgroundSyncRegistration( |
513 *existing_registration))))); | 515 *existing_registration))))); |
514 return; | 516 return; |
515 } | 517 } |
516 | 518 |
517 BackgroundSyncRegistration new_registration; | 519 BackgroundSyncRegistration new_registration; |
518 | 520 |
519 *new_registration.options() = options; | 521 *new_registration.options() = options; |
520 | 522 |
521 BackgroundSyncRegistrations* registrations = | 523 BackgroundSyncRegistrations* registrations = |
522 &active_registrations_[sw_registration_id]; | 524 &active_registrations_[sw_registration_id]; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 active_registrations_.erase(sw_registration_id); | 657 active_registrations_.erase(sw_registration_id); |
656 RecordFailureAndPostError(BACKGROUND_SYNC_STATUS_STORAGE_ERROR, callback); | 658 RecordFailureAndPostError(BACKGROUND_SYNC_STATUS_STORAGE_ERROR, callback); |
657 return; | 659 return; |
658 } | 660 } |
659 | 661 |
660 if (status != SERVICE_WORKER_OK) { | 662 if (status != SERVICE_WORKER_OK) { |
661 LOG(ERROR) << "BackgroundSync failed to store registration due to backend " | 663 LOG(ERROR) << "BackgroundSync failed to store registration due to backend " |
662 "failure."; | 664 "failure."; |
663 BackgroundSyncMetrics::CountRegisterFailure( | 665 BackgroundSyncMetrics::CountRegisterFailure( |
664 BACKGROUND_SYNC_STATUS_STORAGE_ERROR); | 666 BACKGROUND_SYNC_STATUS_STORAGE_ERROR); |
665 DisableAndClearManager( | 667 DisableAndClearManager(base::Bind( |
666 base::Bind(callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR, | 668 callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR, |
667 base::Passed(scoped_ptr<BackgroundSyncRegistration>()))); | 669 base::Passed(std::unique_ptr<BackgroundSyncRegistration>()))); |
668 return; | 670 return; |
669 } | 671 } |
670 | 672 |
671 BackgroundSyncMetrics::RegistrationCouldFire registration_could_fire = | 673 BackgroundSyncMetrics::RegistrationCouldFire registration_could_fire = |
672 AreOptionConditionsMet(*new_registration.options()) | 674 AreOptionConditionsMet(*new_registration.options()) |
673 ? BackgroundSyncMetrics::REGISTRATION_COULD_FIRE | 675 ? BackgroundSyncMetrics::REGISTRATION_COULD_FIRE |
674 : BackgroundSyncMetrics::REGISTRATION_COULD_NOT_FIRE; | 676 : BackgroundSyncMetrics::REGISTRATION_COULD_NOT_FIRE; |
675 BackgroundSyncMetrics::CountRegisterSuccess( | 677 BackgroundSyncMetrics::CountRegisterSuccess( |
676 registration_could_fire, | 678 registration_could_fire, |
677 BackgroundSyncMetrics::REGISTRATION_IS_NOT_DUPLICATE); | 679 BackgroundSyncMetrics::REGISTRATION_IS_NOT_DUPLICATE); |
678 | 680 |
679 FireReadyEvents(); | 681 FireReadyEvents(); |
680 | 682 |
681 base::ThreadTaskRunnerHandle::Get()->PostTask( | 683 base::ThreadTaskRunnerHandle::Get()->PostTask( |
682 FROM_HERE, | 684 FROM_HERE, |
683 base::Bind(callback, BACKGROUND_SYNC_STATUS_OK, | 685 base::Bind(callback, BACKGROUND_SYNC_STATUS_OK, |
684 base::Passed(make_scoped_ptr( | 686 base::Passed(base::WrapUnique( |
685 new BackgroundSyncRegistration(new_registration))))); | 687 new BackgroundSyncRegistration(new_registration))))); |
686 } | 688 } |
687 | 689 |
688 void BackgroundSyncManager::RemoveActiveRegistration(int64_t sw_registration_id, | 690 void BackgroundSyncManager::RemoveActiveRegistration(int64_t sw_registration_id, |
689 const std::string& tag) { | 691 const std::string& tag) { |
690 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 692 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
691 DCHECK(LookupActiveRegistration(sw_registration_id, tag)); | 693 DCHECK(LookupActiveRegistration(sw_registration_id, tag)); |
692 | 694 |
693 BackgroundSyncRegistrations* registrations = | 695 BackgroundSyncRegistrations* registrations = |
694 &active_registrations_[sw_registration_id]; | 696 &active_registrations_[sw_registration_id]; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 const GURL& origin, | 777 const GURL& origin, |
776 const BoolCallback& callback) { | 778 const BoolCallback& callback) { |
777 service_worker_context_->HasMainFrameProviderHost(origin, callback); | 779 service_worker_context_->HasMainFrameProviderHost(origin, callback); |
778 } | 780 } |
779 | 781 |
780 void BackgroundSyncManager::GetRegistrationsImpl( | 782 void BackgroundSyncManager::GetRegistrationsImpl( |
781 int64_t sw_registration_id, | 783 int64_t sw_registration_id, |
782 const StatusAndRegistrationsCallback& callback) { | 784 const StatusAndRegistrationsCallback& callback) { |
783 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 785 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
784 | 786 |
785 scoped_ptr<ScopedVector<BackgroundSyncRegistration>> out_registrations( | 787 std::unique_ptr<ScopedVector<BackgroundSyncRegistration>> out_registrations( |
786 new ScopedVector<BackgroundSyncRegistration>()); | 788 new ScopedVector<BackgroundSyncRegistration>()); |
787 | 789 |
788 if (disabled_) { | 790 if (disabled_) { |
789 base::ThreadTaskRunnerHandle::Get()->PostTask( | 791 base::ThreadTaskRunnerHandle::Get()->PostTask( |
790 FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR, | 792 FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR, |
791 base::Passed(std::move(out_registrations)))); | 793 base::Passed(std::move(out_registrations)))); |
792 return; | 794 return; |
793 } | 795 } |
794 | 796 |
795 SWIdToRegistrationsMap::iterator it = | 797 SWIdToRegistrationsMap::iterator it = |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 Params... parameters) { | 1180 Params... parameters) { |
1179 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1181 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1180 | 1182 |
1181 callback.Run(parameters...); | 1183 callback.Run(parameters...); |
1182 op_scheduler_.CompleteOperationAndRunNext(); | 1184 op_scheduler_.CompleteOperationAndRunNext(); |
1183 } | 1185 } |
1184 | 1186 |
1185 void BackgroundSyncManager::CompleteStatusAndRegistrationCallback( | 1187 void BackgroundSyncManager::CompleteStatusAndRegistrationCallback( |
1186 StatusAndRegistrationCallback callback, | 1188 StatusAndRegistrationCallback callback, |
1187 BackgroundSyncStatus status, | 1189 BackgroundSyncStatus status, |
1188 scoped_ptr<BackgroundSyncRegistration> registration) { | 1190 std::unique_ptr<BackgroundSyncRegistration> registration) { |
1189 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1191 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1190 | 1192 |
1191 callback.Run(status, std::move(registration)); | 1193 callback.Run(status, std::move(registration)); |
1192 op_scheduler_.CompleteOperationAndRunNext(); | 1194 op_scheduler_.CompleteOperationAndRunNext(); |
1193 } | 1195 } |
1194 | 1196 |
1195 void BackgroundSyncManager::CompleteStatusAndRegistrationsCallback( | 1197 void BackgroundSyncManager::CompleteStatusAndRegistrationsCallback( |
1196 StatusAndRegistrationsCallback callback, | 1198 StatusAndRegistrationsCallback callback, |
1197 BackgroundSyncStatus status, | 1199 BackgroundSyncStatus status, |
1198 scoped_ptr<ScopedVector<BackgroundSyncRegistration>> registrations) { | 1200 std::unique_ptr<ScopedVector<BackgroundSyncRegistration>> registrations) { |
1199 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1201 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1200 | 1202 |
1201 callback.Run(status, std::move(registrations)); | 1203 callback.Run(status, std::move(registrations)); |
1202 op_scheduler_.CompleteOperationAndRunNext(); | 1204 op_scheduler_.CompleteOperationAndRunNext(); |
1203 } | 1205 } |
1204 | 1206 |
1205 base::Closure BackgroundSyncManager::MakeEmptyCompletion() { | 1207 base::Closure BackgroundSyncManager::MakeEmptyCompletion() { |
1206 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1208 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1207 | 1209 |
1208 return MakeClosureCompletion(base::Bind(base::DoNothing)); | 1210 return MakeClosureCompletion(base::Bind(base::DoNothing)); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 BackgroundSyncManager::MakeStatusCompletion(const StatusCallback& callback) { | 1243 BackgroundSyncManager::MakeStatusCompletion(const StatusCallback& callback) { |
1242 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1244 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1243 | 1245 |
1244 return base::Bind( | 1246 return base::Bind( |
1245 &BackgroundSyncManager::CompleteOperationCallback<StatusCallback, | 1247 &BackgroundSyncManager::CompleteOperationCallback<StatusCallback, |
1246 BackgroundSyncStatus>, | 1248 BackgroundSyncStatus>, |
1247 weak_ptr_factory_.GetWeakPtr(), callback); | 1249 weak_ptr_factory_.GetWeakPtr(), callback); |
1248 } | 1250 } |
1249 | 1251 |
1250 } // namespace content | 1252 } // namespace content |
OLD | NEW |