Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: content/browser/background_sync/background_sync_context.cc

Issue 2954433002: BackgroundSync: Convert to base::BindOnce/OnceCallback/OnceClosure (Closed)
Patch Set: rename local variable Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 13 matching lines...) Expand all
24 DCHECK(!background_sync_manager_); 24 DCHECK(!background_sync_manager_);
25 DCHECK(services_.empty()); 25 DCHECK(services_.empty());
26 } 26 }
27 27
28 void BackgroundSyncContext::Init( 28 void BackgroundSyncContext::Init(
29 const scoped_refptr<ServiceWorkerContextWrapper>& context) { 29 const scoped_refptr<ServiceWorkerContextWrapper>& context) {
30 DCHECK_CURRENTLY_ON(BrowserThread::UI); 30 DCHECK_CURRENTLY_ON(BrowserThread::UI);
31 31
32 BrowserThread::PostTask( 32 BrowserThread::PostTask(
33 BrowserThread::IO, FROM_HERE, 33 BrowserThread::IO, FROM_HERE,
34 base::Bind(&BackgroundSyncContext::CreateBackgroundSyncManager, this, 34 base::BindOnce(&BackgroundSyncContext::CreateBackgroundSyncManager, this,
35 context)); 35 context));
36 } 36 }
37 37
38 void BackgroundSyncContext::Shutdown() { 38 void BackgroundSyncContext::Shutdown() {
39 DCHECK_CURRENTLY_ON(BrowserThread::UI); 39 DCHECK_CURRENTLY_ON(BrowserThread::UI);
40 40
41 BrowserThread::PostTask( 41 BrowserThread::PostTask(
42 BrowserThread::IO, FROM_HERE, 42 BrowserThread::IO, FROM_HERE,
43 base::Bind(&BackgroundSyncContext::ShutdownOnIO, this)); 43 base::BindOnce(&BackgroundSyncContext::ShutdownOnIO, this));
44 } 44 }
45 45
46 void BackgroundSyncContext::CreateService( 46 void BackgroundSyncContext::CreateService(
47 const service_manager::BindSourceInfo& source_info, 47 const service_manager::BindSourceInfo& source_info,
48 blink::mojom::BackgroundSyncServiceRequest request) { 48 blink::mojom::BackgroundSyncServiceRequest request) {
49 DCHECK_CURRENTLY_ON(BrowserThread::UI); 49 DCHECK_CURRENTLY_ON(BrowserThread::UI);
50 50
51 BrowserThread::PostTask( 51 BrowserThread::PostTask(
52 BrowserThread::IO, FROM_HERE, 52 BrowserThread::IO, FROM_HERE,
53 base::Bind(&BackgroundSyncContext::CreateServiceOnIOThread, this, 53 base::BindOnce(&BackgroundSyncContext::CreateServiceOnIOThread, this,
54 base::Passed(&request))); 54 base::Passed(&request)));
55 } 55 }
56 56
57 void BackgroundSyncContext::ServiceHadConnectionError( 57 void BackgroundSyncContext::ServiceHadConnectionError(
58 BackgroundSyncServiceImpl* service) { 58 BackgroundSyncServiceImpl* service) {
59 DCHECK_CURRENTLY_ON(BrowserThread::IO); 59 DCHECK_CURRENTLY_ON(BrowserThread::IO);
60 DCHECK(base::ContainsKey(services_, service)); 60 DCHECK(base::ContainsKey(services_, service));
61 61
62 services_.erase(service); 62 services_.erase(service);
63 } 63 }
64 64
(...skipping 28 matching lines...) Expand all
93 } 93 }
94 94
95 void BackgroundSyncContext::ShutdownOnIO() { 95 void BackgroundSyncContext::ShutdownOnIO() {
96 DCHECK_CURRENTLY_ON(BrowserThread::IO); 96 DCHECK_CURRENTLY_ON(BrowserThread::IO);
97 97
98 services_.clear(); 98 services_.clear();
99 background_sync_manager_.reset(); 99 background_sync_manager_.reset();
100 } 100 }
101 101
102 } // namespace content 102 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698