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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/provided_file_system.cc

Issue 2257103002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/file_system_provider/provided_file_system.h" 5 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 const base::FilePath& entry_path, 509 const base::FilePath& entry_path,
510 bool recursive, 510 bool recursive,
511 storage::WatcherManager::ChangeType change_type, 511 storage::WatcherManager::ChangeType change_type,
512 std::unique_ptr<ProvidedFileSystemObserver::Changes> changes, 512 std::unique_ptr<ProvidedFileSystemObserver::Changes> changes,
513 const std::string& tag, 513 const std::string& tag,
514 const storage::AsyncFileUtil::StatusCallback& callback) { 514 const storage::AsyncFileUtil::StatusCallback& callback) {
515 const size_t token = watcher_queue_.NewToken(); 515 const size_t token = watcher_queue_.NewToken();
516 watcher_queue_.Enqueue( 516 watcher_queue_.Enqueue(
517 token, base::Bind(&ProvidedFileSystem::NotifyInQueue, 517 token, base::Bind(&ProvidedFileSystem::NotifyInQueue,
518 base::Unretained(this), // Outlived by the queue. 518 base::Unretained(this), // Outlived by the queue.
519 base::Passed(base::WrapUnique(new NotifyInQueueArgs( 519 base::Passed(base::MakeUnique<NotifyInQueueArgs>(
520 token, entry_path, recursive, change_type, 520 token, entry_path, recursive, change_type,
521 std::move(changes), tag, callback))))); 521 std::move(changes), tag, callback))));
522 } 522 }
523 523
524 void ProvidedFileSystem::Configure( 524 void ProvidedFileSystem::Configure(
525 const storage::AsyncFileUtil::StatusCallback& callback) { 525 const storage::AsyncFileUtil::StatusCallback& callback) {
526 const int request_id = request_manager_->CreateRequest( 526 const int request_id = request_manager_->CreateRequest(
527 CONFIGURE, std::unique_ptr<RequestManager::HandlerInterface>( 527 CONFIGURE, std::unique_ptr<RequestManager::HandlerInterface>(
528 new operations::Configure(event_router_, file_system_info_, 528 new operations::Configure(event_router_, file_system_info_,
529 callback))); 529 callback)));
530 if (!request_id) 530 if (!request_id)
531 callback.Run(base::File::FILE_ERROR_SECURITY); 531 callback.Run(base::File::FILE_ERROR_SECURITY);
(...skipping 17 matching lines...) Expand all
549 base::File::Error result) { 549 base::File::Error result) {
550 if (result != base::File::FILE_OK) { 550 if (result != base::File::FILE_OK) {
551 // If an error in aborting happens, then do not abort the request in the 551 // If an error in aborting happens, then do not abort the request in the
552 // request manager, as the operation is supposed to complete. The only case 552 // request manager, as the operation is supposed to complete. The only case
553 // it wouldn't complete is if there is a bug in the extension code, and 553 // it wouldn't complete is if there is a bug in the extension code, and
554 // the extension never calls the callback. We consiously *do not* handle 554 // the extension never calls the callback. We consiously *do not* handle
555 // bugs in extensions here. 555 // bugs in extensions here.
556 return; 556 return;
557 } 557 }
558 request_manager_->RejectRequest(operation_request_id, 558 request_manager_->RejectRequest(operation_request_id,
559 base::WrapUnique(new RequestValue()), 559 base::MakeUnique<RequestValue>(),
560 base::File::FILE_ERROR_ABORT); 560 base::File::FILE_ERROR_ABORT);
561 } 561 }
562 562
563 AbortCallback ProvidedFileSystem::AddWatcherInQueue( 563 AbortCallback ProvidedFileSystem::AddWatcherInQueue(
564 const AddWatcherInQueueArgs& args) { 564 const AddWatcherInQueueArgs& args) {
565 if (args.persistent && (!file_system_info_.supports_notify_tag() || 565 if (args.persistent && (!file_system_info_.supports_notify_tag() ||
566 !args.notification_callback.is_null())) { 566 !args.notification_callback.is_null())) {
567 OnAddWatcherInQueueCompleted(args.token, args.entry_path, args.recursive, 567 OnAddWatcherInQueueCompleted(args.token, args.entry_path, args.recursive,
568 Subscriber(), args.callback, 568 Subscriber(), args.callback,
569 base::File::FILE_ERROR_INVALID_OPERATION); 569 base::File::FILE_ERROR_INVALID_OPERATION);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 const storage::AsyncFileUtil::StatusCallback& callback, 826 const storage::AsyncFileUtil::StatusCallback& callback,
827 base::File::Error result) { 827 base::File::Error result) {
828 // Closing files is final. Even if an error happened, we remove it from the 828 // Closing files is final. Even if an error happened, we remove it from the
829 // list of opened files. 829 // list of opened files.
830 opened_files_.erase(file_handle); 830 opened_files_.erase(file_handle);
831 callback.Run(result); 831 callback.Run(result);
832 } 832 }
833 833
834 } // namespace file_system_provider 834 } // namespace file_system_provider
835 } // namespace chromeos 835 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698