| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // A tool to dump HTML5 filesystem from CUI. | 5 // A tool to dump HTML5 filesystem from CUI. |
| 6 // | 6 // |
| 7 // Usage: | 7 // Usage: |
| 8 // | 8 // |
| 9 // ./out/Release/dump_file_system [options] <filesystem dir> [origin]... | 9 // ./out/Release/dump_file_system [options] <filesystem dir> [origin]... |
| 10 // | 10 // |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 namespace fileapi { | 66 namespace fileapi { |
| 67 | 67 |
| 68 static void DumpDirectoryTree(const std::string& origin_name, | 68 static void DumpDirectoryTree(const std::string& origin_name, |
| 69 base::FilePath origin_dir) { | 69 base::FilePath origin_dir) { |
| 70 origin_dir = origin_dir.Append( | 70 origin_dir = origin_dir.Append( |
| 71 ObfuscatedFileUtil::GetDirectoryNameForType(g_opt_fs_type)); | 71 ObfuscatedFileUtil::GetDirectoryNameForType(g_opt_fs_type)); |
| 72 | 72 |
| 73 printf("=== ORIGIN %s %s ===\n", | 73 printf("=== ORIGIN %s %s ===\n", |
| 74 origin_name.c_str(), FilePathToString(origin_dir).c_str()); | 74 origin_name.c_str(), FilePathToString(origin_dir).c_str()); |
| 75 | 75 |
| 76 if (!file_util::DirectoryExists(origin_dir)) | 76 if (!base::DirectoryExists(origin_dir)) |
| 77 return; | 77 return; |
| 78 | 78 |
| 79 SandboxDirectoryDatabase directory_db(origin_dir); | 79 SandboxDirectoryDatabase directory_db(origin_dir); |
| 80 SandboxDirectoryDatabase::FileId root_id; | 80 SandboxDirectoryDatabase::FileId root_id; |
| 81 if (!directory_db.GetFileWithPath(StringToFilePath("/"), &root_id)) | 81 if (!directory_db.GetFileWithPath(StringToFilePath("/"), &root_id)) |
| 82 return; | 82 return; |
| 83 | 83 |
| 84 std::stack<std::pair<SandboxDirectoryDatabase::FileId, | 84 std::stack<std::pair<SandboxDirectoryDatabase::FileId, |
| 85 std::string> > paths; | 85 std::string> > paths; |
| 86 paths.push(std::make_pair(root_id, "")); | 86 paths.push(std::make_pair(root_id, "")); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 argv++; | 182 argv++; |
| 183 } else { | 183 } else { |
| 184 break; | 184 break; |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 if (argc < 2) | 188 if (argc < 2) |
| 189 ShowUsageAndExit(arg0); | 189 ShowUsageAndExit(arg0); |
| 190 | 190 |
| 191 const base::FilePath file_system_dir = fileapi::StringToFilePath(argv[1]); | 191 const base::FilePath file_system_dir = fileapi::StringToFilePath(argv[1]); |
| 192 if (!file_util::DirectoryExists(file_system_dir)) { | 192 if (!base::DirectoryExists(file_system_dir)) { |
| 193 ShowMessageAndExit(fileapi::FilePathToString(file_system_dir) + | 193 ShowMessageAndExit(fileapi::FilePathToString(file_system_dir) + |
| 194 " is not a filesystem directory"); | 194 " is not a filesystem directory"); |
| 195 } | 195 } |
| 196 | 196 |
| 197 if (argc == 2) { | 197 if (argc == 2) { |
| 198 fileapi::DumpFileSystem(file_system_dir); | 198 fileapi::DumpFileSystem(file_system_dir); |
| 199 } else { | 199 } else { |
| 200 for (int i = 2; i < argc; i++) { | 200 for (int i = 2; i < argc; i++) { |
| 201 fileapi::DumpOrigin(file_system_dir, argv[i]); | 201 fileapi::DumpOrigin(file_system_dir, argv[i]); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 return 0; | 204 return 0; |
| 205 } | 205 } |
| OLD | NEW |