| 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" |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 } | 680 } |
| 681 | 681 |
| 682 BackgroundSyncMetrics::RegistrationCouldFire registration_could_fire = | 682 BackgroundSyncMetrics::RegistrationCouldFire registration_could_fire = |
| 683 AreOptionConditionsMet(*new_registration.options()) | 683 AreOptionConditionsMet(*new_registration.options()) |
| 684 ? BackgroundSyncMetrics::REGISTRATION_COULD_FIRE | 684 ? BackgroundSyncMetrics::REGISTRATION_COULD_FIRE |
| 685 : BackgroundSyncMetrics::REGISTRATION_COULD_NOT_FIRE; | 685 : BackgroundSyncMetrics::REGISTRATION_COULD_NOT_FIRE; |
| 686 BackgroundSyncMetrics::CountRegisterSuccess( | 686 BackgroundSyncMetrics::CountRegisterSuccess( |
| 687 registration_could_fire, | 687 registration_could_fire, |
| 688 BackgroundSyncMetrics::REGISTRATION_IS_NOT_DUPLICATE); | 688 BackgroundSyncMetrics::REGISTRATION_IS_NOT_DUPLICATE); |
| 689 | 689 |
| 690 FireReadyEvents(); | 690 base::ThreadTaskRunnerHandle::Get()->PostTaskAndReply( |
| 691 | |
| 692 base::ThreadTaskRunnerHandle::Get()->PostTask( | |
| 693 FROM_HERE, | 691 FROM_HERE, |
| 694 base::Bind(callback, BACKGROUND_SYNC_STATUS_OK, | 692 base::Bind(callback, BACKGROUND_SYNC_STATUS_OK, |
| 695 base::Passed(base::MakeUnique<BackgroundSyncRegistration>( | 693 base::Passed(base::MakeUnique<BackgroundSyncRegistration>( |
| 696 new_registration)))); | 694 new_registration))), |
| 695 base::Bind(&BackgroundSyncManager::FireReadyEvents, |
| 696 weak_ptr_factory_.GetWeakPtr())); |
| 697 } | 697 } |
| 698 | 698 |
| 699 void BackgroundSyncManager::RemoveActiveRegistration(int64_t sw_registration_id, | 699 void BackgroundSyncManager::RemoveActiveRegistration(int64_t sw_registration_id, |
| 700 const std::string& tag) { | 700 const std::string& tag) { |
| 701 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 701 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 702 DCHECK(LookupActiveRegistration(sw_registration_id, tag)); | 702 DCHECK(LookupActiveRegistration(sw_registration_id, tag)); |
| 703 | 703 |
| 704 BackgroundSyncRegistrations* registrations = | 704 BackgroundSyncRegistrations* registrations = |
| 705 &active_registrations_[sw_registration_id]; | 705 &active_registrations_[sw_registration_id]; |
| 706 | 706 |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 parameters_->max_sync_attempts = max_attempts; | 1171 parameters_->max_sync_attempts = max_attempts; |
| 1172 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); | 1172 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); |
| 1173 } | 1173 } |
| 1174 | 1174 |
| 1175 base::Closure BackgroundSyncManager::MakeEmptyCompletion() { | 1175 base::Closure BackgroundSyncManager::MakeEmptyCompletion() { |
| 1176 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1176 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 1177 return op_scheduler_.WrapCallbackToRunNext(base::Bind(&base::DoNothing)); | 1177 return op_scheduler_.WrapCallbackToRunNext(base::Bind(&base::DoNothing)); |
| 1178 } | 1178 } |
| 1179 | 1179 |
| 1180 } // namespace content | 1180 } // namespace content |
| OLD | NEW |