diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-11-20 15:06:40 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-11-22 11:48:58 +0000 |
commit | daa093eea7c773db06799a13bd7e4e2e2a9f8f14 (patch) | |
tree | 96cc5e7b9194c1b29eab927730bfa419e7111c25 /chromium/storage | |
parent | be59a35641616a4cf23c4a13fa0632624b021c1b (diff) | |
download | qtwebengine-chromium-daa093eea7c773db06799a13bd7e4e2e2a9f8f14.tar.gz |
BASELINE: Update Chromium to 63.0.3239.58
Change-Id: Ia93b322a00ba4dd4004f3bcf1254063ba90e1605
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/storage')
36 files changed, 125 insertions, 104 deletions
diff --git a/chromium/storage/browser/blob/blob_memory_controller.cc b/chromium/storage/browser/blob/blob_memory_controller.cc index 8503d09c6da..8bc1628a3f4 100644 --- a/chromium/storage/browser/blob/blob_memory_controller.cc +++ b/chromium/storage/browser/blob/blob_memory_controller.cc @@ -793,7 +793,7 @@ size_t BlobMemoryController::CollectItemsForEviction( size_t size = base::checked_cast<size_t>(item->item()->length()); populated_memory_items_bytes_ -= size; total_items_size += size; - output->push_back(make_scoped_refptr(item)); + output->push_back(base::WrapRefCounted(item)); } return total_items_size.ValueOrDie(); } diff --git a/chromium/storage/browser/blob/blob_memory_controller_unittest.cc b/chromium/storage/browser/blob/blob_memory_controller_unittest.cc index 2ab02f0ea86..ca71ad80e20 100644 --- a/chromium/storage/browser/blob/blob_memory_controller_unittest.cc +++ b/chromium/storage/browser/blob/blob_memory_controller_unittest.cc @@ -78,8 +78,8 @@ class BlobMemoryControllerTest : public testing::Test { const BlobDataBuilder& builder) { std::vector<scoped_refptr<ShareableBlobDataItem>> result; for (size_t i = 0; i < builder.items_.size(); ++i) { - result.push_back(make_scoped_refptr(new ShareableBlobDataItem( - builder.items_[i], ShareableBlobDataItem::QUOTA_NEEDED))); + result.push_back(base::MakeRefCounted<ShareableBlobDataItem>( + builder.items_[i], ShareableBlobDataItem::QUOTA_NEEDED)); } return result; } diff --git a/chromium/storage/browser/blob/blob_reader_unittest.cc b/chromium/storage/browser/blob/blob_reader_unittest.cc index 38fa4b57094..7c04f200168 100644 --- a/chromium/storage/browser/blob/blob_reader_unittest.cc +++ b/chromium/storage/browser/blob/blob_reader_unittest.cc @@ -251,7 +251,7 @@ class FakeFileStreamReader : public FileStreamReader { async_task_runner_->PostTask( FROM_HERE, base::Bind(base::IgnoreResult(&FakeFileStreamReader::ReadImpl), - base::Unretained(this), make_scoped_refptr(buf), + base::Unretained(this), base::WrapRefCounted(buf), buf_length, done)); } else { async_task_runner_->PostTask(FROM_HERE, base::Bind(done, net_error_)); diff --git a/chromium/storage/browser/blob/blob_registry_impl_unittest.cc b/chromium/storage/browser/blob/blob_registry_impl_unittest.cc index 9ba6384506d..8dce82e9f30 100644 --- a/chromium/storage/browser/blob/blob_registry_impl_unittest.cc +++ b/chromium/storage/browser/blob/blob_registry_impl_unittest.cc @@ -173,8 +173,8 @@ class BlobRegistryImplTest : public testing::Test { mojom::BytesProviderPtr CreateBytesProvider(const std::string& bytes) { if (!bytes_provider_runner_) { - bytes_provider_runner_ = base::CreateSequencedTaskRunnerWithTraits( - {base::MayBlock(), base::WithBaseSyncPrimitives()}); + bytes_provider_runner_ = + base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()}); } mojom::BytesProviderPtr result; auto provider = base::MakeUnique<MockBytesProvider>( @@ -189,8 +189,8 @@ class BlobRegistryImplTest : public testing::Test { void CreateBytesProvider(const std::string& bytes, mojom::BytesProviderRequest request) { if (!bytes_provider_runner_) { - bytes_provider_runner_ = base::CreateSequencedTaskRunnerWithTraits( - {base::MayBlock(), base::WithBaseSyncPrimitives()}); + bytes_provider_runner_ = + base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()}); } auto provider = base::MakeUnique<MockBytesProvider>( std::vector<uint8_t>(bytes.begin(), bytes.end()), &reply_request_count_, diff --git a/chromium/storage/browser/blob/blob_storage_context.cc b/chromium/storage/browser/blob/blob_storage_context.cc index d9b2fa3297d..60657fe36ad 100644 --- a/chromium/storage/browser/blob/blob_storage_context.cc +++ b/chromium/storage/browser/blob/blob_storage_context.cc @@ -168,7 +168,10 @@ BlobStorageContext::BlobFlattener::BlobFlattener( } // Validate our reference has good offset & length. - if (input_element.offset() + length > ref_entry->total_size()) { + uint64_t end_byte; + if (!base::CheckAdd(input_element.offset(), length) + .AssignIfValid(&end_byte) || + end_byte > ref_entry->total_size()) { status = BlobStatus::ERR_INVALID_CONSTRUCTION_ARGUMENTS; return; } diff --git a/chromium/storage/browser/blob/blob_storage_context_unittest.cc b/chromium/storage/browser/blob/blob_storage_context_unittest.cc index a0b699f4f85..8d11c70bb36 100644 --- a/chromium/storage/browser/blob/blob_storage_context_unittest.cc +++ b/chromium/storage/browser/blob/blob_storage_context_unittest.cc @@ -889,6 +889,24 @@ TEST_F(BlobStorageContextTest, BuildBlobCombinations) { EXPECT_EQ(0lu, context_->memory_controller().disk_usage()); } +TEST_F(BlobStorageContextTest, NegativeSlice) { + const std::string kId1("id1"); + const std::string kId2("id2"); + + std::unique_ptr<BlobDataHandle> handle = SetupBasicBlob(kId1); + + EXPECT_EQ(1lu, context_->memory_controller().memory_usage()); + + BlobDataBuilder builder(kId2); + builder.AppendBlob(kId1, static_cast<uint64_t>(-10), 11); + std::unique_ptr<BlobDataHandle> handle2 = context_->BuildBlob( + builder, BlobStorageContext::TransportAllowedCallback()); + + EXPECT_TRUE(handle2->IsBroken()); + EXPECT_EQ(BlobStatus::ERR_INVALID_CONSTRUCTION_ARGUMENTS, + handle2->GetBlobStatus()); +} + // TODO(michaeln): tests for the deprecated url stuff } // namespace storage diff --git a/chromium/storage/browser/blob/blob_transport_request_builder_unittest.cc b/chromium/storage/browser/blob/blob_transport_request_builder_unittest.cc index 71e0956113f..10f40f04086 100644 --- a/chromium/storage/browser/blob/blob_transport_request_builder_unittest.cc +++ b/chromium/storage/browser/blob/blob_transport_request_builder_unittest.cc @@ -20,7 +20,7 @@ const char kFakeBlobUUID[] = "fakeBlob"; void AddMemoryItem(size_t length, std::vector<DataElement>* out) { DataElement bytes; bytes.SetToBytesDescription(length); - out->push_back(bytes); + out->push_back(std::move(bytes)); } void AddShortcutMemoryItem(size_t length, std::vector<DataElement>* out) { @@ -29,13 +29,13 @@ void AddShortcutMemoryItem(size_t length, std::vector<DataElement>* out) { for (size_t i = 0; i < length; i++) { bytes.mutable_bytes()[i] = static_cast<char>(i); } - out->push_back(bytes); + out->push_back(std::move(bytes)); } void AddBlobItem(std::vector<DataElement>* out) { DataElement blob; blob.SetToBlob(kFakeBlobUUID); - out->push_back(blob); + out->push_back(std::move(blob)); } TEST(BlobAsyncTransportRequestBuilderTest, TestNoMemoryItems) { diff --git a/chromium/storage/browser/blob/blob_transport_strategy.cc b/chromium/storage/browser/blob/blob_transport_strategy.cc index 99f73a897f2..2bbbd8a6e97 100644 --- a/chromium/storage/browser/blob/blob_transport_strategy.cc +++ b/chromium/storage/browser/blob/blob_transport_strategy.cc @@ -4,6 +4,7 @@ #include "storage/browser/blob/blob_transport_strategy.h" +#include "base/containers/circular_deque.h" #include "mojo/public/cpp/system/data_pipe.h" #include "storage/browser/blob/blob_data_builder.h" #include "storage/public/interfaces/blobs.mojom.h" @@ -228,7 +229,7 @@ class DataPipeTransportStrategy : public BlobTransportStrategy { } const BlobStorageLimits& limits_; - std::deque<base::OnceClosure> requests_; + base::circular_deque<base::OnceClosure> requests_; mojo::ScopedDataPipeConsumerHandle consumer_handle_; mojo::SimpleWatcher watcher_; diff --git a/chromium/storage/browser/blob/blob_transport_strategy_unittest.cc b/chromium/storage/browser/blob/blob_transport_strategy_unittest.cc index d8764031a2f..2440d428df1 100644 --- a/chromium/storage/browser/blob/blob_transport_strategy_unittest.cc +++ b/chromium/storage/browser/blob/blob_transport_strategy_unittest.cc @@ -45,8 +45,8 @@ class BlobTransportStrategyTest : public testing::Test { void SetUp() override { ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); - bytes_provider_runner_ = base::CreateSequencedTaskRunnerWithTraits( - {base::MayBlock(), base::WithBaseSyncPrimitives()}); + bytes_provider_runner_ = + base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()}); mock_time_ = base::Time::Now(); limits_.max_ipc_memory_size = kTestBlobStorageIPCThresholdBytes; diff --git a/chromium/storage/browser/fileapi/copy_or_move_operation_delegate.h b/chromium/storage/browser/fileapi/copy_or_move_operation_delegate.h index 651d5a5457d..b6c807f41ed 100644 --- a/chromium/storage/browser/fileapi/copy_or_move_operation_delegate.h +++ b/chromium/storage/browser/fileapi/copy_or_move_operation_delegate.h @@ -9,7 +9,6 @@ #include <map> #include <memory> -#include <stack> #include "base/macros.h" #include "base/memory/ref_counted.h" diff --git a/chromium/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc b/chromium/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc index 1ab2f8774d5..1442550e428 100644 --- a/chromium/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc +++ b/chromium/storage/browser/fileapi/copy_or_move_operation_delegate_unittest.cc @@ -5,10 +5,10 @@ #include <stddef.h> #include <stdint.h> #include <map> -#include <queue> #include <utility> #include "base/bind.h" +#include "base/containers/queue.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/location.h" @@ -319,7 +319,7 @@ class CopyOrMoveOperationTestHelper { &test_cases[i]; } - std::queue<FileSystemURL> directories; + base::queue<FileSystemURL> directories; FileEntryList entries; directories.push(root); while (!directories.empty()) { diff --git a/chromium/storage/browser/fileapi/dragged_file_util_unittest.cc b/chromium/storage/browser/fileapi/dragged_file_util_unittest.cc index 5d53cfcb8d6..01fbc7ab0f2 100644 --- a/chromium/storage/browser/fileapi/dragged_file_util_unittest.cc +++ b/chromium/storage/browser/fileapi/dragged_file_util_unittest.cc @@ -6,11 +6,11 @@ #include <map> #include <memory> -#include <queue> #include <set> #include <string> #include <vector> +#include "base/containers/queue.h" #include "base/files/file_enumerator.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" @@ -47,10 +47,8 @@ typedef AsyncFileTestHelper::FileEntryList FileEntryList; // Random root paths in which we create each file/directory of the // RegularTestCases (so that we can simulate a drop with files/directories // from multiple directories). -static const base::FilePath::CharType* kRootPaths[] = { - FILE_PATH_LITERAL("a"), - FILE_PATH_LITERAL("b/c"), - FILE_PATH_LITERAL("etc"), +constexpr const base::FilePath::CharType* kRootPaths[] = { + FILE_PATH_LITERAL("a"), FILE_PATH_LITERAL("b/c"), FILE_PATH_LITERAL("etc"), }; base::FilePath GetTopLevelPath(const base::FilePath& path) { @@ -201,7 +199,7 @@ class DraggedFileUtilTest : public testing::Test { base::FilePath root_path2 = root2.path(); FileEntryList entries; - std::queue<FileSystemURL> directories; + base::queue<FileSystemURL> directories; directories.push(root1); std::set<base::FilePath> file_set1; @@ -429,7 +427,7 @@ TEST_F(DraggedFileUtilTest, CopyOutFileTest) { FileSystemURL dest_root = GetOtherFileSystemURL(base::FilePath()); FileEntryList entries; - std::queue<FileSystemURL> directories; + base::queue<FileSystemURL> directories; directories.push(src_root); ASSERT_EQ(base::File::FILE_OK, diff --git a/chromium/storage/browser/fileapi/dump_file_system.cc b/chromium/storage/browser/fileapi/dump_file_system.cc index b72b4b0bd6e..03595909cf0 100644 --- a/chromium/storage/browser/fileapi/dump_file_system.cc +++ b/chromium/storage/browser/fileapi/dump_file_system.cc @@ -33,11 +33,11 @@ #include <stdio.h> #include <stdlib.h> -#include <stack> #include <string> #include <utility> #include <vector> +#include "base/containers/stack.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/format_macros.h" @@ -85,8 +85,7 @@ static void DumpDirectoryTree(const std::string& origin_name, if (!directory_db.GetFileWithPath(StringToFilePath("/"), &root_id)) return; - std::stack<std::pair<SandboxDirectoryDatabase::FileId, - std::string> > paths; + base::stack<std::pair<SandboxDirectoryDatabase::FileId, std::string>> paths; paths.push(std::make_pair(root_id, "")); while (!paths.empty()) { SandboxDirectoryDatabase::FileId id = paths.top().first; diff --git a/chromium/storage/browser/fileapi/file_system_context.cc b/chromium/storage/browser/fileapi/file_system_context.cc index 2271d93ed25..495b2a5077f 100644 --- a/chromium/storage/browser/fileapi/file_system_context.cc +++ b/chromium/storage/browser/fileapi/file_system_context.cc @@ -108,9 +108,7 @@ int FileSystemContext::GetPermissionPolicy(FileSystemType type) { FILE_PERMISSION_USE_FILE_PERMISSION; case kFileSystemTypeDeviceMedia: - case kFileSystemTypeItunes: case kFileSystemTypeNativeMedia: - case kFileSystemTypePicasa: return FILE_PERMISSION_USE_FILE_PERMISSION; // Following types are only accessed via IsolatedFileSystem, and @@ -243,8 +241,8 @@ FileSystemContext::CreateQuotaReservationOnFileTaskRunner( void FileSystemContext::Shutdown() { if (!io_task_runner_->RunsTasksInCurrentSequence()) { io_task_runner_->PostTask( - FROM_HERE, base::Bind(&FileSystemContext::Shutdown, - make_scoped_refptr(this))); + FROM_HERE, + base::Bind(&FileSystemContext::Shutdown, base::WrapRefCounted(this))); return; } operation_runner_->Shutdown(); diff --git a/chromium/storage/browser/fileapi/file_writer_delegate.cc b/chromium/storage/browser/fileapi/file_writer_delegate.cc index f84ae46879c..e0593e32351 100644 --- a/chromium/storage/browser/fileapi/file_writer_delegate.cc +++ b/chromium/storage/browser/fileapi/file_writer_delegate.cc @@ -50,8 +50,9 @@ void FileWriterDelegate::Start(std::unique_ptr<net::URLRequest> request, } void FileWriterDelegate::Cancel() { - // Destroy the request to prevent it from invoking any callbacks. + // Destroy the request and invalidate weak ptrs to prevent pending callbacks. request_.reset(); + weak_factory_.InvalidateWeakPtrs(); const int status = file_stream_writer_->Cancel( base::Bind(&FileWriterDelegate::OnWriteCancelled, @@ -181,8 +182,9 @@ FileWriterDelegate::GetCompletionStatusOnError() const { } void FileWriterDelegate::OnError(base::File::Error error) { - // Destroy the request to prevent it from invoking any callbacks. + // Destroy the request and invalidate weak ptrs to prevent pending callbacks. request_.reset(); + weak_factory_.InvalidateWeakPtrs(); if (writing_started_) MaybeFlushForCompletion(error, 0, ERROR_WRITE_STARTED); diff --git a/chromium/storage/browser/fileapi/obfuscated_file_util.cc b/chromium/storage/browser/fileapi/obfuscated_file_util.cc index 9ff8148928d..8aca44a82f2 100644 --- a/chromium/storage/browser/fileapi/obfuscated_file_util.cc +++ b/chromium/storage/browser/fileapi/obfuscated_file_util.cc @@ -8,9 +8,9 @@ #include <stdint.h> #include <memory> -#include <queue> #include <tuple> +#include "base/containers/queue.h" #include "base/files/file_util.h" #include "base/format_macros.h" #include "base/logging.h" @@ -200,7 +200,7 @@ class ObfuscatedFileEnumerator final FileSystemURL root_url_; bool recursive_; - std::queue<FileRecord> recurse_queue_; + base::queue<FileRecord> recurse_queue_; std::vector<FileId> display_stack_; base::FilePath current_parent_virtual_path_; @@ -862,6 +862,9 @@ bool ObfuscatedFileUtil::DeleteDirectoryForOriginAndType( DestroyDirectoryDatabase(origin, type_string); const base::FilePath origin_path = GetDirectoryForOrigin(origin, false, NULL); + if (origin_path.empty()) + return true; + if (!type_string.empty()) { // Delete the filesystem type directory. base::File::Error error = base::File::FILE_OK; diff --git a/chromium/storage/browser/fileapi/obfuscated_file_util_unittest.cc b/chromium/storage/browser/fileapi/obfuscated_file_util_unittest.cc index 8c69a366e75..3d18579468b 100644 --- a/chromium/storage/browser/fileapi/obfuscated_file_util_unittest.cc +++ b/chromium/storage/browser/fileapi/obfuscated_file_util_unittest.cc @@ -2472,6 +2472,7 @@ TEST_F(ObfuscatedFileUtilTest, CreateDirectory_NotADirectoryInRecursive) { TEST_F(ObfuscatedFileUtilTest, DeleteDirectoryForOriginAndType) { const GURL origin1("http://www.example.com:12"); const GURL origin2("http://www.example.com:1234"); + const GURL origin3("http://nope.example.com"); // Create origin directories. std::unique_ptr<SandboxFileSystemTestHelper> fs1( @@ -2504,8 +2505,8 @@ TEST_F(ObfuscatedFileUtilTest, DeleteDirectoryForOriginAndType) { ASSERT_EQ(base::File::FILE_OK, error); // Delete a directory for origin1's persistent filesystem. - ofu()->DeleteDirectoryForOriginAndType( - origin1, GetTypeString(kFileSystemTypePersistent)); + ASSERT_TRUE(ofu()->DeleteDirectoryForOriginAndType( + origin1, GetTypeString(kFileSystemTypePersistent))); // The directory for origin1's temporary filesystem should not be removed. error = base::File::FILE_ERROR_FAILED; @@ -2528,6 +2529,22 @@ TEST_F(ObfuscatedFileUtilTest, DeleteDirectoryForOriginAndType) { ofu()->GetDirectoryForOriginAndType( origin2, GetTypeString(kFileSystemTypePersistent), false, &error); ASSERT_EQ(base::File::FILE_OK, error); + + // Make sure origin3's directories don't exist. + error = base::File::FILE_ERROR_FAILED; + ofu()->GetDirectoryForOriginAndType( + origin3, GetTypeString(kFileSystemTypeTemporary), false, &error); + ASSERT_EQ(base::File::FILE_ERROR_NOT_FOUND, error); + error = base::File::FILE_ERROR_FAILED; + ofu()->GetDirectoryForOriginAndType( + origin3, GetTypeString(kFileSystemTypePersistent), false, &error); + ASSERT_EQ(base::File::FILE_ERROR_NOT_FOUND, error); + + // Deleting directories which don't exist is not an error. + ASSERT_TRUE(ofu()->DeleteDirectoryForOriginAndType( + origin3, GetTypeString(kFileSystemTypeTemporary))); + ASSERT_TRUE(ofu()->DeleteDirectoryForOriginAndType( + origin3, GetTypeString(kFileSystemTypePersistent))); } TEST_F(ObfuscatedFileUtilTest, DeleteDirectoryForOriginAndType_DeleteAll) { diff --git a/chromium/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc b/chromium/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc index 78e05df0c30..4a835179169 100644 --- a/chromium/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc +++ b/chromium/storage/browser/fileapi/quota/quota_backend_impl_unittest.cc @@ -18,8 +18,7 @@ #include "storage/browser/fileapi/obfuscated_file_util.h" #include "storage/browser/quota/quota_manager_proxy.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/leveldatabase/src/helpers/memenv/memenv.h" -#include "third_party/leveldatabase/src/include/leveldb/env.h" +#include "third_party/leveldatabase/leveldb_chrome.h" using storage::FileSystemUsageCache; using storage::ObfuscatedFileUtil; @@ -102,7 +101,7 @@ class QuotaBackendImplTest : public testing::Test { void SetUp() override { ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); - in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); + in_memory_env_.reset(leveldb_chrome::NewMemEnv(leveldb::Env::Default())); file_util_.reset(ObfuscatedFileUtil::CreateForTesting( NULL, data_dir_.GetPath(), in_memory_env_.get(), file_task_runner())); backend_.reset(new QuotaBackendImpl(file_task_runner(), file_util_.get(), diff --git a/chromium/storage/browser/fileapi/quota/quota_reservation_buffer.cc b/chromium/storage/browser/fileapi/quota/quota_reservation_buffer.cc index 4f88036ac44..8ed14f54646 100644 --- a/chromium/storage/browser/fileapi/quota/quota_reservation_buffer.cc +++ b/chromium/storage/browser/fileapi/quota/quota_reservation_buffer.cc @@ -31,7 +31,7 @@ QuotaReservationBuffer::QuotaReservationBuffer( scoped_refptr<QuotaReservation> QuotaReservationBuffer::CreateReservation() { DCHECK(sequence_checker_.CalledOnValidSequence()); - return make_scoped_refptr(new QuotaReservation(this)); + return base::WrapRefCounted(new QuotaReservation(this)); } std::unique_ptr<OpenFileHandle> QuotaReservationBuffer::GetOpenFileHandle( diff --git a/chromium/storage/browser/fileapi/quota/quota_reservation_manager.cc b/chromium/storage/browser/fileapi/quota/quota_reservation_manager.cc index b4055dd8f14..55d8ee4766a 100644 --- a/chromium/storage/browser/fileapi/quota/quota_reservation_manager.cc +++ b/chromium/storage/browser/fileapi/quota/quota_reservation_manager.cc @@ -71,7 +71,7 @@ QuotaReservationManager::GetReservationBuffer( *buffer = new QuotaReservationBuffer( weak_ptr_factory_.GetWeakPtr(), origin, type); } - return make_scoped_refptr(*buffer); + return base::WrapRefCounted(*buffer); } void QuotaReservationManager::ReleaseReservationBuffer( diff --git a/chromium/storage/browser/fileapi/recursive_operation_delegate.cc b/chromium/storage/browser/fileapi/recursive_operation_delegate.cc index b2a5a977eff..09cea176793 100644 --- a/chromium/storage/browser/fileapi/recursive_operation_delegate.cc +++ b/chromium/storage/browser/fileapi/recursive_operation_delegate.cc @@ -7,6 +7,7 @@ #include <stddef.h> #include "base/bind.h" +#include "base/containers/queue.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "storage/browser/fileapi/file_system_context.h" @@ -66,7 +67,7 @@ void RecursiveOperationDelegate::DidTryProcessFile( return; } - pending_directory_stack_.push(std::queue<FileSystemURL>()); + pending_directory_stack_.push(base::queue<FileSystemURL>()); pending_directory_stack_.top().push(root); ProcessNextDirectory(); } @@ -96,7 +97,7 @@ void RecursiveOperationDelegate::DidProcessDirectory( } const FileSystemURL& parent = pending_directory_stack_.top().front(); - pending_directory_stack_.push(std::queue<FileSystemURL>()); + pending_directory_stack_.push(base::queue<FileSystemURL>()); operation_runner()->ReadDirectory( parent, base::BindRepeating(&RecursiveOperationDelegate::DidReadDirectory, AsWeakPtr(), parent)); diff --git a/chromium/storage/browser/fileapi/recursive_operation_delegate.h b/chromium/storage/browser/fileapi/recursive_operation_delegate.h index aa47b7246f5..e8bed956890 100644 --- a/chromium/storage/browser/fileapi/recursive_operation_delegate.h +++ b/chromium/storage/browser/fileapi/recursive_operation_delegate.h @@ -5,10 +5,9 @@ #ifndef STORAGE_BROWSER_FILEAPI_RECURSIVE_OPERATION_DELEGATE_H_ #define STORAGE_BROWSER_FILEAPI_RECURSIVE_OPERATION_DELEGATE_H_ -#include <queue> -#include <stack> - #include "base/callback.h" +#include "base/containers/queue.h" +#include "base/containers/stack.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "storage/browser/fileapi/file_system_operation.h" @@ -145,9 +144,9 @@ class STORAGE_EXPORT RecursiveOperationDelegate FileSystemContext* file_system_context_; StatusCallback callback_; - std::stack<FileSystemURL> pending_directories_; - std::stack<std::queue<FileSystemURL> > pending_directory_stack_; - std::queue<FileSystemURL> pending_files_; + base::stack<FileSystemURL> pending_directories_; + base::stack<base::queue<FileSystemURL>> pending_directory_stack_; + base::queue<FileSystemURL> pending_files_; bool canceled_; ErrorBehavior error_behavior_; bool failed_some_operations_; diff --git a/chromium/storage/browser/fileapi/remove_operation_delegate.h b/chromium/storage/browser/fileapi/remove_operation_delegate.h index bf4733d2a1f..722776e98b8 100644 --- a/chromium/storage/browser/fileapi/remove_operation_delegate.h +++ b/chromium/storage/browser/fileapi/remove_operation_delegate.h @@ -5,8 +5,6 @@ #ifndef STORAGE_BROWSER_FILEAPI_REMOVE_OPERATION_DELEGATE_H_ #define STORAGE_BROWSER_FILEAPI_REMOVE_OPERATION_DELEGATE_H_ -#include <stack> - #include "base/macros.h" #include "storage/browser/fileapi/recursive_operation_delegate.h" diff --git a/chromium/storage/browser/fileapi/sandbox_directory_database.cc b/chromium/storage/browser/fileapi/sandbox_directory_database.cc index 4afe5e28cb2..48de43f1a91 100644 --- a/chromium/storage/browser/fileapi/sandbox_directory_database.cc +++ b/chromium/storage/browser/fileapi/sandbox_directory_database.cc @@ -11,8 +11,8 @@ #include <algorithm> #include <memory> #include <set> -#include <stack> +#include "base/containers/stack.h" #include "base/files/file_enumerator.h" #include "base/files/file_util.h" #include "base/location.h" @@ -29,7 +29,7 @@ namespace { -bool PickleFromFileInfo(const storage::SandboxDirectoryDatabase::FileInfo& info, +void PickleFromFileInfo(const storage::SandboxDirectoryDatabase::FileInfo& info, base::Pickle* pickle) { DCHECK(pickle); std::string data_path; @@ -41,14 +41,10 @@ bool PickleFromFileInfo(const storage::SandboxDirectoryDatabase::FileInfo& info, data_path = storage::FilePathToString(info.data_path); name = storage::FilePathToString(base::FilePath(info.name)); - if (pickle->WriteInt64(info.parent_id) && - pickle->WriteString(data_path) && - pickle->WriteString(name) && - pickle->WriteInt64(time.ToInternalValue())) - return true; - - NOTREACHED(); - return false; + pickle->WriteInt64(info.parent_id); + pickle->WriteString(data_path); + pickle->WriteString(name); + pickle->WriteInt64(time.ToInternalValue()); } bool FileInfoFromPickle(const base::Pickle& pickle, @@ -291,7 +287,7 @@ bool DatabaseCheckHelper::ScanDirectory() { }; // Any path in |pending_directories| is relative to |path_|. - std::stack<base::FilePath> pending_directories; + base::stack<base::FilePath> pending_directories; pending_directories.push(base::FilePath()); while (!pending_directories.empty()) { @@ -340,7 +336,7 @@ bool DatabaseCheckHelper::ScanHierarchy() { size_t visited_files = 0; size_t visited_links = 0; - std::stack<FileId> directories; + base::stack<FileId> directories; directories.push(0); // Check if the root directory exists as a directory. @@ -637,8 +633,7 @@ bool SandboxDirectoryDatabase::UpdateModificationTime( return false; info.modification_time = modification_time; base::Pickle pickle; - if (!PickleFromFileInfo(info, &pickle)) - return false; + PickleFromFileInfo(info, &pickle); leveldb::Status status = db_->Put( leveldb::WriteOptions(), GetFileLookupKey(file_id), @@ -669,8 +664,7 @@ bool SandboxDirectoryDatabase::OverwritingMoveFile( if (!RemoveFileInfoHelper(src_file_id, &batch)) return false; base::Pickle pickle; - if (!PickleFromFileInfo(dest_file_info, &pickle)) - return false; + PickleFromFileInfo(dest_file_info, &pickle); batch.Put( GetFileLookupKey(dest_file_id), leveldb::Slice(reinterpret_cast<const char *>(pickle.data()), @@ -917,8 +911,7 @@ bool SandboxDirectoryDatabase::AddFileInfoHelper( batch->Put(child_key, id_string); } base::Pickle pickle; - if (!PickleFromFileInfo(info, &pickle)) - return false; + PickleFromFileInfo(info, &pickle); batch->Put( id_string, leveldb::Slice(reinterpret_cast<const char *>(pickle.data()), @@ -948,9 +941,8 @@ bool SandboxDirectoryDatabase::RemoveFileInfoHelper( return true; } -void SandboxDirectoryDatabase::HandleError( - const tracked_objects::Location& from_here, - const leveldb::Status& status) { +void SandboxDirectoryDatabase::HandleError(const base::Location& from_here, + const leveldb::Status& status) { LOG(ERROR) << "SandboxDirectoryDatabase failed at: " << from_here.ToString() << " with error: " << status.ToString(); db_.reset(); diff --git a/chromium/storage/browser/fileapi/sandbox_directory_database.h b/chromium/storage/browser/fileapi/sandbox_directory_database.h index 6df9f17cd91..16709096e91 100644 --- a/chromium/storage/browser/fileapi/sandbox_directory_database.h +++ b/chromium/storage/browser/fileapi/sandbox_directory_database.h @@ -21,7 +21,7 @@ namespace content { class SandboxDirectoryDatabaseTest; } -namespace tracked_objects { +namespace base { class Location; } @@ -125,7 +125,7 @@ class STORAGE_EXPORT SandboxDirectoryDatabase { bool RemoveFileInfoHelper(FileId file_id, leveldb::WriteBatch* batch); // Close the database. Before this, all iterators associated with the database // must be deleted. - void HandleError(const tracked_objects::Location& from_here, + void HandleError(const base::Location& from_here, const leveldb::Status& status); const base::FilePath filesystem_data_directory_; diff --git a/chromium/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc b/chromium/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc index fedfc13214f..ce342b59e77 100644 --- a/chromium/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc +++ b/chromium/storage/browser/fileapi/sandbox_file_system_backend_delegate.cc @@ -334,7 +334,7 @@ SandboxFileSystemBackendDelegate::DeleteOriginDataOnFileTaskRunner( usage_cache()->CloseCacheFiles(); bool result = obfuscated_file_util()->DeleteDirectoryForOriginAndType( origin_url, GetTypeString(type)); - if (result && proxy) { + if (result && proxy && usage) { proxy->NotifyStorageModified(storage::QuotaClient::kFileSystem, origin_url, FileSystemTypeToQuotaStorageType(type), diff --git a/chromium/storage/browser/fileapi/sandbox_origin_database.cc b/chromium/storage/browser/fileapi/sandbox_origin_database.cc index 5735eda48d5..07a8b43a1ff 100644 --- a/chromium/storage/browser/fileapi/sandbox_origin_database.cc +++ b/chromium/storage/browser/fileapi/sandbox_origin_database.cc @@ -189,9 +189,8 @@ bool SandboxOriginDatabase::RepairDatabase(const std::string& db_path) { return true; } -void SandboxOriginDatabase::HandleError( - const tracked_objects::Location& from_here, - const leveldb::Status& status) { +void SandboxOriginDatabase::HandleError(const base::Location& from_here, + const leveldb::Status& status) { db_.reset(); LOG(ERROR) << "SandboxOriginDatabase failed at: " << from_here.ToString() << " with error: " << status.ToString(); diff --git a/chromium/storage/browser/fileapi/sandbox_origin_database.h b/chromium/storage/browser/fileapi/sandbox_origin_database.h index 84fda561a84..a06a6be1b36 100644 --- a/chromium/storage/browser/fileapi/sandbox_origin_database.h +++ b/chromium/storage/browser/fileapi/sandbox_origin_database.h @@ -19,7 +19,7 @@ class Env; class Status; } -namespace tracked_objects { +namespace base { class Location; } @@ -63,7 +63,7 @@ class STORAGE_EXPORT SandboxOriginDatabase bool RepairDatabase(const std::string& db_path); // Close the database. Before this, all iterators associated with the database // must be deleted. - void HandleError(const tracked_objects::Location& from_here, + void HandleError(const base::Location& from_here, const leveldb::Status& status); void ReportInitStatus(const leveldb::Status& status); bool GetLastPathNumber(int* number); diff --git a/chromium/storage/browser/fileapi/timed_task_helper.cc b/chromium/storage/browser/fileapi/timed_task_helper.cc index 0ea3f094791..eb3d1b12604 100644 --- a/chromium/storage/browser/fileapi/timed_task_helper.cc +++ b/chromium/storage/browser/fileapi/timed_task_helper.cc @@ -40,10 +40,9 @@ bool TimedTaskHelper::IsRunning() const { return tracker_ != NULL; } -void TimedTaskHelper::Start( - const tracked_objects::Location& posted_from, - base::TimeDelta delay, - const base::Closure& user_task) { +void TimedTaskHelper::Start(const base::Location& posted_from, + base::TimeDelta delay, + const base::Closure& user_task) { posted_from_ = posted_from; delay_ = delay; user_task_ = user_task; diff --git a/chromium/storage/browser/fileapi/timed_task_helper.h b/chromium/storage/browser/fileapi/timed_task_helper.h index 09a6137fd63..d0986093ad3 100644 --- a/chromium/storage/browser/fileapi/timed_task_helper.h +++ b/chromium/storage/browser/fileapi/timed_task_helper.h @@ -30,7 +30,7 @@ class STORAGE_EXPORT TimedTaskHelper { ~TimedTaskHelper(); bool IsRunning() const; - void Start(const tracked_objects::Location& posted_from, + void Start(const base::Location& posted_from, base::TimeDelta delay, const base::Closure& user_task); void Reset(); @@ -43,7 +43,7 @@ class STORAGE_EXPORT TimedTaskHelper { void PostDelayedTask(std::unique_ptr<Tracker> tracker, base::TimeDelta delay); scoped_refptr<base::SequencedTaskRunner> task_runner_; - tracked_objects::Location posted_from_; + base::Location posted_from_; base::TimeDelta delay_; base::Closure user_task_; diff --git a/chromium/storage/browser/quota/quota_manager.cc b/chromium/storage/browser/quota/quota_manager.cc index e3b05a6ec8c..8e57fc51009 100644 --- a/chromium/storage/browser/quota/quota_manager.cc +++ b/chromium/storage/browser/quota/quota_manager.cc @@ -21,7 +21,6 @@ #include "base/macros.h" #include "base/metrics/histogram_macros.h" #include "base/numerics/safe_conversions.h" -#include "base/profiler/scoped_tracker.h" #include "base/sequenced_task_runner.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" @@ -1677,7 +1676,7 @@ void QuotaManager::DeleteOnCorrectThread() const { } void QuotaManager::PostTaskAndReplyWithResultForDBThread( - const tracked_objects::Location& from_here, + const base::Location& from_here, base::Callback<bool(QuotaDatabase*)> task, base::Callback<void(bool)> reply) { // Deleting manager will post another task to DB sequence to delete diff --git a/chromium/storage/browser/quota/quota_manager.h b/chromium/storage/browser/quota/quota_manager.h index 5973b5bde02..8963ab65955 100644 --- a/chromium/storage/browser/quota/quota_manager.h +++ b/chromium/storage/browser/quota/quota_manager.h @@ -7,7 +7,6 @@ #include <stdint.h> -#include <deque> #include <list> #include <map> #include <memory> @@ -415,7 +414,7 @@ class STORAGE_EXPORT QuotaManager void DeleteOnCorrectThread() const; void PostTaskAndReplyWithResultForDBThread( - const tracked_objects::Location& from_here, + const base::Location& from_here, base::Callback<bool(QuotaDatabase*)> task, base::Callback<void(bool)> reply); diff --git a/chromium/storage/common/data_element.cc b/chromium/storage/common/data_element.cc index ea11f4309d6..c613bc0f796 100644 --- a/chromium/storage/common/data_element.cc +++ b/chromium/storage/common/data_element.cc @@ -19,10 +19,12 @@ DataElement::DataElement() offset_(0), length_(std::numeric_limits<uint64_t>::max()) {} -DataElement::DataElement(const DataElement& other) = default; DataElement::~DataElement() {} +DataElement::DataElement(DataElement&& other) = default; +DataElement& DataElement::operator=(DataElement&& other) = default; + void DataElement::SetToFilePathRange( const base::FilePath& path, uint64_t offset, diff --git a/chromium/storage/common/data_element.h b/chromium/storage/common/data_element.h index 744cc99d11c..0ce598bc2b1 100644 --- a/chromium/storage/common/data_element.h +++ b/chromium/storage/common/data_element.h @@ -40,9 +40,13 @@ class STORAGE_COMMON_EXPORT DataElement { }; DataElement(); - DataElement(const DataElement& other); ~DataElement(); + DataElement(const DataElement&) = delete; + void operator=(const DataElement&) = delete; + DataElement(DataElement&& other); + DataElement& operator=(DataElement&& other); + Type type() const { return type_; } const char* bytes() const { return bytes_ ? bytes_ : buf_.data(); } const base::FilePath& path() const { return path_; } diff --git a/chromium/storage/common/fileapi/file_system_types.h b/chromium/storage/common/fileapi/file_system_types.h index 6ea07216f14..8f2aaddb698 100644 --- a/chromium/storage/common/fileapi/file_system_types.h +++ b/chromium/storage/common/fileapi/file_system_types.h @@ -75,12 +75,6 @@ enum FileSystemType { // such as MTP or PTP. kFileSystemTypeDeviceMedia, - // Indicates a Picasa virtual filesystem provided by Media Galleries API. - kFileSystemTypePicasa, - - // Indicates a synthetic iTunes filesystem. - kFileSystemTypeItunes, - // Indicates a Drive filesystem which provides access to Google Drive. kFileSystemTypeDrive, @@ -129,6 +123,8 @@ enum FileSystemType { // A filesystem to provide access to documents providers in ARC. kFileSystemTypeArcDocumentsProvider, + kFileSystemTypeLast = kFileSystemTypeArcDocumentsProvider, + // -------------------------------------------------------------------- // Marks the end of internal type enum. (This is not the actual fs type) // New internal filesystem types must be added above this line. diff --git a/chromium/storage/common/fileapi/file_system_util.cc b/chromium/storage/common/fileapi/file_system_util.cc index 4156e5a337b..eac2ba0f4c8 100644 --- a/chromium/storage/common/fileapi/file_system_util.cc +++ b/chromium/storage/common/fileapi/file_system_util.cc @@ -300,10 +300,6 @@ std::string GetFileSystemTypeString(FileSystemType type) { return "NativeMedia"; case kFileSystemTypeDeviceMedia: return "DeviceMedia"; - case kFileSystemTypePicasa: - return "Picasa"; - case kFileSystemTypeItunes: - return "Itunes"; case kFileSystemTypeDrive: return "Drive"; case kFileSystemTypeSyncable: |