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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 void BackgroundSyncManager::FireOneShotSync( | 787 void BackgroundSyncManager::FireOneShotSync( |
788 BackgroundSyncRegistrationHandle::HandleId handle_id, | 788 BackgroundSyncRegistrationHandle::HandleId handle_id, |
789 const scoped_refptr<ServiceWorkerVersion>& active_version, | 789 const scoped_refptr<ServiceWorkerVersion>& active_version, |
790 BackgroundSyncEventLastChance last_chance, | 790 BackgroundSyncEventLastChance last_chance, |
791 const ServiceWorkerVersion::StatusCallback& callback) { | 791 const ServiceWorkerVersion::StatusCallback& callback) { |
792 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 792 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
793 DCHECK(active_version); | 793 DCHECK(active_version); |
794 | 794 |
795 if (active_version->running_status() != ServiceWorkerVersion::RUNNING) { | 795 if (active_version->running_status() != ServiceWorkerVersion::RUNNING) { |
796 active_version->RunAfterStartWorker( | 796 active_version->RunAfterStartWorker( |
797 callback, base::Bind(&BackgroundSyncManager::FireOneShotSync, | 797 base::Bind(&BackgroundSyncManager::FireOneShotSync, |
798 weak_ptr_factory_.GetWeakPtr(), handle_id, | 798 weak_ptr_factory_.GetWeakPtr(), handle_id, active_version, |
799 active_version, last_chance, callback)); | 799 last_chance, callback), |
| 800 callback); |
800 return; | 801 return; |
801 } | 802 } |
802 | 803 |
803 int request_id = active_version->StartRequestWithCustomTimeout( | 804 int request_id = active_version->StartRequestWithCustomTimeout( |
804 ServiceWorkerMetrics::EventType::SYNC, callback, | 805 ServiceWorkerMetrics::EventType::SYNC, callback, |
805 parameters_->max_sync_event_duration, | 806 parameters_->max_sync_event_duration, |
806 ServiceWorkerVersion::CONTINUE_ON_TIMEOUT); | 807 ServiceWorkerVersion::CONTINUE_ON_TIMEOUT); |
807 base::WeakPtr<BackgroundSyncServiceClient> client = | 808 base::WeakPtr<BackgroundSyncServiceClient> client = |
808 active_version->GetMojoServiceForRequest<BackgroundSyncServiceClient>( | 809 active_version->GetMojoServiceForRequest<BackgroundSyncServiceClient>( |
809 request_id); | 810 request_id); |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1539 BackgroundSyncManager::MakeStatusCompletion(const StatusCallback& callback) { | 1540 BackgroundSyncManager::MakeStatusCompletion(const StatusCallback& callback) { |
1540 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1541 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1541 | 1542 |
1542 return base::Bind( | 1543 return base::Bind( |
1543 &BackgroundSyncManager::CompleteOperationCallback<StatusCallback, | 1544 &BackgroundSyncManager::CompleteOperationCallback<StatusCallback, |
1544 BackgroundSyncStatus>, | 1545 BackgroundSyncStatus>, |
1545 weak_ptr_factory_.GetWeakPtr(), callback); | 1546 weak_ptr_factory_.GetWeakPtr(), callback); |
1546 } | 1547 } |
1547 | 1548 |
1548 } // namespace content | 1549 } // namespace content |
OLD | NEW |