| 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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 } | 748 } |
| 749 | 749 |
| 750 void BackgroundSyncManager::DispatchSyncEvent( | 750 void BackgroundSyncManager::DispatchSyncEvent( |
| 751 const std::string& tag, | 751 const std::string& tag, |
| 752 scoped_refptr<ServiceWorkerVersion> active_version, | 752 scoped_refptr<ServiceWorkerVersion> active_version, |
| 753 blink::mojom::BackgroundSyncEventLastChance last_chance, | 753 blink::mojom::BackgroundSyncEventLastChance last_chance, |
| 754 const ServiceWorkerVersion::StatusCallback& callback) { | 754 const ServiceWorkerVersion::StatusCallback& callback) { |
| 755 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 755 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 756 DCHECK(active_version); | 756 DCHECK(active_version); |
| 757 | 757 |
| 758 if (active_version->running_status() != ServiceWorkerVersion::RUNNING) { | 758 if (active_version->running_status() != |
| 759 ServiceWorkerVersion::RunningStatus::RUNNING) { |
| 759 active_version->RunAfterStartWorker( | 760 active_version->RunAfterStartWorker( |
| 760 ServiceWorkerMetrics::EventType::SYNC, | 761 ServiceWorkerMetrics::EventType::SYNC, |
| 761 base::Bind(&BackgroundSyncManager::DispatchSyncEvent, | 762 base::Bind(&BackgroundSyncManager::DispatchSyncEvent, |
| 762 weak_ptr_factory_.GetWeakPtr(), tag, active_version, | 763 weak_ptr_factory_.GetWeakPtr(), tag, active_version, |
| 763 last_chance, callback), | 764 last_chance, callback), |
| 764 callback); | 765 callback); |
| 765 return; | 766 return; |
| 766 } | 767 } |
| 767 | 768 |
| 768 int request_id = active_version->StartRequestWithCustomTimeout( | 769 int request_id = active_version->StartRequestWithCustomTimeout( |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 BackgroundSyncManager::MakeStatusCompletion(const StatusCallback& callback) { | 1257 BackgroundSyncManager::MakeStatusCompletion(const StatusCallback& callback) { |
| 1257 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1258 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 1258 | 1259 |
| 1259 return base::Bind( | 1260 return base::Bind( |
| 1260 &BackgroundSyncManager::CompleteOperationCallback<StatusCallback, | 1261 &BackgroundSyncManager::CompleteOperationCallback<StatusCallback, |
| 1261 BackgroundSyncStatus>, | 1262 BackgroundSyncStatus>, |
| 1262 weak_ptr_factory_.GetWeakPtr(), callback); | 1263 weak_ptr_factory_.GetWeakPtr(), callback); |
| 1263 } | 1264 } |
| 1264 | 1265 |
| 1265 } // namespace content | 1266 } // namespace content |
| OLD | NEW |