| 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 void BackgroundSyncManager::DispatchSyncEvent( | 703 void BackgroundSyncManager::DispatchSyncEvent( |
| 704 const std::string& tag, | 704 const std::string& tag, |
| 705 const scoped_refptr<ServiceWorkerVersion>& active_version, | 705 const scoped_refptr<ServiceWorkerVersion>& active_version, |
| 706 BackgroundSyncEventLastChance last_chance, | 706 BackgroundSyncEventLastChance last_chance, |
| 707 const ServiceWorkerVersion::StatusCallback& callback) { | 707 const ServiceWorkerVersion::StatusCallback& callback) { |
| 708 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 708 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 709 DCHECK(active_version); | 709 DCHECK(active_version); |
| 710 | 710 |
| 711 if (active_version->running_status() != ServiceWorkerVersion::RUNNING) { | 711 if (active_version->running_status() != ServiceWorkerVersion::RUNNING) { |
| 712 active_version->RunAfterStartWorker( | 712 active_version->RunAfterStartWorker( |
| 713 ServiceWorkerMetrics::EventType::SYNC, |
| 713 base::Bind(&BackgroundSyncManager::DispatchSyncEvent, | 714 base::Bind(&BackgroundSyncManager::DispatchSyncEvent, |
| 714 weak_ptr_factory_.GetWeakPtr(), tag, active_version, | 715 weak_ptr_factory_.GetWeakPtr(), tag, active_version, |
| 715 last_chance, callback), | 716 last_chance, callback), |
| 716 callback); | 717 callback); |
| 717 return; | 718 return; |
| 718 } | 719 } |
| 719 | 720 |
| 720 int request_id = active_version->StartRequestWithCustomTimeout( | 721 int request_id = active_version->StartRequestWithCustomTimeout( |
| 721 ServiceWorkerMetrics::EventType::SYNC, callback, | 722 ServiceWorkerMetrics::EventType::SYNC, callback, |
| 722 parameters_->max_sync_event_duration, | 723 parameters_->max_sync_event_duration, |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 BackgroundSyncManager::MakeStatusCompletion(const StatusCallback& callback) { | 1208 BackgroundSyncManager::MakeStatusCompletion(const StatusCallback& callback) { |
| 1208 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1209 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 1209 | 1210 |
| 1210 return base::Bind( | 1211 return base::Bind( |
| 1211 &BackgroundSyncManager::CompleteOperationCallback<StatusCallback, | 1212 &BackgroundSyncManager::CompleteOperationCallback<StatusCallback, |
| 1212 BackgroundSyncStatus>, | 1213 BackgroundSyncStatus>, |
| 1213 weak_ptr_factory_.GetWeakPtr(), callback); | 1214 weak_ptr_factory_.GetWeakPtr(), callback); |
| 1214 } | 1215 } |
| 1215 | 1216 |
| 1216 } // namespace content | 1217 } // namespace content |
| OLD | NEW |