diff options
author | dcheng <dcheng@chromium.org> | 2015-12-27 15:23:16 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-27 23:24:11 +0000 |
commit | dae49253c1c80ffbdab640902fc1a5142d611c1a (patch) | |
tree | d6e18ee4712f545b2a43eff11581d8b76ac242d1 /storage | |
parent | 424dfa526b76b06bb364a773fbaa6d19fb36d0ce (diff) | |
download | chromium_src-dae49253c1c80ffbdab640902fc1a5142d611c1a.zip chromium_src-dae49253c1c80ffbdab640902fc1a5142d611c1a.tar.gz chromium_src-dae49253c1c80ffbdab640902fc1a5142d611c1a.tar.bz2 |
Convert Pass()→std::move() in //storage
❆(੭ु ◜◡‾)੭ु⁾☃❆
BUG=557422
R=avi@chromium.org
TBR=kinuko@chromium.org
Review URL: https://codereview.chromium.org/1546243002
Cr-Commit-Position: refs/heads/master@{#366944}
Diffstat (limited to 'storage')
24 files changed, 143 insertions, 151 deletions
diff --git a/storage/browser/blob/blob_data_builder.cc b/storage/browser/blob/blob_data_builder.cc index d40d418..b699910 100644 --- a/storage/browser/blob/blob_data_builder.cc +++ b/storage/browser/blob/blob_data_builder.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/numerics/safe_conversions.h" #include "base/numerics/safe_math.h" @@ -57,14 +58,14 @@ void BlobDataBuilder::AppendData(const char* data, size_t length) { return; scoped_ptr<DataElement> element(new DataElement()); element->SetToBytes(data, length); - items_.push_back(new BlobDataItem(element.Pass())); + items_.push_back(new BlobDataItem(std::move(element))); } size_t BlobDataBuilder::AppendFutureData(size_t length) { CHECK_NE(length, 0u); scoped_ptr<DataElement> element(new DataElement()); element->SetToBytesDescription(length); - items_.push_back(new BlobDataItem(element.Pass())); + items_.push_back(new BlobDataItem(std::move(element))); return items_.size() - 1; } @@ -107,7 +108,7 @@ size_t BlobDataBuilder::AppendFutureFile(uint64_t offset, uint64_t length) { element->SetToFilePathRange(base::FilePath::FromUTF8Unsafe(std::string( kAppendFutureFileTemporaryFileName)), offset, length, base::Time()); - items_.push_back(new BlobDataItem(element.Pass())); + items_.push_back(new BlobDataItem(std::move(element))); return items_.size() - 1; } @@ -131,7 +132,7 @@ bool BlobDataBuilder::PopulateFutureFile( scoped_ptr<DataElement> element(new DataElement()); element->SetToFilePathRange(file_reference->path(), offset, length, expected_modification_time); - items_[index] = new BlobDataItem(element.Pass(), file_reference); + items_[index] = new BlobDataItem(std::move(element), file_reference); return true; } @@ -142,8 +143,8 @@ void BlobDataBuilder::AppendFile(const base::FilePath& file_path, scoped_ptr<DataElement> element(new DataElement()); element->SetToFilePathRange(file_path, offset, length, expected_modification_time); - items_.push_back( - new BlobDataItem(element.Pass(), ShareableFileReference::Get(file_path))); + items_.push_back(new BlobDataItem(std::move(element), + ShareableFileReference::Get(file_path))); } void BlobDataBuilder::AppendBlob(const std::string& uuid, @@ -152,13 +153,13 @@ void BlobDataBuilder::AppendBlob(const std::string& uuid, DCHECK_GT(length, 0ul); scoped_ptr<DataElement> element(new DataElement()); element->SetToBlobRange(uuid, offset, length); - items_.push_back(new BlobDataItem(element.Pass())); + items_.push_back(new BlobDataItem(std::move(element))); } void BlobDataBuilder::AppendBlob(const std::string& uuid) { scoped_ptr<DataElement> element(new DataElement()); element->SetToBlob(uuid); - items_.push_back(new BlobDataItem(element.Pass())); + items_.push_back(new BlobDataItem(std::move(element))); } void BlobDataBuilder::AppendFileSystemFile( @@ -170,7 +171,7 @@ void BlobDataBuilder::AppendFileSystemFile( scoped_ptr<DataElement> element(new DataElement()); element->SetToFileSystemUrlRange(url, offset, length, expected_modification_time); - items_.push_back(new BlobDataItem(element.Pass())); + items_.push_back(new BlobDataItem(std::move(element))); } void BlobDataBuilder::AppendDiskCacheEntry( @@ -180,9 +181,8 @@ void BlobDataBuilder::AppendDiskCacheEntry( scoped_ptr<DataElement> element(new DataElement()); element->SetToDiskCacheEntryRange( 0U, disk_cache_entry->GetDataSize(disk_cache_stream_index)); - items_.push_back( - new BlobDataItem(element.Pass(), data_handle, disk_cache_entry, - disk_cache_stream_index)); + items_.push_back(new BlobDataItem(std::move(element), data_handle, + disk_cache_entry, disk_cache_stream_index)); } void BlobDataBuilder::Clear() { diff --git a/storage/browser/blob/blob_data_handle.cc b/storage/browser/blob/blob_data_handle.cc index efc757e..efe13b1 100644 --- a/storage/browser/blob/blob_data_handle.cc +++ b/storage/browser/blob/blob_data_handle.cc @@ -47,12 +47,8 @@ class FileStreamReaderProviderImpl int64_t max_bytes_to_read, const base::Time& expected_modification_time) override { return file_system_context_->CreateFileStreamReader( - storage::FileSystemURL( - file_system_context_->CrackURL( - filesystem_url)), - offset, max_bytes_to_read, - expected_modification_time) - .Pass(); + storage::FileSystemURL(file_system_context_->CrackURL(filesystem_url)), + offset, max_bytes_to_read, expected_modification_time); } private: @@ -85,7 +81,7 @@ scoped_ptr<BlobReader> BlobDataHandle::CreateReader( scoped_ptr<BlobDataSnapshot> BlobDataHandle::BlobDataHandleShared::CreateSnapshot() const { - return context_->CreateSnapshot(uuid_).Pass(); + return context_->CreateSnapshot(uuid_); } BlobDataHandle::BlobDataHandleShared::~BlobDataHandleShared() { @@ -121,7 +117,7 @@ BlobDataHandle::~BlobDataHandle() { scoped_ptr<BlobDataSnapshot> BlobDataHandle::CreateSnapshot() const { DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); - return shared_->CreateSnapshot().Pass(); + return shared_->CreateSnapshot(); } const std::string& BlobDataHandle::uuid() const { diff --git a/storage/browser/blob/blob_data_item.cc b/storage/browser/blob/blob_data_item.cc index 58ccabe..70495ed 100644 --- a/storage/browser/blob/blob_data_item.cc +++ b/storage/browser/blob/blob_data_item.cc @@ -4,34 +4,33 @@ #include "storage/browser/blob/blob_data_item.h" +#include <utility> + namespace storage { BlobDataItem::DataHandle::~DataHandle() { } BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item) - : item_(item.Pass()), + : item_(std::move(item)), disk_cache_entry_(nullptr), - disk_cache_stream_index_(-1) { -} + disk_cache_stream_index_(-1) {} BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item, const scoped_refptr<DataHandle>& data_handle) - : item_(item.Pass()), + : item_(std::move(item)), data_handle_(data_handle), disk_cache_entry_(nullptr), - disk_cache_stream_index_(-1) { -} + disk_cache_stream_index_(-1) {} BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item, const scoped_refptr<DataHandle>& data_handle, disk_cache::Entry* entry, int disk_cache_stream_index) - : item_(item.Pass()), + : item_(std::move(item)), data_handle_(data_handle), disk_cache_entry_(entry), - disk_cache_stream_index_(disk_cache_stream_index) { -} + disk_cache_stream_index_(disk_cache_stream_index) {} BlobDataItem::~BlobDataItem() {} diff --git a/storage/browser/blob/blob_reader.cc b/storage/browser/blob/blob_reader.cc index 8a38bfe..6e3e866 100644 --- a/storage/browser/blob/blob_reader.cc +++ b/storage/browser/blob/blob_reader.cc @@ -6,9 +6,9 @@ #include <stddef.h> #include <stdint.h> - #include <algorithm> #include <limits> +#include <utility> #include "base/bind.h" #include "base/sequenced_task_runner.h" @@ -44,12 +44,12 @@ BlobReader::BlobReader( const BlobDataHandle* blob_handle, scoped_ptr<FileStreamReaderProvider> file_stream_provider, base::SequencedTaskRunner* file_task_runner) - : file_stream_provider_(file_stream_provider.Pass()), + : file_stream_provider_(std::move(file_stream_provider)), file_task_runner_(file_task_runner), net_error_(net::OK), weak_factory_(this) { if (blob_handle) { - blob_data_ = blob_handle->CreateSnapshot().Pass(); + blob_data_ = blob_handle->CreateSnapshot(); } } @@ -527,19 +527,15 @@ scoped_ptr<FileStreamReader> BlobReader::CreateFileStreamReader( switch (item.type()) { case DataElement::TYPE_FILE: return file_stream_provider_->CreateForLocalFile( - file_task_runner_.get(), item.path(), - item.offset() + additional_offset, - item.expected_modification_time()) - .Pass(); + file_task_runner_.get(), item.path(), + item.offset() + additional_offset, item.expected_modification_time()); case DataElement::TYPE_FILE_FILESYSTEM: - return file_stream_provider_ - ->CreateFileStreamReader( - item.filesystem_url(), item.offset() + additional_offset, - item.length() == std::numeric_limits<uint64_t>::max() - ? storage::kMaximumLength - : item.length() - additional_offset, - item.expected_modification_time()) - .Pass(); + return file_stream_provider_->CreateFileStreamReader( + item.filesystem_url(), item.offset() + additional_offset, + item.length() == std::numeric_limits<uint64_t>::max() + ? storage::kMaximumLength + : item.length() - additional_offset, + item.expected_modification_time()); case DataElement::TYPE_BLOB: case DataElement::TYPE_BYTES: case DataElement::TYPE_BYTES_DESCRIPTION: diff --git a/storage/browser/blob/blob_storage_context.cc b/storage/browser/blob/blob_storage_context.cc index e9e9601..e8fc008 100644 --- a/storage/browser/blob/blob_storage_context.cc +++ b/storage/browser/blob/blob_storage_context.cc @@ -6,9 +6,9 @@ #include <stddef.h> #include <stdint.h> - #include <algorithm> #include <limits> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -75,15 +75,15 @@ scoped_ptr<BlobDataHandle> BlobStorageContext::GetBlobDataFromUUID( scoped_ptr<BlobDataHandle> result; BlobMap::iterator found = blob_map_.find(uuid); if (found == blob_map_.end()) - return result.Pass(); + return result; auto* entry = found->second; if (entry->flags & EXCEEDED_MEMORY) - return result.Pass(); + return result; DCHECK(!entry->IsBeingBuilt()); result.reset(new BlobDataHandle(uuid, entry->data->content_type(), entry->data->content_disposition(), this, base::ThreadTaskRunnerHandle::Get().get())); - return result.Pass(); + return result; } scoped_ptr<BlobDataHandle> BlobStorageContext::GetBlobDataFromPublicURL( @@ -119,7 +119,7 @@ scoped_ptr<BlobDataHandle> BlobStorageContext::AddFinishedBlob( scoped_ptr<BlobDataHandle> handle = GetBlobDataFromUUID(external_builder.uuid_); DecrementBlobRefCount(external_builder.uuid_); - return handle.Pass(); + return handle; } scoped_ptr<BlobDataHandle> BlobStorageContext::AddFinishedBlob( @@ -273,25 +273,25 @@ scoped_refptr<BlobDataItem> BlobStorageContext::AllocateBlobItem( case DataElement::TYPE_BYTES: DCHECK(!ipc_data.offset()); element->SetToBytes(ipc_data.bytes(), length); - blob_item = new BlobDataItem(element.Pass()); + blob_item = new BlobDataItem(std::move(element)); break; case DataElement::TYPE_FILE: element->SetToFilePathRange(ipc_data.path(), ipc_data.offset(), length, ipc_data.expected_modification_time()); blob_item = new BlobDataItem( - element.Pass(), ShareableFileReference::Get(ipc_data.path())); + std::move(element), ShareableFileReference::Get(ipc_data.path())); break; case DataElement::TYPE_FILE_FILESYSTEM: element->SetToFileSystemUrlRange(ipc_data.filesystem_url(), ipc_data.offset(), length, ipc_data.expected_modification_time()); - blob_item = new BlobDataItem(element.Pass()); + blob_item = new BlobDataItem(std::move(element)); break; case DataElement::TYPE_BLOB: // This is a temporary item that will be deconstructed later. element->SetToBlobRange(ipc_data.blob_uuid(), ipc_data.offset(), ipc_data.length()); - blob_item = new BlobDataItem(element.Pass()); + blob_item = new BlobDataItem(std::move(element)); break; case DataElement::TYPE_DISK_CACHE_ENTRY: // This type can't be sent by IPC. NOTREACHED(); @@ -447,7 +447,7 @@ bool BlobStorageContext::AppendBlob( static_cast<int64_t>(new_length)); memory_usage_ += new_length; target_blob_builder->AppendSharedBlobItem(new ShareableBlobDataItem( - target_blob_uuid, new BlobDataItem(element.Pass()))); + target_blob_uuid, new BlobDataItem(std::move(element)))); } break; case DataElement::TYPE_FILE: { DCHECK_NE(item.length(), std::numeric_limits<uint64_t>::max()) @@ -460,7 +460,7 @@ bool BlobStorageContext::AppendBlob( item.expected_modification_time()); target_blob_builder->AppendSharedBlobItem(new ShareableBlobDataItem( target_blob_uuid, - new BlobDataItem(element.Pass(), item.data_handle_))); + new BlobDataItem(std::move(element), item.data_handle_))); } break; case DataElement::TYPE_FILE_FILESYSTEM: { UMA_HISTOGRAM_COUNTS("Storage.BlobItemSize.BlobSlice.FileSystem", @@ -470,7 +470,7 @@ bool BlobStorageContext::AppendBlob( item.offset() + offset, new_length, item.expected_modification_time()); target_blob_builder->AppendSharedBlobItem(new ShareableBlobDataItem( - target_blob_uuid, new BlobDataItem(element.Pass()))); + target_blob_uuid, new BlobDataItem(std::move(element)))); } break; case DataElement::TYPE_DISK_CACHE_ENTRY: { scoped_ptr<DataElement> element(new DataElement()); @@ -478,7 +478,7 @@ bool BlobStorageContext::AppendBlob( new_length); target_blob_builder->AppendSharedBlobItem(new ShareableBlobDataItem( target_blob_uuid, - new BlobDataItem(element.Pass(), item.data_handle_, + new BlobDataItem(std::move(element), item.data_handle_, item.disk_cache_entry(), item.disk_cache_stream_index()))); } break; diff --git a/storage/browser/blob/blob_url_request_job_factory.cc b/storage/browser/blob/blob_url_request_job_factory.cc index 7e814d4..ed9c137 100644 --- a/storage/browser/blob/blob_url_request_job_factory.cc +++ b/storage/browser/blob/blob_url_request_job_factory.cc @@ -4,6 +4,8 @@ #include "storage/browser/blob/blob_url_request_job_factory.h" +#include <utility> + #include "base/strings/string_util.h" #include "net/base/request_priority.h" #include "net/url_request/url_request_context.h" @@ -28,8 +30,8 @@ scoped_ptr<net::URLRequest> BlobProtocolHandler::CreateBlobRequest( const GURL kBlobUrl("blob://see_user_data/"); scoped_ptr<net::URLRequest> request = request_context->CreateRequest( kBlobUrl, net::DEFAULT_PRIORITY, request_delegate); - SetRequestedBlobDataHandle(request.get(), blob_data_handle.Pass()); - return request.Pass(); + SetRequestedBlobDataHandle(request.get(), std::move(blob_data_handle)); + return request; } // static @@ -84,7 +86,7 @@ BlobDataHandle* BlobProtocolHandler::LookupBlobHandle( scoped_ptr<BlobDataHandle> handle = context_->GetBlobDataFromUUID(uuid); BlobDataHandle* handle_ptr = handle.get(); if (handle) { - SetRequestedBlobDataHandle(request, handle.Pass()); + SetRequestedBlobDataHandle(request, std::move(handle)); } return handle_ptr; } diff --git a/storage/browser/blob/internal_blob_data.cc b/storage/browser/blob/internal_blob_data.cc index fae109a..cbec290 100644 --- a/storage/browser/blob/internal_blob_data.cc +++ b/storage/browser/blob/internal_blob_data.cc @@ -5,6 +5,7 @@ #include "storage/browser/blob/internal_blob_data.h" #include <stddef.h> +#include <utility> #include "base/containers/hash_tables.h" #include "base/metrics/histogram.h" @@ -50,7 +51,7 @@ size_t InternalBlobData::Builder::GetNonsharedMemoryUsage() const { scoped_ptr<InternalBlobData> InternalBlobData::Builder::Build() { DCHECK(data_); - return data_.Pass(); + return std::move(data_); } InternalBlobData::InternalBlobData() { diff --git a/storage/browser/blob/shareable_file_reference.cc b/storage/browser/blob/shareable_file_reference.cc index 187ea70..c8672f7 100644 --- a/storage/browser/blob/shareable_file_reference.cc +++ b/storage/browser/blob/shareable_file_reference.cc @@ -5,6 +5,7 @@ #include "storage/browser/blob/shareable_file_reference.h" #include <map> +#include <utility> #include "base/lazy_instance.h" #include "base/macros.h" @@ -97,7 +98,7 @@ scoped_refptr<ShareableFileReference> ShareableFileReference::GetOrCreate( // Wasn't in the map, create a new reference and store the pointer. scoped_refptr<ShareableFileReference> reference( - new ShareableFileReference(scoped_file.Pass())); + new ShareableFileReference(std::move(scoped_file))); result.first->second = reference.get(); return reference; } @@ -109,7 +110,7 @@ void ShareableFileReference::AddFinalReleaseCallback( } ShareableFileReference::ShareableFileReference(ScopedFile scoped_file) - : scoped_file_(scoped_file.Pass()) { + : scoped_file_(std::move(scoped_file)) { DCHECK(g_file_map.Get().Find(path())->second == NULL); } diff --git a/storage/browser/blob/upload_blob_element_reader.cc b/storage/browser/blob/upload_blob_element_reader.cc index d44f840..3c86051 100644 --- a/storage/browser/blob/upload_blob_element_reader.cc +++ b/storage/browser/blob/upload_blob_element_reader.cc @@ -5,6 +5,7 @@ #include "storage/browser/blob/upload_blob_element_reader.h" #include <stdint.h> +#include <utility> #include "base/single_thread_task_runner.h" #include "net/base/net_errors.h" @@ -18,7 +19,7 @@ UploadBlobElementReader::UploadBlobElementReader( scoped_ptr<BlobDataHandle> handle, FileSystemContext* file_system_context, base::SingleThreadTaskRunner* file_task_runner) - : handle_(handle.Pass()), + : handle_(std::move(handle)), file_system_context_(file_system_context), file_runner_(file_task_runner) {} diff --git a/storage/browser/database/database_tracker.cc b/storage/browser/database/database_tracker.cc index 6a10107..42041c7 100644 --- a/storage/browser/database/database_tracker.cc +++ b/storage/browser/database/database_tracker.cc @@ -5,8 +5,8 @@ #include "storage/browser/database/database_tracker.h" #include <stdint.h> - #include <algorithm> +#include <utility> #include <vector> #include "base/bind.h" @@ -761,7 +761,7 @@ const base::File* DatabaseTracker::SaveIncognitoFile( if (!file.IsValid()) return NULL; - base::File* to_insert = new base::File(file.Pass()); + base::File* to_insert = new base::File(std::move(file)); std::pair<FileHandlesMap::iterator, bool> rv = incognito_file_handles_.insert(std::make_pair(vfs_file_name, to_insert)); DCHECK(rv.second); diff --git a/storage/browser/fileapi/async_file_util_adapter.cc b/storage/browser/fileapi/async_file_util_adapter.cc index 6f7cafd..361c73a 100644 --- a/storage/browser/fileapi/async_file_util_adapter.cc +++ b/storage/browser/fileapi/async_file_util_adapter.cc @@ -6,7 +6,7 @@ #include <stddef.h> #include <stdint.h> - +#include <utility> #include <vector> #include "base/bind.h" @@ -76,7 +76,7 @@ class GetFileInfoHelper { void ReplySnapshotFile( const AsyncFileUtil::CreateSnapshotFileCallback& callback) { callback.Run(error_, file_info_, platform_path_, - ShareableFileReference::GetOrCreate(scoped_file_.Pass())); + ShareableFileReference::GetOrCreate(std::move(scoped_file_))); } private: @@ -138,7 +138,7 @@ void RunCreateOrOpenCallback( FileSystemOperationContext* context, const AsyncFileUtil::CreateOrOpenCallback& callback, base::File file) { - callback.Run(file.Pass(), base::Closure()); + callback.Run(std::move(file), base::Closure()); } } // namespace diff --git a/storage/browser/fileapi/copy_or_move_operation_delegate.cc b/storage/browser/fileapi/copy_or_move_operation_delegate.cc index f3072a1..1577278 100644 --- a/storage/browser/fileapi/copy_or_move_operation_delegate.cc +++ b/storage/browser/fileapi/copy_or_move_operation_delegate.cc @@ -5,6 +5,7 @@ #include "storage/browser/fileapi/copy_or_move_operation_delegate.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/files/file_path.h" @@ -382,8 +383,8 @@ class StreamCopyOrMoveImpl src_url_(src_url), dest_url_(dest_url), option_(option), - reader_(reader.Pass()), - writer_(writer.Pass()), + reader_(std::move(reader)), + writer_(std::move(writer)), file_progress_callback_(file_progress_callback), cancel_requested_(false), weak_factory_(this) {} @@ -502,8 +503,9 @@ class StreamCopyOrMoveImpl NotifyOnStartUpdate(dest_url_); DCHECK(!copy_helper_); copy_helper_.reset(new CopyOrMoveOperationDelegate::StreamCopyHelper( - reader_.Pass(), writer_.Pass(), dest_url_.mount_option().flush_policy(), - kReadBufferSize, file_progress_callback_, + std::move(reader_), std::move(writer_), + dest_url_.mount_option().flush_policy(), kReadBufferSize, + file_progress_callback_, base::TimeDelta::FromMilliseconds( kMinProgressCallbackInvocationSpanInMilliseconds))); copy_helper_->Run( @@ -593,8 +595,8 @@ CopyOrMoveOperationDelegate::StreamCopyHelper::StreamCopyHelper( int buffer_size, const FileSystemOperation::CopyFileProgressCallback& file_progress_callback, const base::TimeDelta& min_progress_callback_invocation_span) - : reader_(reader.Pass()), - writer_(writer.Pass()), + : reader_(std::move(reader)), + writer_(std::move(writer)), flush_policy_(flush_policy), file_progress_callback_(file_progress_callback), io_buffer_(new net::IOBufferWithSize(buffer_size)), @@ -603,8 +605,7 @@ CopyOrMoveOperationDelegate::StreamCopyHelper::StreamCopyHelper( min_progress_callback_invocation_span_( min_progress_callback_invocation_span), cancel_requested_(false), - weak_factory_(this) { -} + weak_factory_(this) {} CopyOrMoveOperationDelegate::StreamCopyHelper::~StreamCopyHelper() { } @@ -824,17 +825,10 @@ void CopyOrMoveOperationDelegate::ProcessFile( file_system_context()->CreateFileStreamWriter(dest_url, 0); if (reader && writer) { impl = new StreamCopyOrMoveImpl( - operation_runner(), - file_system_context(), - operation_type_, - src_url, - dest_url, - option_, - reader.Pass(), - writer.Pass(), + operation_runner(), file_system_context(), operation_type_, src_url, + dest_url, option_, std::move(reader), std::move(writer), base::Bind(&CopyOrMoveOperationDelegate::OnCopyFileProgress, - weak_factory_.GetWeakPtr(), - src_url)); + weak_factory_.GetWeakPtr(), src_url)); } } diff --git a/storage/browser/fileapi/file_system_context.cc b/storage/browser/fileapi/file_system_context.cc index 5ded6c3..6d84f1e 100644 --- a/storage/browser/fileapi/file_system_context.cc +++ b/storage/browser/fileapi/file_system_context.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -159,7 +160,7 @@ FileSystemContext::FileSystemContext( partition_path, special_storage_policy, options)), - additional_backends_(additional_backends.Pass()), + additional_backends_(std::move(additional_backends)), auto_mount_handlers_(auto_mount_handlers), external_mount_points_(external_mount_points), partition_path_(partition_path), diff --git a/storage/browser/fileapi/file_system_operation_impl.cc b/storage/browser/fileapi/file_system_operation_impl.cc index 84d80f6..15700f0 100644 --- a/storage/browser/fileapi/file_system_operation_impl.cc +++ b/storage/browser/fileapi/file_system_operation_impl.cc @@ -5,8 +5,8 @@ #include "storage/browser/fileapi/file_system_operation_impl.h" #include <stdint.h> - #include <limits> +#include <utility> #include "base/bind.h" #include "base/single_thread_task_runner.h" @@ -49,7 +49,7 @@ void DidOpenFile( base::Bind(&Destruct, base::Passed(&file))); return; } - callback.Run(file.Pass(), on_close_callback); + callback.Run(std::move(file), on_close_callback); } } // namespace @@ -59,7 +59,7 @@ FileSystemOperation* FileSystemOperation::Create( FileSystemContext* file_system_context, scoped_ptr<FileSystemOperationContext> operation_context) { return new FileSystemOperationImpl(url, file_system_context, - operation_context.Pass()); + std::move(operation_context)); } FileSystemOperationImpl::~FileSystemOperationImpl() { @@ -135,7 +135,7 @@ void FileSystemOperationImpl::DirectoryExists(const FileSystemURL& url, const StatusCallback& callback) { DCHECK(SetPendingOperationType(kOperationDirectoryExists)); async_file_util_->GetFileInfo( - operation_context_.Pass(), url, GET_METADATA_FIELD_IS_DIRECTORY, + std::move(operation_context_), url, GET_METADATA_FIELD_IS_DIRECTORY, base::Bind(&FileSystemOperationImpl::DidDirectoryExists, weak_factory_.GetWeakPtr(), callback)); } @@ -144,7 +144,7 @@ void FileSystemOperationImpl::FileExists(const FileSystemURL& url, const StatusCallback& callback) { DCHECK(SetPendingOperationType(kOperationFileExists)); async_file_util_->GetFileInfo( - operation_context_.Pass(), url, GET_METADATA_FIELD_IS_DIRECTORY, + std::move(operation_context_), url, GET_METADATA_FIELD_IS_DIRECTORY, base::Bind(&FileSystemOperationImpl::DidFileExists, weak_factory_.GetWeakPtr(), callback)); } @@ -153,15 +153,14 @@ void FileSystemOperationImpl::GetMetadata(const FileSystemURL& url, int fields, const GetMetadataCallback& callback) { DCHECK(SetPendingOperationType(kOperationGetMetadata)); - async_file_util_->GetFileInfo(operation_context_.Pass(), url, fields, + async_file_util_->GetFileInfo(std::move(operation_context_), url, fields, callback); } void FileSystemOperationImpl::ReadDirectory( const FileSystemURL& url, const ReadDirectoryCallback& callback) { DCHECK(SetPendingOperationType(kOperationReadDirectory)); - async_file_util_->ReadDirectory( - operation_context_.Pass(), url, callback); + async_file_util_->ReadDirectory(std::move(operation_context_), url, callback); } void FileSystemOperationImpl::Remove(const FileSystemURL& url, @@ -175,7 +174,7 @@ void FileSystemOperationImpl::Remove(const FileSystemURL& url, // first. If not supported, it is delegated to RemoveOperationDelegate // in DidDeleteRecursively. async_file_util_->DeleteRecursively( - operation_context_.Pass(), url, + std::move(operation_context_), url, base::Bind(&FileSystemOperationImpl::DidDeleteRecursively, weak_factory_.GetWeakPtr(), url, callback)); return; @@ -195,11 +194,11 @@ void FileSystemOperationImpl::Write( scoped_ptr<net::URLRequest> blob_request, const WriteCallback& callback) { DCHECK(SetPendingOperationType(kOperationWrite)); - file_writer_delegate_ = writer_delegate.Pass(); + file_writer_delegate_ = std::move(writer_delegate); file_writer_delegate_->Start( - blob_request.Pass(), - base::Bind(&FileSystemOperationImpl::DidWrite, - weak_factory_.GetWeakPtr(), url, callback)); + std::move(blob_request), + base::Bind(&FileSystemOperationImpl::DidWrite, weak_factory_.GetWeakPtr(), + url, callback)); } void FileSystemOperationImpl::Truncate(const FileSystemURL& url, @@ -227,8 +226,7 @@ void FileSystemOperationImpl::TouchFile(const FileSystemURL& url, TRACE_EVENT0("io", "FileSystemOperationImpl::TouchFile"); async_file_util_->Touch( - operation_context_.Pass(), url, - last_access_time, last_modified_time, + std::move(operation_context_), url, last_access_time, last_modified_time, base::Bind(&FileSystemOperationImpl::DidFinishOperation, weak_factory_.GetWeakPtr(), callback)); } @@ -281,8 +279,8 @@ void FileSystemOperationImpl::CreateSnapshotFile( const FileSystemURL& url, const SnapshotFileCallback& callback) { DCHECK(SetPendingOperationType(kOperationCreateSnapshotFile)); - async_file_util_->CreateSnapshotFile( - operation_context_.Pass(), url, callback); + async_file_util_->CreateSnapshotFile(std::move(operation_context_), url, + callback); } void FileSystemOperationImpl::CopyInForeignFile( @@ -307,7 +305,7 @@ void FileSystemOperationImpl::RemoveFile( const StatusCallback& callback) { DCHECK(SetPendingOperationType(kOperationRemove)); async_file_util_->DeleteFile( - operation_context_.Pass(), url, + std::move(operation_context_), url, base::Bind(&FileSystemOperationImpl::DidFinishOperation, weak_factory_.GetWeakPtr(), callback)); } @@ -317,7 +315,7 @@ void FileSystemOperationImpl::RemoveDirectory( const StatusCallback& callback) { DCHECK(SetPendingOperationType(kOperationRemove)); async_file_util_->DeleteDirectory( - operation_context_.Pass(), url, + std::move(operation_context_), url, base::Bind(&FileSystemOperationImpl::DidFinishOperation, weak_factory_.GetWeakPtr(), callback)); } @@ -378,7 +376,7 @@ FileSystemOperationImpl::FileSystemOperationImpl( FileSystemContext* file_system_context, scoped_ptr<FileSystemOperationContext> operation_context) : file_system_context_(file_system_context), - operation_context_(operation_context.Pass()), + operation_context_(std::move(operation_context)), async_file_util_(NULL), pending_operation_(kOperationNone), weak_factory_(this) { @@ -434,11 +432,10 @@ void FileSystemOperationImpl::DoCreateFile( const StatusCallback& callback, bool exclusive) { async_file_util_->EnsureFileExists( - operation_context_.Pass(), url, + std::move(operation_context_), url, base::Bind( - exclusive ? - &FileSystemOperationImpl::DidEnsureFileExistsExclusive : - &FileSystemOperationImpl::DidEnsureFileExistsNonExclusive, + exclusive ? &FileSystemOperationImpl::DidEnsureFileExistsExclusive + : &FileSystemOperationImpl::DidEnsureFileExistsNonExclusive, weak_factory_.GetWeakPtr(), callback)); } @@ -447,8 +444,7 @@ void FileSystemOperationImpl::DoCreateDirectory( const StatusCallback& callback, bool exclusive, bool recursive) { async_file_util_->CreateDirectory( - operation_context_.Pass(), - url, exclusive, recursive, + std::move(operation_context_), url, exclusive, recursive, base::Bind(&FileSystemOperationImpl::DidFinishOperation, weak_factory_.GetWeakPtr(), callback)); } @@ -460,7 +456,8 @@ void FileSystemOperationImpl::DoCopyFileLocal( const CopyFileProgressCallback& progress_callback, const StatusCallback& callback) { async_file_util_->CopyFileLocal( - operation_context_.Pass(), src_url, dest_url, option, progress_callback, + std::move(operation_context_), src_url, dest_url, option, + progress_callback, base::Bind(&FileSystemOperationImpl::DidFinishOperation, weak_factory_.GetWeakPtr(), callback)); } @@ -471,7 +468,7 @@ void FileSystemOperationImpl::DoMoveFileLocal( CopyOrMoveOption option, const StatusCallback& callback) { async_file_util_->MoveFileLocal( - operation_context_.Pass(), src_url, dest_url, option, + std::move(operation_context_), src_url, dest_url, option, base::Bind(&FileSystemOperationImpl::DidFinishOperation, weak_factory_.GetWeakPtr(), callback)); } @@ -481,8 +478,7 @@ void FileSystemOperationImpl::DoCopyInForeignFile( const FileSystemURL& dest_url, const StatusCallback& callback) { async_file_util_->CopyInForeignFile( - operation_context_.Pass(), - src_local_disk_file_path, dest_url, + std::move(operation_context_), src_local_disk_file_path, dest_url, base::Bind(&FileSystemOperationImpl::DidFinishOperation, weak_factory_.GetWeakPtr(), callback)); } @@ -491,7 +487,7 @@ void FileSystemOperationImpl::DoTruncate(const FileSystemURL& url, const StatusCallback& callback, int64_t length) { async_file_util_->Truncate( - operation_context_.Pass(), url, length, + std::move(operation_context_), url, length, base::Bind(&FileSystemOperationImpl::DidFinishOperation, weak_factory_.GetWeakPtr(), callback)); } @@ -500,9 +496,9 @@ void FileSystemOperationImpl::DoOpenFile(const FileSystemURL& url, const OpenFileCallback& callback, int file_flags) { async_file_util_->CreateOrOpen( - operation_context_.Pass(), url, file_flags, - base::Bind(&DidOpenFile, - file_system_context_, weak_factory_.GetWeakPtr(), callback)); + std::move(operation_context_), url, file_flags, + base::Bind(&DidOpenFile, file_system_context_, weak_factory_.GetWeakPtr(), + callback)); } void FileSystemOperationImpl::DidEnsureFileExistsExclusive( diff --git a/storage/browser/fileapi/file_system_operation_runner.cc b/storage/browser/fileapi/file_system_operation_runner.cc index 0ca729b..20a957b 100644 --- a/storage/browser/fileapi/file_system_operation_runner.cc +++ b/storage/browser/fileapi/file_system_operation_runner.cc @@ -5,6 +5,7 @@ #include "storage/browser/fileapi/file_system_operation_runner.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -262,18 +263,17 @@ OperationID FileSystemOperationRunner::Write( return handle.id; } - scoped_ptr<FileWriterDelegate> writer_delegate( - new FileWriterDelegate(writer.Pass(), url.mount_option().flush_policy())); + scoped_ptr<FileWriterDelegate> writer_delegate(new FileWriterDelegate( + std::move(writer), url.mount_option().flush_policy())); scoped_ptr<net::URLRequest> blob_request( storage::BlobProtocolHandler::CreateBlobRequest( - blob.Pass(), url_request_context, writer_delegate.get())); + std::move(blob), url_request_context, writer_delegate.get())); PrepareForWrite(handle.id, url); - operation->Write( - url, writer_delegate.Pass(), blob_request.Pass(), - base::Bind(&FileSystemOperationRunner::DidWrite, AsWeakPtr(), - handle, callback)); + operation->Write(url, std::move(writer_delegate), std::move(blob_request), + base::Bind(&FileSystemOperationRunner::DidWrite, AsWeakPtr(), + handle, callback)); return handle.id; } @@ -591,7 +591,7 @@ void FileSystemOperationRunner::DidOpenFile( on_close_callback)); return; } - callback.Run(file.Pass(), on_close_callback); + callback.Run(std::move(file), on_close_callback); FinishOperation(handle.id); } diff --git a/storage/browser/fileapi/file_writer_delegate.cc b/storage/browser/fileapi/file_writer_delegate.cc index 8ccf846..2b1354e 100644 --- a/storage/browser/fileapi/file_writer_delegate.cc +++ b/storage/browser/fileapi/file_writer_delegate.cc @@ -5,6 +5,7 @@ #include "storage/browser/fileapi/file_writer_delegate.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -25,15 +26,14 @@ static const int kReadBufSize = 32768; FileWriterDelegate::FileWriterDelegate( scoped_ptr<FileStreamWriter> file_stream_writer, FlushPolicy flush_policy) - : file_stream_writer_(file_stream_writer.Pass()), + : file_stream_writer_(std::move(file_stream_writer)), writing_started_(false), flush_policy_(flush_policy), bytes_written_backlog_(0), bytes_written_(0), bytes_read_(0), io_buffer_(new net::IOBufferWithSize(kReadBufSize)), - weak_factory_(this) { -} + weak_factory_(this) {} FileWriterDelegate::~FileWriterDelegate() { } @@ -41,7 +41,7 @@ FileWriterDelegate::~FileWriterDelegate() { void FileWriterDelegate::Start(scoped_ptr<net::URLRequest> request, const DelegateWriteCallback& write_callback) { write_callback_ = write_callback; - request_ = request.Pass(); + request_ = std::move(request); request_->Start(); } diff --git a/storage/browser/fileapi/obfuscated_file_util.cc b/storage/browser/fileapi/obfuscated_file_util.cc index cbe2739..cdd8b7a 100644 --- a/storage/browser/fileapi/obfuscated_file_util.cc +++ b/storage/browser/fileapi/obfuscated_file_util.cc @@ -281,7 +281,7 @@ base::File ObfuscatedFileUtil::CreateOrOpen( sandbox_delegate_) { sandbox_delegate_->StickyInvalidateUsageCache(url.origin(), url.type()); } - return file.Pass(); + return file; } base::File::Error ObfuscatedFileUtil::EnsureFileExists( @@ -1064,7 +1064,7 @@ base::File ObfuscatedFileUtil::CreateAndOpenFile( base::File file = NativeFileUtil::CreateOrOpen(dest_local_path, file_flags); if (!file.IsValid()) - return file.Pass(); + return file; if (!file.created()) { file.Close(); @@ -1079,7 +1079,7 @@ base::File ObfuscatedFileUtil::CreateAndOpenFile( return base::File(error); } - return file.Pass(); + return file; } base::File::Error ObfuscatedFileUtil::CreateFile( @@ -1374,7 +1374,7 @@ base::File ObfuscatedFileUtil::CreateOrOpenInternal( context->change_observers()->Notify( &FileChangeObserver::OnCreateFile, base::MakeTuple(url)); } - return file.Pass(); + return file; } if (file_flags & base::File::FLAG_CREATE) @@ -1408,7 +1408,7 @@ base::File ObfuscatedFileUtil::CreateOrOpenInternal( LOG(WARNING) << "Lost a backing file."; return base::File(base::File::FILE_ERROR_FAILED); } - return file.Pass(); + return file; } // If truncating we need to update the usage. @@ -1417,7 +1417,7 @@ base::File ObfuscatedFileUtil::CreateOrOpenInternal( context->change_observers()->Notify( &FileChangeObserver::OnModifyFile, base::MakeTuple(url)); } - return file.Pass(); + return file; } bool ObfuscatedFileUtil::HasIsolatedStorage(const GURL& origin) { diff --git a/storage/browser/fileapi/plugin_private_file_system_backend.cc b/storage/browser/fileapi/plugin_private_file_system_backend.cc index f1a1beb..2eb36ff 100644 --- a/storage/browser/fileapi/plugin_private_file_system_backend.cc +++ b/storage/browser/fileapi/plugin_private_file_system_backend.cc @@ -5,8 +5,8 @@ #include "storage/browser/fileapi/plugin_private_file_system_backend.h" #include <stdint.h> - #include <map> +#include <utility> #include "base/stl_util.h" #include "base/synchronization/lock.h" @@ -182,7 +182,8 @@ FileSystemOperation* PluginPrivateFileSystemBackend::CreateFileSystemOperation( base::File::Error* error_code) const { scoped_ptr<FileSystemOperationContext> operation_context( new FileSystemOperationContext(context)); - return FileSystemOperation::Create(url, context, operation_context.Pass()); + return FileSystemOperation::Create(url, context, + std::move(operation_context)); } bool PluginPrivateFileSystemBackend::SupportsStreaming( diff --git a/storage/browser/fileapi/quota/quota_reservation_manager.cc b/storage/browser/fileapi/quota/quota_reservation_manager.cc index 6b69191..b6d2387 100644 --- a/storage/browser/fileapi/quota/quota_reservation_manager.cc +++ b/storage/browser/fileapi/quota/quota_reservation_manager.cc @@ -5,6 +5,7 @@ #include "storage/browser/fileapi/quota/quota_reservation_manager.h" #include <stdint.h> +#include <utility> #include "storage/browser/fileapi/quota/quota_reservation.h" #include "storage/browser/fileapi/quota/quota_reservation_buffer.h" @@ -13,8 +14,7 @@ namespace storage { QuotaReservationManager::QuotaReservationManager( scoped_ptr<QuotaBackend> backend) - : backend_(backend.Pass()), - weak_ptr_factory_(this) { + : backend_(std::move(backend)), weak_ptr_factory_(this) { sequence_checker_.DetachFromSequence(); } diff --git a/storage/browser/fileapi/sandbox_file_system_backend.cc b/storage/browser/fileapi/sandbox_file_system_backend.cc index c8b7f37..2b64193 100644 --- a/storage/browser/fileapi/sandbox_file_system_backend.cc +++ b/storage/browser/fileapi/sandbox_file_system_backend.cc @@ -5,6 +5,7 @@ #include "storage/browser/fileapi/sandbox_file_system_backend.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/files/file_util.h" @@ -119,7 +120,8 @@ FileSystemOperation* SandboxFileSystemBackend::CreateFileSystemOperation( else operation_context->set_quota_limit_type(storage::kQuotaLimitTypeLimited); - return FileSystemOperation::Create(url, context, operation_context.Pass()); + return FileSystemOperation::Create(url, context, + std::move(operation_context)); } bool SandboxFileSystemBackend::SupportsStreaming( diff --git a/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc b/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc index a7f1d83..5e3138f 100644 --- a/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc +++ b/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc @@ -294,7 +294,7 @@ SandboxFileSystemBackendDelegate::CreateFileSystemOperationContext( operation_context->set_change_observers( change_observers ? *change_observers : ChangeObserverList()); - return operation_context.Pass(); + return operation_context; } scoped_ptr<storage::FileStreamReader> diff --git a/storage/browser/fileapi/timed_task_helper.cc b/storage/browser/fileapi/timed_task_helper.cc index f16f8b8..69635d0 100644 --- a/storage/browser/fileapi/timed_task_helper.cc +++ b/storage/browser/fileapi/timed_task_helper.cc @@ -4,6 +4,8 @@ #include "storage/browser/fileapi/timed_task_helper.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/sequenced_task_runner.h" @@ -64,14 +66,14 @@ void TimedTaskHelper::Fired(scoped_ptr<Tracker> tracker) { if (!tracker->timer) return; TimedTaskHelper* timer = tracker->timer; - timer->OnFired(tracker.Pass()); + timer->OnFired(std::move(tracker)); } void TimedTaskHelper::OnFired(scoped_ptr<Tracker> tracker) { DCHECK(task_runner_->RunsTasksOnCurrentThread()); base::TimeTicks now = base::TimeTicks::Now(); if (desired_run_time_ > now) { - PostDelayedTask(tracker.Pass(), desired_run_time_ - now); + PostDelayedTask(std::move(tracker), desired_run_time_ - now); return; } tracker.reset(); diff --git a/storage/browser/fileapi/transient_file_util.cc b/storage/browser/fileapi/transient_file_util.cc index c0c2a6b..426b73d 100644 --- a/storage/browser/fileapi/transient_file_util.cc +++ b/storage/browser/fileapi/transient_file_util.cc @@ -49,7 +49,7 @@ ScopedFile TransientFileUtil::CreateSnapshotFile( scoped_file.AddScopeOutCallback( base::Bind(&RevokeFileSystem, url.filesystem_id()), NULL); - return scoped_file.Pass(); + return scoped_file; } } // namespace storage diff --git a/storage/browser/quota/quota_manager.cc b/storage/browser/quota/quota_manager.cc index aa8a9f6..7f6cec3 100644 --- a/storage/browser/quota/quota_manager.cc +++ b/storage/browser/quota/quota_manager.cc @@ -6,10 +6,10 @@ #include <stddef.h> #include <stdint.h> - #include <algorithm> #include <functional> #include <limits> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -1004,7 +1004,7 @@ void QuotaManager::SetUsageCacheEnabled(QuotaClient::ID client_id, void QuotaManager::SetTemporaryStorageEvictionPolicy( scoped_ptr<QuotaEvictionPolicy> policy) { - temporary_storage_eviction_policy_ = policy.Pass(); + temporary_storage_eviction_policy_ = std::move(policy); } void QuotaManager::DeleteOriginData(const GURL& origin, |