| Index: storage/browser/fileapi/sandbox_directory_database.cc
|
| diff --git a/webkit/browser/fileapi/sandbox_directory_database.cc b/storage/browser/fileapi/sandbox_directory_database.cc
|
| similarity index 81%
|
| rename from webkit/browser/fileapi/sandbox_directory_database.cc
|
| rename to storage/browser/fileapi/sandbox_directory_database.cc
|
| index 75aa691d5235793a0b9120e1e4edbfbf249df6c6..10e73927ba35f04d7f44e5eeb642c7277d536f29 100644
|
| --- a/webkit/browser/fileapi/sandbox_directory_database.cc
|
| +++ b/storage/browser/fileapi/sandbox_directory_database.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "webkit/browser/fileapi/sandbox_directory_database.h"
|
| +#include "storage/browser/fileapi/sandbox_directory_database.h"
|
|
|
| #include <math.h>
|
| #include <algorithm>
|
| @@ -18,14 +18,13 @@
|
| #include "base/strings/string_util.h"
|
| #include "third_party/leveldatabase/src/include/leveldb/db.h"
|
| #include "third_party/leveldatabase/src/include/leveldb/write_batch.h"
|
| -#include "webkit/browser/fileapi/file_system_usage_cache.h"
|
| -#include "webkit/common/fileapi/file_system_util.h"
|
| +#include "storage/browser/fileapi/file_system_usage_cache.h"
|
| +#include "storage/common/fileapi/file_system_util.h"
|
|
|
| namespace {
|
|
|
| -bool PickleFromFileInfo(
|
| - const fileapi::SandboxDirectoryDatabase::FileInfo& info,
|
| - Pickle* pickle) {
|
| +bool PickleFromFileInfo(const storage::SandboxDirectoryDatabase::FileInfo& info,
|
| + Pickle* pickle) {
|
| DCHECK(pickle);
|
| std::string data_path;
|
| // Round off here to match the behavior of the filesystem on real files.
|
| @@ -33,33 +32,29 @@ bool PickleFromFileInfo(
|
| base::Time::FromDoubleT(floor(info.modification_time.ToDoubleT()));
|
| std::string name;
|
|
|
| - data_path = fileapi::FilePathToString(info.data_path);
|
| - name = fileapi::FilePathToString(base::FilePath(info.name));
|
| + 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()))
|
| + if (pickle->WriteInt64(info.parent_id) && pickle->WriteString(data_path) &&
|
| + pickle->WriteString(name) && pickle->WriteInt64(time.ToInternalValue()))
|
| return true;
|
|
|
| NOTREACHED();
|
| return false;
|
| }
|
|
|
| -bool FileInfoFromPickle(
|
| - const Pickle& pickle,
|
| - fileapi::SandboxDirectoryDatabase::FileInfo* info) {
|
| +bool FileInfoFromPickle(const Pickle& pickle,
|
| + storage::SandboxDirectoryDatabase::FileInfo* info) {
|
| PickleIterator iter(pickle);
|
| std::string data_path;
|
| std::string name;
|
| int64 internal_time;
|
|
|
| if (pickle.ReadInt64(&iter, &info->parent_id) &&
|
| - pickle.ReadString(&iter, &data_path) &&
|
| - pickle.ReadString(&iter, &name) &&
|
| + pickle.ReadString(&iter, &data_path) && pickle.ReadString(&iter, &name) &&
|
| pickle.ReadInt64(&iter, &internal_time)) {
|
| - info->data_path = fileapi::StringToFilePath(data_path);
|
| - info->name = fileapi::StringToFilePath(name).value();
|
| + info->data_path = storage::StringToFilePath(data_path);
|
| + info->name = storage::StringToFilePath(name).value();
|
| info->modification_time = base::Time::FromInternalValue(internal_time);
|
| return true;
|
| }
|
| @@ -86,25 +81,21 @@ enum InitStatus {
|
| INIT_STATUS_MAX
|
| };
|
|
|
| -enum RepairResult {
|
| - DB_REPAIR_SUCCEEDED = 0,
|
| - DB_REPAIR_FAILED,
|
| - DB_REPAIR_MAX
|
| -};
|
| +enum RepairResult { DB_REPAIR_SUCCEEDED = 0, DB_REPAIR_FAILED, DB_REPAIR_MAX };
|
|
|
| std::string GetChildLookupKey(
|
| - fileapi::SandboxDirectoryDatabase::FileId parent_id,
|
| + storage::SandboxDirectoryDatabase::FileId parent_id,
|
| const base::FilePath::StringType& child_name) {
|
| std::string name;
|
| - name = fileapi::FilePathToString(base::FilePath(child_name));
|
| + name = storage::FilePathToString(base::FilePath(child_name));
|
| return std::string(kChildLookupPrefix) + base::Int64ToString(parent_id) +
|
| - std::string(kChildLookupSeparator) + name;
|
| + std::string(kChildLookupSeparator) + name;
|
| }
|
|
|
| std::string GetChildListingKeyPrefix(
|
| - fileapi::SandboxDirectoryDatabase::FileId parent_id) {
|
| + storage::SandboxDirectoryDatabase::FileId parent_id) {
|
| return std::string(kChildLookupPrefix) + base::Int64ToString(parent_id) +
|
| - std::string(kChildLookupSeparator);
|
| + std::string(kChildLookupSeparator);
|
| }
|
|
|
| const char* LastFileIdKey() {
|
| @@ -116,7 +107,7 @@ const char* LastIntegerKey() {
|
| }
|
|
|
| std::string GetFileLookupKey(
|
| - fileapi::SandboxDirectoryDatabase::FileId file_id) {
|
| + storage::SandboxDirectoryDatabase::FileId file_id) {
|
| return base::Int64ToString(file_id);
|
| }
|
|
|
| @@ -134,16 +125,16 @@ std::string GetFileLookupKey(
|
| // - Directory structure is tree, i.e. connected and acyclic.
|
| class DatabaseCheckHelper {
|
| public:
|
| - typedef fileapi::SandboxDirectoryDatabase::FileId FileId;
|
| - typedef fileapi::SandboxDirectoryDatabase::FileInfo FileInfo;
|
| + typedef storage::SandboxDirectoryDatabase::FileId FileId;
|
| + typedef storage::SandboxDirectoryDatabase::FileInfo FileInfo;
|
|
|
| - DatabaseCheckHelper(fileapi::SandboxDirectoryDatabase* dir_db,
|
| + DatabaseCheckHelper(storage::SandboxDirectoryDatabase* dir_db,
|
| leveldb::DB* db,
|
| const base::FilePath& path);
|
|
|
| bool IsFileSystemConsistent() {
|
| return IsDatabaseEmpty() ||
|
| - (ScanDatabase() && ScanDirectory() && ScanHierarchy());
|
| + (ScanDatabase() && ScanDirectory() && ScanHierarchy());
|
| }
|
|
|
| private:
|
| @@ -155,7 +146,7 @@ class DatabaseCheckHelper {
|
| bool ScanDirectory();
|
| bool ScanHierarchy();
|
|
|
| - fileapi::SandboxDirectoryDatabase* dir_db_;
|
| + storage::SandboxDirectoryDatabase* dir_db_;
|
| leveldb::DB* db_;
|
| base::FilePath path_;
|
|
|
| @@ -170,14 +161,17 @@ class DatabaseCheckHelper {
|
| };
|
|
|
| DatabaseCheckHelper::DatabaseCheckHelper(
|
| - fileapi::SandboxDirectoryDatabase* dir_db,
|
| + storage::SandboxDirectoryDatabase* dir_db,
|
| leveldb::DB* db,
|
| const base::FilePath& path)
|
| - : dir_db_(dir_db), db_(db), path_(path),
|
| + : dir_db_(dir_db),
|
| + db_(db),
|
| + path_(path),
|
| num_directories_in_db_(0),
|
| num_files_in_db_(0),
|
| num_hierarchy_links_in_db_(0),
|
| - last_file_id_(-1), last_integer_(-1) {
|
| + last_file_id_(-1),
|
| + last_integer_(-1) {
|
| DCHECK(dir_db_);
|
| DCHECK(db_);
|
| DCHECK(!path_.empty() && base::DirectoryExists(path_));
|
| @@ -221,8 +215,8 @@ bool DatabaseCheckHelper::ScanDatabase() {
|
| // key: "<entry_id>"
|
| // value: "<pickled FileInfo>"
|
| FileInfo file_info;
|
| - if (!FileInfoFromPickle(
|
| - Pickle(itr->value().data(), itr->value().size()), &file_info))
|
| + if (!FileInfoFromPickle(Pickle(itr->value().data(), itr->value().size()),
|
| + &file_info))
|
| return false;
|
|
|
| FileId file_id = -1;
|
| @@ -244,8 +238,8 @@ bool DatabaseCheckHelper::ScanDatabase() {
|
|
|
| // Ensure the backing file exists as a normal file.
|
| base::File::Info platform_file_info;
|
| - if (!base::GetFileInfo(
|
| - path_.Append(file_info.data_path), &platform_file_info) ||
|
| + if (!base::GetFileInfo(path_.Append(file_info.data_path),
|
| + &platform_file_info) ||
|
| platform_file_info.is_directory ||
|
| platform_file_info.is_symbolic_link) {
|
| // leveldb::Iterator iterates a snapshot of the database.
|
| @@ -271,8 +265,8 @@ bool DatabaseCheckHelper::ScanDirectory() {
|
| // TODO(kinuko): Scans all local file system entries to verify each of them
|
| // has a database entry.
|
| const base::FilePath kExcludes[] = {
|
| - base::FilePath(kDirectoryDatabaseName),
|
| - base::FilePath(fileapi::FileSystemUsageCache::kUsageFileName),
|
| + base::FilePath(kDirectoryDatabaseName),
|
| + base::FilePath(storage::FileSystemUsageCache::kUsageFileName),
|
| };
|
|
|
| // Any path in |pending_directories| is relative to |path_|.
|
| @@ -296,7 +290,8 @@ bool DatabaseCheckHelper::ScanDirectory() {
|
| if (!path_.AppendRelativePath(absolute_file_path, &relative_file_path))
|
| return false;
|
|
|
| - if (std::find(kExcludes, kExcludes + arraysize(kExcludes),
|
| + if (std::find(kExcludes,
|
| + kExcludes + arraysize(kExcludes),
|
| relative_file_path) != kExcludes + arraysize(kExcludes))
|
| continue;
|
|
|
| @@ -332,8 +327,7 @@ bool DatabaseCheckHelper::ScanHierarchy() {
|
| FileInfo file_info;
|
| if (!dir_db_->GetFileInfo(0, &file_info))
|
| return false;
|
| - if (file_info.parent_id != 0 ||
|
| - !file_info.is_directory())
|
| + if (file_info.parent_id != 0 || !file_info.is_directory())
|
| return false;
|
|
|
| while (!directories.empty()) {
|
| @@ -374,8 +368,8 @@ bool DatabaseCheckHelper::ScanHierarchy() {
|
|
|
| // Check if we've visited all database entries.
|
| return num_directories_in_db_ == visited_directories &&
|
| - num_files_in_db_ == visited_files &&
|
| - num_hierarchy_links_in_db_ == visited_links;
|
| + num_files_in_db_ == visited_files &&
|
| + num_hierarchy_links_in_db_ == visited_links;
|
| }
|
|
|
| // Returns true if the given |data_path| contains no parent references ("..")
|
| @@ -389,8 +383,8 @@ bool VerifyDataPath(const base::FilePath& data_path) {
|
| return false;
|
| // See if it's not pointing to the special system paths.
|
| const base::FilePath kExcludes[] = {
|
| - base::FilePath(kDirectoryDatabaseName),
|
| - base::FilePath(fileapi::FileSystemUsageCache::kUsageFileName),
|
| + base::FilePath(kDirectoryDatabaseName),
|
| + base::FilePath(storage::FileSystemUsageCache::kUsageFileName),
|
| };
|
| for (size_t i = 0; i < arraysize(kExcludes); ++i) {
|
| if (data_path == kExcludes[i] || kExcludes[i].IsParent(data_path))
|
| @@ -401,7 +395,7 @@ bool VerifyDataPath(const base::FilePath& data_path) {
|
|
|
| } // namespace
|
|
|
| -namespace fileapi {
|
| +namespace storage {
|
|
|
| SandboxDirectoryDatabase::FileInfo::FileInfo() : parent_id(0) {
|
| }
|
| @@ -443,8 +437,8 @@ bool SandboxDirectoryDatabase::GetChildWithName(
|
| return false;
|
| }
|
|
|
| -bool SandboxDirectoryDatabase::GetFileWithPath(
|
| - const base::FilePath& path, FileId* file_id) {
|
| +bool SandboxDirectoryDatabase::GetFileWithPath(const base::FilePath& path,
|
| + FileId* file_id) {
|
| std::vector<base::FilePath::StringType> components;
|
| VirtualPath::GetComponents(path, &components);
|
| FileId local_id = 0;
|
| @@ -461,8 +455,8 @@ bool SandboxDirectoryDatabase::GetFileWithPath(
|
| return true;
|
| }
|
|
|
| -bool SandboxDirectoryDatabase::ListChildren(
|
| - FileId parent_id, std::vector<FileId>* children) {
|
| +bool SandboxDirectoryDatabase::ListChildren(FileId parent_id,
|
| + std::vector<FileId>* children) {
|
| // Check to add later: fail if parent is a file, at least in debug builds.
|
| if (!Init(REPAIR_ON_CORRUPTION))
|
| return false;
|
| @@ -473,7 +467,7 @@ bool SandboxDirectoryDatabase::ListChildren(
|
| iter->Seek(child_key_prefix);
|
| children->clear();
|
| while (iter->Valid() &&
|
| - StartsWithASCII(iter->key().ToString(), child_key_prefix, true)) {
|
| + StartsWithASCII(iter->key().ToString(), child_key_prefix, true)) {
|
| std::string child_id_string = iter->value().ToString();
|
| FileId child_id;
|
| if (!base::StringToInt64(child_id_string, &child_id)) {
|
| @@ -520,8 +514,8 @@ bool SandboxDirectoryDatabase::GetFileInfo(FileId file_id, FileInfo* info) {
|
| return false;
|
| }
|
|
|
| -base::File::Error SandboxDirectoryDatabase::AddFileInfo(
|
| - const FileInfo& info, FileId* file_id) {
|
| +base::File::Error SandboxDirectoryDatabase::AddFileInfo(const FileInfo& info,
|
| + FileId* file_id) {
|
| if (!Init(REPAIR_ON_CORRUPTION))
|
| return base::File::FILE_ERROR_FAILED;
|
| DCHECK(file_id);
|
| @@ -579,8 +573,8 @@ bool SandboxDirectoryDatabase::RemoveFileInfo(FileId file_id) {
|
| return true;
|
| }
|
|
|
| -bool SandboxDirectoryDatabase::UpdateFileInfo(
|
| - FileId file_id, const FileInfo& new_info) {
|
| +bool SandboxDirectoryDatabase::UpdateFileInfo(FileId file_id,
|
| + const FileInfo& new_info) {
|
| // TODO(ericu): We should also check to see that this doesn't create a loop,
|
| // but perhaps only in a debug build.
|
| if (!Init(REPAIR_ON_CORRUPTION))
|
| @@ -614,7 +608,8 @@ bool SandboxDirectoryDatabase::UpdateFileInfo(
|
| }
|
|
|
| bool SandboxDirectoryDatabase::UpdateModificationTime(
|
| - FileId file_id, const base::Time& modification_time) {
|
| + FileId file_id,
|
| + const base::Time& modification_time) {
|
| FileInfo info;
|
| if (!GetFileInfo(file_id, &info))
|
| return false;
|
| @@ -622,11 +617,11 @@ bool SandboxDirectoryDatabase::UpdateModificationTime(
|
| Pickle pickle;
|
| if (!PickleFromFileInfo(info, &pickle))
|
| return false;
|
| - leveldb::Status status = db_->Put(
|
| - leveldb::WriteOptions(),
|
| - GetFileLookupKey(file_id),
|
| - leveldb::Slice(reinterpret_cast<const char *>(pickle.data()),
|
| - pickle.size()));
|
| + leveldb::Status status =
|
| + db_->Put(leveldb::WriteOptions(),
|
| + GetFileLookupKey(file_id),
|
| + leveldb::Slice(reinterpret_cast<const char*>(pickle.data()),
|
| + pickle.size()));
|
| if (!status.ok()) {
|
| HandleError(FROM_HERE, status);
|
| return false;
|
| @@ -634,8 +629,8 @@ bool SandboxDirectoryDatabase::UpdateModificationTime(
|
| return true;
|
| }
|
|
|
| -bool SandboxDirectoryDatabase::OverwritingMoveFile(
|
| - FileId src_file_id, FileId dest_file_id) {
|
| +bool SandboxDirectoryDatabase::OverwritingMoveFile(FileId src_file_id,
|
| + FileId dest_file_id) {
|
| FileInfo src_file_info;
|
| FileInfo dest_file_info;
|
|
|
| @@ -654,10 +649,9 @@ bool SandboxDirectoryDatabase::OverwritingMoveFile(
|
| Pickle pickle;
|
| if (!PickleFromFileInfo(dest_file_info, &pickle))
|
| return false;
|
| - batch.Put(
|
| - GetFileLookupKey(dest_file_id),
|
| - leveldb::Slice(reinterpret_cast<const char *>(pickle.data()),
|
| - pickle.size()));
|
| + batch.Put(GetFileLookupKey(dest_file_id),
|
| + leveldb::Slice(reinterpret_cast<const char*>(pickle.data()),
|
| + pickle.size()));
|
| leveldb::Status status = db_->Write(leveldb::WriteOptions(), &batch);
|
| if (!status.ok()) {
|
| HandleError(FROM_HERE, status);
|
| @@ -680,8 +674,8 @@ bool SandboxDirectoryDatabase::GetNextInteger(int64* next) {
|
| return false;
|
| }
|
| ++temp;
|
| - status = db_->Put(leveldb::WriteOptions(), LastIntegerKey(),
|
| - base::Int64ToString(temp));
|
| + status = db_->Put(
|
| + leveldb::WriteOptions(), LastIntegerKey(), base::Int64ToString(temp));
|
| if (!status.ok()) {
|
| HandleError(FROM_HERE, status);
|
| return false;
|
| @@ -703,15 +697,15 @@ bool SandboxDirectoryDatabase::GetNextInteger(int64* next) {
|
| // static
|
| bool SandboxDirectoryDatabase::DestroyDatabase(const base::FilePath& path,
|
| leveldb::Env* env_override) {
|
| - std::string name = FilePathToString(path.Append(kDirectoryDatabaseName));
|
| + std::string name = FilePathToString(path.Append(kDirectoryDatabaseName));
|
| leveldb::Options options;
|
| if (env_override)
|
| options.env = env_override;
|
| leveldb::Status status = leveldb::DestroyDB(name, options);
|
| if (status.ok())
|
| return true;
|
| - LOG(WARNING) << "Failed to destroy a database with status " <<
|
| - status.ToString();
|
| + LOG(WARNING) << "Failed to destroy a database with status "
|
| + << status.ToString();
|
| return false;
|
| }
|
|
|
| @@ -719,9 +713,8 @@ bool SandboxDirectoryDatabase::Init(RecoveryOption recovery_option) {
|
| if (db_)
|
| return true;
|
|
|
| - std::string path =
|
| - FilePathToString(filesystem_data_directory_.Append(
|
| - kDirectoryDatabaseName));
|
| + std::string path = FilePathToString(
|
| + filesystem_data_directory_.Append(kDirectoryDatabaseName));
|
| leveldb::Options options;
|
| options.max_open_files = 0; // Use minimum.
|
| options.create_if_missing = true;
|
| @@ -749,14 +742,14 @@ bool SandboxDirectoryDatabase::Init(RecoveryOption recovery_option) {
|
| LOG(WARNING) << "Corrupted SandboxDirectoryDatabase detected."
|
| << " Attempting to repair.";
|
| if (RepairDatabase(path)) {
|
| - UMA_HISTOGRAM_ENUMERATION(kDatabaseRepairHistogramLabel,
|
| - DB_REPAIR_SUCCEEDED, DB_REPAIR_MAX);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + kDatabaseRepairHistogramLabel, DB_REPAIR_SUCCEEDED, DB_REPAIR_MAX);
|
| return true;
|
| }
|
| - UMA_HISTOGRAM_ENUMERATION(kDatabaseRepairHistogramLabel,
|
| - DB_REPAIR_FAILED, DB_REPAIR_MAX);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + kDatabaseRepairHistogramLabel, DB_REPAIR_FAILED, DB_REPAIR_MAX);
|
| LOG(WARNING) << "Failed to repair SandboxDirectoryDatabase.";
|
| - // fall through
|
| + // fall through
|
| case DELETE_ON_CORRUPTION:
|
| LOG(WARNING) << "Clearing SandboxDirectoryDatabase.";
|
| if (!base::DeleteFile(filesystem_data_directory_, true))
|
| @@ -804,8 +797,7 @@ bool SandboxDirectoryDatabase::IsFileSystemConsistent() {
|
| return helper.IsFileSystemConsistent();
|
| }
|
|
|
| -void SandboxDirectoryDatabase::ReportInitStatus(
|
| - const leveldb::Status& status) {
|
| +void SandboxDirectoryDatabase::ReportInitStatus(const leveldb::Status& status) {
|
| base::Time now = base::Time::Now();
|
| const base::TimeDelta minimum_interval =
|
| base::TimeDelta::FromHours(kMinimumReportIntervalHours);
|
| @@ -814,17 +806,17 @@ void SandboxDirectoryDatabase::ReportInitStatus(
|
| last_reported_time_ = now;
|
|
|
| if (status.ok()) {
|
| - UMA_HISTOGRAM_ENUMERATION(kInitStatusHistogramLabel,
|
| - INIT_STATUS_OK, INIT_STATUS_MAX);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + kInitStatusHistogramLabel, INIT_STATUS_OK, INIT_STATUS_MAX);
|
| } else if (status.IsCorruption()) {
|
| - UMA_HISTOGRAM_ENUMERATION(kInitStatusHistogramLabel,
|
| - INIT_STATUS_CORRUPTION, INIT_STATUS_MAX);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + kInitStatusHistogramLabel, INIT_STATUS_CORRUPTION, INIT_STATUS_MAX);
|
| } else if (status.IsIOError()) {
|
| - UMA_HISTOGRAM_ENUMERATION(kInitStatusHistogramLabel,
|
| - INIT_STATUS_IO_ERROR, INIT_STATUS_MAX);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + kInitStatusHistogramLabel, INIT_STATUS_IO_ERROR, INIT_STATUS_MAX);
|
| } else {
|
| - UMA_HISTOGRAM_ENUMERATION(kInitStatusHistogramLabel,
|
| - INIT_STATUS_UNKNOWN_ERROR, INIT_STATUS_MAX);
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + kInitStatusHistogramLabel, INIT_STATUS_UNKNOWN_ERROR, INIT_STATUS_MAX);
|
| }
|
| }
|
|
|
| @@ -880,8 +872,9 @@ bool SandboxDirectoryDatabase::GetLastFileId(FileId* file_id) {
|
| }
|
|
|
| // This does very few safety checks!
|
| -bool SandboxDirectoryDatabase::AddFileInfoHelper(
|
| - const FileInfo& info, FileId file_id, leveldb::WriteBatch* batch) {
|
| +bool SandboxDirectoryDatabase::AddFileInfoHelper(const FileInfo& info,
|
| + FileId file_id,
|
| + leveldb::WriteBatch* batch) {
|
| if (!VerifyDataPath(info.data_path)) {
|
| LOG(ERROR) << "Invalid data path is given: " << info.data_path.value();
|
| return false;
|
| @@ -898,16 +891,16 @@ bool SandboxDirectoryDatabase::AddFileInfoHelper(
|
| Pickle pickle;
|
| if (!PickleFromFileInfo(info, &pickle))
|
| return false;
|
| - batch->Put(
|
| - id_string,
|
| - leveldb::Slice(reinterpret_cast<const char *>(pickle.data()),
|
| - pickle.size()));
|
| + batch->Put(id_string,
|
| + leveldb::Slice(reinterpret_cast<const char*>(pickle.data()),
|
| + pickle.size()));
|
| return true;
|
| }
|
|
|
| // This does very few safety checks!
|
| bool SandboxDirectoryDatabase::RemoveFileInfoHelper(
|
| - FileId file_id, leveldb::WriteBatch* batch) {
|
| + FileId file_id,
|
| + leveldb::WriteBatch* batch) {
|
| DCHECK(file_id); // You can't remove the root, ever. Just delete the DB.
|
| FileInfo info;
|
| if (!GetFileInfo(file_id, &info))
|
| @@ -930,9 +923,9 @@ bool SandboxDirectoryDatabase::RemoveFileInfoHelper(
|
| void SandboxDirectoryDatabase::HandleError(
|
| const tracked_objects::Location& from_here,
|
| const leveldb::Status& status) {
|
| - LOG(ERROR) << "SandboxDirectoryDatabase failed at: "
|
| - << from_here.ToString() << " with error: " << status.ToString();
|
| + LOG(ERROR) << "SandboxDirectoryDatabase failed at: " << from_here.ToString()
|
| + << " with error: " << status.ToString();
|
| db_.reset();
|
| }
|
|
|
| -} // namespace fileapi
|
| +} // namespace storage
|
|
|