| 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.h" | 5 #include "content/browser/background_sync/background_sync_context.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 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 void BackgroundSyncContext::Shutdown() { | 37 void BackgroundSyncContext::Shutdown() { |
| 38 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 38 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 39 | 39 |
| 40 BrowserThread::PostTask( | 40 BrowserThread::PostTask( |
| 41 BrowserThread::IO, FROM_HERE, | 41 BrowserThread::IO, FROM_HERE, |
| 42 base::Bind(&BackgroundSyncContext::ShutdownOnIO, this)); | 42 base::Bind(&BackgroundSyncContext::ShutdownOnIO, this)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void BackgroundSyncContext::CreateService( | 45 void BackgroundSyncContext::CreateService( |
| 46 mojo::InterfaceRequest<mojom::BackgroundSyncService> request) { | 46 mojo::InterfaceRequest<blink::mojom::BackgroundSyncService> request) { |
| 47 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 47 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 48 | 48 |
| 49 BrowserThread::PostTask( | 49 BrowserThread::PostTask( |
| 50 BrowserThread::IO, FROM_HERE, | 50 BrowserThread::IO, FROM_HERE, |
| 51 base::Bind(&BackgroundSyncContext::CreateServiceOnIOThread, this, | 51 base::Bind(&BackgroundSyncContext::CreateServiceOnIOThread, this, |
| 52 base::Passed(&request))); | 52 base::Passed(&request))); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void BackgroundSyncContext::ServiceHadConnectionError( | 55 void BackgroundSyncContext::ServiceHadConnectionError( |
| 56 BackgroundSyncServiceImpl* service) { | 56 BackgroundSyncServiceImpl* service) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 76 | 76 |
| 77 void BackgroundSyncContext::CreateBackgroundSyncManager( | 77 void BackgroundSyncContext::CreateBackgroundSyncManager( |
| 78 scoped_refptr<ServiceWorkerContextWrapper> context) { | 78 scoped_refptr<ServiceWorkerContextWrapper> context) { |
| 79 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 79 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 80 DCHECK(!background_sync_manager_); | 80 DCHECK(!background_sync_manager_); |
| 81 | 81 |
| 82 background_sync_manager_ = BackgroundSyncManager::Create(context); | 82 background_sync_manager_ = BackgroundSyncManager::Create(context); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void BackgroundSyncContext::CreateServiceOnIOThread( | 85 void BackgroundSyncContext::CreateServiceOnIOThread( |
| 86 mojo::InterfaceRequest<mojom::BackgroundSyncService> request) { | 86 mojo::InterfaceRequest<blink::mojom::BackgroundSyncService> request) { |
| 87 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 87 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 88 DCHECK(background_sync_manager_); | 88 DCHECK(background_sync_manager_); |
| 89 services_.insert(new BackgroundSyncServiceImpl(this, std::move(request))); | 89 services_.insert(new BackgroundSyncServiceImpl(this, std::move(request))); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void BackgroundSyncContext::ShutdownOnIO() { | 92 void BackgroundSyncContext::ShutdownOnIO() { |
| 93 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 93 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 94 | 94 |
| 95 STLDeleteElements(&services_); | 95 STLDeleteElements(&services_); |
| 96 background_sync_manager_.reset(); | 96 background_sync_manager_.reset(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace content | 99 } // namespace content |
| OLD | NEW |