| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 DispatchSyncEvent( | 268 DispatchSyncEvent( |
| 269 tag, std::move(active_version), | 269 tag, std::move(active_version), |
| 270 last_chance | 270 last_chance |
| 271 ? blink::mojom::BackgroundSyncEventLastChance::IS_LAST_CHANCE | 271 ? blink::mojom::BackgroundSyncEventLastChance::IS_LAST_CHANCE |
| 272 : blink::mojom::BackgroundSyncEventLastChance::IS_NOT_LAST_CHANCE, | 272 : blink::mojom::BackgroundSyncEventLastChance::IS_NOT_LAST_CHANCE, |
| 273 callback); | 273 callback); |
| 274 } | 274 } |
| 275 | 275 |
| 276 BackgroundSyncManager::BackgroundSyncManager( | 276 BackgroundSyncManager::BackgroundSyncManager( |
| 277 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context) | 277 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context) |
| 278 : service_worker_context_(service_worker_context), | 278 : op_scheduler_(CacheStorageSchedulerClient::CLIENT_BACKGROUND_SYNC), |
| 279 service_worker_context_(service_worker_context), |
| 279 parameters_(new BackgroundSyncParameters()), | 280 parameters_(new BackgroundSyncParameters()), |
| 280 disabled_(false), | 281 disabled_(false), |
| 281 num_firing_registrations_(0), | 282 num_firing_registrations_(0), |
| 282 clock_(new base::DefaultClock()), | 283 clock_(new base::DefaultClock()), |
| 283 weak_ptr_factory_(this) { | 284 weak_ptr_factory_(this) { |
| 284 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 285 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 285 | 286 |
| 286 service_worker_context_->AddObserver(this); | 287 service_worker_context_->AddObserver(this); |
| 287 | 288 |
| 288 #if defined(OS_ANDROID) | 289 #if defined(OS_ANDROID) |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 parameters_->max_sync_attempts = max_attempts; | 1188 parameters_->max_sync_attempts = max_attempts; |
| 1188 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); | 1189 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); |
| 1189 } | 1190 } |
| 1190 | 1191 |
| 1191 base::Closure BackgroundSyncManager::MakeEmptyCompletion() { | 1192 base::Closure BackgroundSyncManager::MakeEmptyCompletion() { |
| 1192 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1193 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 1193 return op_scheduler_.WrapCallbackToRunNext(base::Bind(&base::DoNothing)); | 1194 return op_scheduler_.WrapCallbackToRunNext(base::Bind(&base::DoNothing)); |
| 1194 } | 1195 } |
| 1195 | 1196 |
| 1196 } // namespace content | 1197 } // namespace content |
| OLD | NEW |