| 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_context_impl.h" | 5 #include "content/browser/background_sync/background_sync_context_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 | 63 |
| 64 BackgroundSyncManager* BackgroundSyncContextImpl::background_sync_manager() | 64 BackgroundSyncManager* BackgroundSyncContextImpl::background_sync_manager() |
| 65 const { | 65 const { |
| 66 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 66 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 67 | 67 |
| 68 return background_sync_manager_.get(); | 68 return background_sync_manager_.get(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void BackgroundSyncContextImpl::set_background_sync_manager_for_testing( | 71 void BackgroundSyncContextImpl::set_background_sync_manager_for_testing( |
| 72 scoped_ptr<BackgroundSyncManager> manager) { | 72 std::unique_ptr<BackgroundSyncManager> manager) { |
| 73 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 73 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 74 | 74 |
| 75 background_sync_manager_ = std::move(manager); | 75 background_sync_manager_ = std::move(manager); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void BackgroundSyncContextImpl::CreateBackgroundSyncManager( | 78 void BackgroundSyncContextImpl::CreateBackgroundSyncManager( |
| 79 scoped_refptr<ServiceWorkerContextWrapper> context) { | 79 scoped_refptr<ServiceWorkerContextWrapper> context) { |
| 80 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 80 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 81 DCHECK(!background_sync_manager_); | 81 DCHECK(!background_sync_manager_); |
| 82 | 82 |
| 83 background_sync_manager_ = BackgroundSyncManager::Create(context); | 83 background_sync_manager_ = BackgroundSyncManager::Create(context); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void BackgroundSyncContextImpl::CreateServiceOnIOThread( | 86 void BackgroundSyncContextImpl::CreateServiceOnIOThread( |
| 87 mojo::InterfaceRequest<mojom::BackgroundSyncService> request) { | 87 mojo::InterfaceRequest<mojom::BackgroundSyncService> request) { |
| 88 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 88 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 89 DCHECK(background_sync_manager_); | 89 DCHECK(background_sync_manager_); |
| 90 services_.insert(new BackgroundSyncServiceImpl(this, std::move(request))); | 90 services_.insert(new BackgroundSyncServiceImpl(this, std::move(request))); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void BackgroundSyncContextImpl::ShutdownOnIO() { | 93 void BackgroundSyncContextImpl::ShutdownOnIO() { |
| 94 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 94 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 95 | 95 |
| 96 STLDeleteElements(&services_); | 96 STLDeleteElements(&services_); |
| 97 background_sync_manager_.reset(); | 97 background_sync_manager_.reset(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace content | 100 } // namespace content |
| OLD | NEW |