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

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

Issue 1873683002: Convert //chrome/browser/sync_file_system from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/canned_syncable_file_system.h" 5 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <iterator> 9 #include <iterator>
10 #include <utility> 10 #include <utility>
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (!complete) 180 if (!complete)
181 return; 181 return;
182 } 182 }
183 completion_callback.Run(error == base::File::FILE_OK 183 completion_callback.Run(error == base::File::FILE_OK
184 ? bytes_written_ 184 ? bytes_written_
185 : static_cast<int64_t>(error)); 185 : static_cast<int64_t>(error));
186 } 186 }
187 187
188 private: 188 private:
189 int64_t bytes_written_; 189 int64_t bytes_written_;
190 scoped_ptr<MockBlobURLRequestContext> request_context_; 190 std::unique_ptr<MockBlobURLRequestContext> request_context_;
191 scoped_ptr<ScopedTextBlob> blob_data_; 191 std::unique_ptr<ScopedTextBlob> blob_data_;
192 192
193 DISALLOW_COPY_AND_ASSIGN(WriteHelper); 193 DISALLOW_COPY_AND_ASSIGN(WriteHelper);
194 }; 194 };
195 195
196 void DidGetUsageAndQuota(const storage::StatusCallback& callback, 196 void DidGetUsageAndQuota(const storage::StatusCallback& callback,
197 int64_t* usage_out, 197 int64_t* usage_out,
198 int64_t* quota_out, 198 int64_t* quota_out,
199 storage::QuotaStatusCode status, 199 storage::QuotaStatusCode status,
200 int64_t usage, 200 int64_t usage,
201 int64_t quota) { 201 int64_t quota) {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 FROM_HERE, 467 FROM_HERE,
468 base::Bind(&CannedSyncableFileSystem::DoReadDirectory, 468 base::Bind(&CannedSyncableFileSystem::DoReadDirectory,
469 base::Unretained(this), 469 base::Unretained(this),
470 url, 470 url,
471 entries)); 471 entries));
472 } 472 }
473 473
474 int64_t CannedSyncableFileSystem::Write( 474 int64_t CannedSyncableFileSystem::Write(
475 net::URLRequestContext* url_request_context, 475 net::URLRequestContext* url_request_context,
476 const FileSystemURL& url, 476 const FileSystemURL& url,
477 scoped_ptr<storage::BlobDataHandle> blob_data_handle) { 477 std::unique_ptr<storage::BlobDataHandle> blob_data_handle) {
478 return RunOnThread<int64_t>( 478 return RunOnThread<int64_t>(
479 io_task_runner_.get(), FROM_HERE, 479 io_task_runner_.get(), FROM_HERE,
480 base::Bind(&CannedSyncableFileSystem::DoWrite, base::Unretained(this), 480 base::Bind(&CannedSyncableFileSystem::DoWrite, base::Unretained(this),
481 url_request_context, url, base::Passed(&blob_data_handle))); 481 url_request_context, url, base::Passed(&blob_data_handle)));
482 } 482 }
483 483
484 int64_t CannedSyncableFileSystem::WriteString(const FileSystemURL& url, 484 int64_t CannedSyncableFileSystem::WriteString(const FileSystemURL& url,
485 const std::string& data) { 485 const std::string& data) {
486 return RunOnThread<int64_t>( 486 return RunOnThread<int64_t>(
487 io_task_runner_.get(), FROM_HERE, 487 io_task_runner_.get(), FROM_HERE,
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 const StatusCallback& callback) { 678 const StatusCallback& callback) {
679 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); 679 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
680 EXPECT_TRUE(is_filesystem_opened_); 680 EXPECT_TRUE(is_filesystem_opened_);
681 operation_runner()->ReadDirectory( 681 operation_runner()->ReadDirectory(
682 url, base::Bind(&OnReadDirectory, entries, callback)); 682 url, base::Bind(&OnReadDirectory, entries, callback));
683 } 683 }
684 684
685 void CannedSyncableFileSystem::DoWrite( 685 void CannedSyncableFileSystem::DoWrite(
686 net::URLRequestContext* url_request_context, 686 net::URLRequestContext* url_request_context,
687 const FileSystemURL& url, 687 const FileSystemURL& url,
688 scoped_ptr<storage::BlobDataHandle> blob_data_handle, 688 std::unique_ptr<storage::BlobDataHandle> blob_data_handle,
689 const WriteCallback& callback) { 689 const WriteCallback& callback) {
690 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); 690 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
691 EXPECT_TRUE(is_filesystem_opened_); 691 EXPECT_TRUE(is_filesystem_opened_);
692 WriteHelper* helper = new WriteHelper; 692 WriteHelper* helper = new WriteHelper;
693 operation_runner()->Write( 693 operation_runner()->Write(
694 url_request_context, url, std::move(blob_data_handle), 0, 694 url_request_context, url, std::move(blob_data_handle), 0,
695 base::Bind(&WriteHelper::DidWrite, base::Owned(helper), callback)); 695 base::Bind(&WriteHelper::DidWrite, base::Owned(helper), callback));
696 } 696 }
697 697
698 void CannedSyncableFileSystem::DoWriteString( 698 void CannedSyncableFileSystem::DoWriteString(
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 sync_status_ = status; 755 sync_status_ = status;
756 quit_closure.Run(); 756 quit_closure.Run();
757 } 757 }
758 758
759 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { 759 void CannedSyncableFileSystem::InitializeSyncStatusObserver() {
760 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); 760 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
761 backend()->sync_context()->sync_status()->AddObserver(this); 761 backend()->sync_context()->sync_status()->AddObserver(this);
762 } 762 }
763 763
764 } // namespace sync_file_system 764 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698