OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Performs basic inspection of the disk cache files with minimal disruption | 5 // Performs basic inspection of the disk cache files with minimal disruption |
6 // to the actual files (they still may change if an error is detected on the | 6 // to the actual files (they still may change if an error is detected on the |
7 // files). | 7 // files). |
8 | 8 |
9 #include "net/tools/dump_cache/dump_files.h" | 9 #include "net/tools/dump_cache/dump_files.h" |
10 | 10 |
11 #include <stdio.h> | 11 #include <stdio.h> |
12 | 12 |
13 #include <set> | 13 #include <set> |
14 #include <string> | 14 #include <string> |
15 | 15 |
16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
17 #include "base/files/file_enumerator.h" | 17 #include "base/files/file_enumerator.h" |
18 #include "base/format_macros.h" | 18 #include "base/format_macros.h" |
19 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
20 #include "net/base/file_stream.h" | 20 #include "net/base/file_stream.h" |
21 #include "net/disk_cache/block_files.h" | 21 #include "net/disk_cache/blockfile/block_files.h" |
22 #include "net/disk_cache/disk_format.h" | 22 #include "net/disk_cache/blockfile/disk_format.h" |
23 #include "net/disk_cache/mapped_file.h" | 23 #include "net/disk_cache/blockfile/mapped_file.h" |
24 #include "net/disk_cache/stats.h" | 24 #include "net/disk_cache/blockfile/stats.h" |
25 #include "net/disk_cache/storage_block-inl.h" | 25 #include "net/disk_cache/blockfile/storage_block-inl.h" |
26 #include "net/disk_cache/storage_block.h" | 26 #include "net/disk_cache/blockfile/storage_block.h" |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 const base::FilePath::CharType kIndexName[] = FILE_PATH_LITERAL("index"); | 30 const base::FilePath::CharType kIndexName[] = FILE_PATH_LITERAL("index"); |
31 | 31 |
32 // Reads the |header_size| bytes from the beginning of file |name|. | 32 // Reads the |header_size| bytes from the beginning of file |name|. |
33 bool ReadHeader(const base::FilePath& name, char* header, int header_size) { | 33 bool ReadHeader(const base::FilePath& name, char* header, int header_size) { |
34 net::FileStream file(NULL); | 34 net::FileStream file(NULL); |
35 file.OpenSync(name, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ); | 35 file.OpenSync(name, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ); |
36 if (!file.IsOpen()) { | 36 if (!file.IsOpen()) { |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 DumpEntry(entry); | 365 DumpEntry(entry); |
366 disk_cache::RankingsNode rankings; | 366 disk_cache::RankingsNode rankings; |
367 if (dumper.LoadRankings(entry.rankings_node, &rankings)) | 367 if (dumper.LoadRankings(entry.rankings_node, &rankings)) |
368 DumpRankings(rankings); | 368 DumpRankings(rankings); |
369 } | 369 } |
370 | 370 |
371 printf("Done.\n"); | 371 printf("Done.\n"); |
372 | 372 |
373 return 0; | 373 return 0; |
374 } | 374 } |
OLD | NEW |