| Index: storage/browser/fileapi/dump_file_system.cc
|
| diff --git a/webkit/browser/fileapi/dump_file_system.cc b/storage/browser/fileapi/dump_file_system.cc
|
| similarity index 79%
|
| rename from webkit/browser/fileapi/dump_file_system.cc
|
| rename to storage/browser/fileapi/dump_file_system.cc
|
| index b7d3b13df104efd8dac209793898c80ba3e2d32f..d2ab80fb5749fa36bedef11e0084d376b5ba7536 100644
|
| --- a/webkit/browser/fileapi/dump_file_system.cc
|
| +++ b/storage/browser/fileapi/dump_file_system.cc
|
| @@ -38,12 +38,12 @@
|
| #include "base/files/file_path.h"
|
| #include "base/format_macros.h"
|
| #include "base/strings/stringprintf.h"
|
| -#include "webkit/browser/fileapi/obfuscated_file_util.h"
|
| -#include "webkit/browser/fileapi/sandbox_directory_database.h"
|
| -#include "webkit/browser/fileapi/sandbox_file_system_backend.h"
|
| -#include "webkit/browser/fileapi/sandbox_origin_database.h"
|
| -#include "webkit/common/fileapi/file_system_types.h"
|
| -#include "webkit/common/fileapi/file_system_util.h"
|
| +#include "storage/browser/fileapi/obfuscated_file_util.h"
|
| +#include "storage/browser/fileapi/sandbox_directory_database.h"
|
| +#include "storage/browser/fileapi/sandbox_file_system_backend.h"
|
| +#include "storage/browser/fileapi/sandbox_origin_database.h"
|
| +#include "storage/common/fileapi/file_system_types.h"
|
| +#include "storage/common/fileapi/file_system_util.h"
|
|
|
| namespace {
|
|
|
| @@ -56,21 +56,21 @@ void ShowMessageAndExit(const std::string& msg) {
|
| }
|
|
|
| void ShowUsageAndExit(const std::string& arg0) {
|
| - ShowMessageAndExit(
|
| - "Usage: " + arg0 +
|
| - " [-l] [-t] [-s] <filesystem dir> [origin]...");
|
| + ShowMessageAndExit("Usage: " + arg0 +
|
| + " [-l] [-t] [-s] <filesystem dir> [origin]...");
|
| }
|
|
|
| } // namespace
|
|
|
| -namespace fileapi {
|
| +namespace storage {
|
|
|
| static void DumpDirectoryTree(const std::string& origin_name,
|
| base::FilePath origin_dir) {
|
| origin_dir = origin_dir.Append(g_opt_fs_type);
|
|
|
| printf("=== ORIGIN %s %s ===\n",
|
| - origin_name.c_str(), FilePathToString(origin_dir).c_str());
|
| + origin_name.c_str(),
|
| + FilePathToString(origin_dir).c_str());
|
|
|
| if (!base::DirectoryExists(origin_dir))
|
| return;
|
| @@ -80,8 +80,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;
|
| + std::stack<std::pair<SandboxDirectoryDatabase::FileId, std::string> > paths;
|
| paths.push(std::make_pair(root_id, ""));
|
| while (!paths.empty()) {
|
| SandboxDirectoryDatabase::FileId id = paths.top().first;
|
| @@ -90,8 +89,8 @@ static void DumpDirectoryTree(const std::string& origin_name,
|
|
|
| SandboxDirectoryDatabase::FileInfo info;
|
| if (!directory_db.GetFileInfo(id, &info)) {
|
| - ShowMessageAndExit(base::StringPrintf("GetFileInfo failed for %"PRId64,
|
| - id));
|
| + ShowMessageAndExit(
|
| + base::StringPrintf("GetFileInfo failed for %" PRId64, id));
|
| }
|
|
|
| const std::string name =
|
| @@ -100,12 +99,11 @@ static void DumpDirectoryTree(const std::string& origin_name,
|
| if (info.is_directory()) {
|
| if (!directory_db.ListChildren(id, &children)) {
|
| ShowMessageAndExit(base::StringPrintf(
|
| - "ListChildren failed for %s (%"PRId64")",
|
| - info.name.c_str(), id));
|
| + "ListChildren failed for %s (%" PRId64 ")", info.name.c_str(), id));
|
| }
|
|
|
| for (size_t j = children.size(); j; j--)
|
| - paths.push(make_pair(children[j-1], name));
|
| + paths.push(make_pair(children[j - 1], name));
|
| }
|
|
|
| // +1 for the leading extra slash.
|
| @@ -119,7 +117,7 @@ static void DumpDirectoryTree(const std::string& origin_name,
|
| base::GetFileSize(origin_dir.Append(info.data_path), &size);
|
| }
|
| // TODO(hamaji): Modification time?
|
| - printf("%s%s %"PRId64" %"PRId64" %s\n",
|
| + printf("%s%s %" PRId64 " %" PRId64 " %s\n",
|
| display_name,
|
| directory_suffix,
|
| id,
|
| @@ -141,8 +139,8 @@ static void DumpOrigin(const base::FilePath& file_system_dir,
|
| }
|
|
|
| if (!origin_db.GetPathForOrigin(origin_name, &origin_dir)) {
|
| - ShowMessageAndExit("Failed to get path of origin " + origin_name +
|
| - " in " + FilePathToString(file_system_dir));
|
| + ShowMessageAndExit("Failed to get path of origin " + origin_name + " in " +
|
| + FilePathToString(file_system_dir));
|
| }
|
| DumpDirectoryTree(origin_name, file_system_dir.Append(origin_dir));
|
| }
|
| @@ -158,7 +156,7 @@ static void DumpFileSystem(const base::FilePath& file_system_dir) {
|
| }
|
| }
|
|
|
| -} // namespace fileapi
|
| +} // namespace storage
|
|
|
| int main(int argc, char* argv[]) {
|
| const char* arg0 = argv[0];
|
| @@ -187,17 +185,17 @@ int main(int argc, char* argv[]) {
|
| if (argc < 2)
|
| ShowUsageAndExit(arg0);
|
|
|
| - const base::FilePath file_system_dir = fileapi::StringToFilePath(argv[1]);
|
| + const base::FilePath file_system_dir = storage::StringToFilePath(argv[1]);
|
| if (!base::DirectoryExists(file_system_dir)) {
|
| - ShowMessageAndExit(fileapi::FilePathToString(file_system_dir) +
|
| + ShowMessageAndExit(storage::FilePathToString(file_system_dir) +
|
| " is not a filesystem directory");
|
| }
|
|
|
| if (argc == 2) {
|
| - fileapi::DumpFileSystem(file_system_dir);
|
| + storage::DumpFileSystem(file_system_dir);
|
| } else {
|
| for (int i = 2; i < argc; i++) {
|
| - fileapi::DumpOrigin(file_system_dir, argv[i]);
|
| + storage::DumpOrigin(file_system_dir, argv[i]);
|
| }
|
| }
|
| return 0;
|
|
|