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

Side by Side Diff: chrome/browser/sync_file_system/local/sync_file_system_backend.cc

Issue 2826943002: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/sync_file_system (Closed)
Patch Set: Created 3 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/sync_file_system/local/sync_file_system_backend.h" 5 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 void SyncFileSystemBackend::InitializeSyncFileSystemService( 266 void SyncFileSystemBackend::InitializeSyncFileSystemService(
267 const GURL& origin_url, 267 const GURL& origin_url,
268 const SyncStatusCallback& callback) { 268 const SyncStatusCallback& callback) {
269 // Repost to switch from IO thread to UI thread. 269 // Repost to switch from IO thread to UI thread.
270 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 270 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
271 DCHECK_CURRENTLY_ON(BrowserThread::IO); 271 DCHECK_CURRENTLY_ON(BrowserThread::IO);
272 // It is safe to pass Unretained(this) (see comments in OpenFileSystem()). 272 // It is safe to pass Unretained(this) (see comments in OpenFileSystem()).
273 BrowserThread::PostTask( 273 BrowserThread::PostTask(
274 BrowserThread::UI, FROM_HERE, 274 BrowserThread::UI, FROM_HERE,
275 base::Bind(&SyncFileSystemBackend::InitializeSyncFileSystemService, 275 base::BindOnce(&SyncFileSystemBackend::InitializeSyncFileSystemService,
276 base::Unretained(this), origin_url, callback)); 276 base::Unretained(this), origin_url, callback));
277 return; 277 return;
278 } 278 }
279 279
280 if (!profile_holder_->GetProfile()) { 280 if (!profile_holder_->GetProfile()) {
281 // Profile was destroyed. 281 // Profile was destroyed.
282 callback.Run(SYNC_FILE_ERROR_FAILED); 282 callback.Run(SYNC_FILE_ERROR_FAILED);
283 return; 283 return;
284 } 284 }
285 285
286 SyncFileSystemService* service = SyncFileSystemServiceFactory::GetForProfile( 286 SyncFileSystemService* service = SyncFileSystemServiceFactory::GetForProfile(
287 profile_holder_->GetProfile()); 287 profile_holder_->GetProfile());
288 DCHECK(service); 288 DCHECK(service);
289 service->InitializeForApp(context_, origin_url, callback); 289 service->InitializeForApp(context_, origin_url, callback);
290 } 290 }
291 291
292 void SyncFileSystemBackend::DidInitializeSyncFileSystemService( 292 void SyncFileSystemBackend::DidInitializeSyncFileSystemService(
293 storage::FileSystemContext* context, 293 storage::FileSystemContext* context,
294 const GURL& origin_url, 294 const GURL& origin_url,
295 storage::FileSystemType type, 295 storage::FileSystemType type,
296 storage::OpenFileSystemMode mode, 296 storage::OpenFileSystemMode mode,
297 const OpenFileSystemCallback& callback, 297 const OpenFileSystemCallback& callback,
298 SyncStatusCode status) { 298 SyncStatusCode status) {
299 // Repost to switch from UI thread to IO thread. 299 // Repost to switch from UI thread to IO thread.
300 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 300 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
301 DCHECK_CURRENTLY_ON(BrowserThread::UI); 301 DCHECK_CURRENTLY_ON(BrowserThread::UI);
302 // It is safe to pass Unretained(this) since |context| owns it. 302 // It is safe to pass Unretained(this) since |context| owns it.
303 BrowserThread::PostTask( 303 BrowserThread::PostTask(
304 BrowserThread::IO, FROM_HERE, 304 BrowserThread::IO, FROM_HERE,
305 base::Bind(&SyncFileSystemBackend::DidInitializeSyncFileSystemService, 305 base::BindOnce(
306 base::Unretained(this), base::RetainedRef(context), 306 &SyncFileSystemBackend::DidInitializeSyncFileSystemService,
307 origin_url, type, mode, callback, status)); 307 base::Unretained(this), base::RetainedRef(context), origin_url,
308 type, mode, callback, status));
308 return; 309 return;
309 } 310 }
310 311
311 if (status != sync_file_system::SYNC_STATUS_OK) { 312 if (status != sync_file_system::SYNC_STATUS_OK) {
312 callback.Run(GURL(), std::string(), 313 callback.Run(GURL(), std::string(),
313 SyncStatusCodeToFileError(status)); 314 SyncStatusCodeToFileError(status));
314 return; 315 return;
315 } 316 }
316 317
317 callback.Run(GetSyncableFileSystemRootURI(origin_url), 318 callback.Run(GetSyncableFileSystemRootURI(origin_url),
318 GetFileSystemName(origin_url, type), 319 GetFileSystemName(origin_url, type),
319 base::File::FILE_OK); 320 base::File::FILE_OK);
320 } 321 }
321 322
322 } // namespace sync_file_system 323 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698