Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: net/tools/dump_cache/dump_files.cc

Issue 274012: Convert BlockFiles to use FilePath instead of wstring. (Closed)
Patch Set: rebase Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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 <stdio.h> 9 #include <stdio.h>
10 #include <string> 10 #include <string>
11 11
12 #include "base/file_path.h"
12 #include "base/file_util.h" 13 #include "base/file_util.h"
13 #include "base/message_loop.h" 14 #include "base/message_loop.h"
14 #include "net/base/file_stream.h" 15 #include "net/base/file_stream.h"
15 #include "net/disk_cache/block_files.h" 16 #include "net/disk_cache/block_files.h"
16 #include "net/disk_cache/disk_format.h" 17 #include "net/disk_cache/disk_format.h"
17 #include "net/disk_cache/mapped_file.h" 18 #include "net/disk_cache/mapped_file.h"
18 #include "net/disk_cache/storage_block.h" 19 #include "net/disk_cache/storage_block.h"
19 20
20 namespace { 21 namespace {
21 22
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 printf("user 1: 0x%x\n", header.user[1]); 100 printf("user 1: 0x%x\n", header.user[1]);
100 printf("user 2: 0x%x\n", header.user[2]); 101 printf("user 2: 0x%x\n", header.user[2]);
101 printf("user 3: 0x%x\n", header.user[3]); 102 printf("user 3: 0x%x\n", header.user[3]);
102 printf("-------------------------\n\n"); 103 printf("-------------------------\n\n");
103 } 104 }
104 105
105 // Simple class that interacts with the set of cache files. 106 // Simple class that interacts with the set of cache files.
106 class CacheDumper { 107 class CacheDumper {
107 public: 108 public:
108 explicit CacheDumper(const std::wstring& path) 109 explicit CacheDumper(const std::wstring& path)
109 : path_(path), block_files_(path), index_(NULL) {} 110 : path_(path),
111 block_files_(FilePath::FromWStringHack(path)),
112 index_(NULL) {}
110 113
111 bool Init(); 114 bool Init();
112 115
113 // Reads an entry from disk. Return false when all entries have been already 116 // Reads an entry from disk. Return false when all entries have been already
114 // returned. 117 // returned.
115 bool GetEntry(disk_cache::EntryStore* entry); 118 bool GetEntry(disk_cache::EntryStore* entry);
116 119
117 // Loads a specific block from the block files. 120 // Loads a specific block from the block files.
118 bool LoadEntry(disk_cache::CacheAddr addr, disk_cache::EntryStore* entry); 121 bool LoadEntry(disk_cache::CacheAddr addr, disk_cache::EntryStore* entry);
119 bool LoadRankings(disk_cache::CacheAddr addr, 122 bool LoadRankings(disk_cache::CacheAddr addr,
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 DumpEntry(entry); 308 DumpEntry(entry);
306 disk_cache::RankingsNode rankings; 309 disk_cache::RankingsNode rankings;
307 if (dumper.LoadRankings(entry.rankings_node, &rankings)) 310 if (dumper.LoadRankings(entry.rankings_node, &rankings))
308 DumpRankings(rankings); 311 DumpRankings(rankings);
309 } 312 }
310 313
311 printf("Done.\n"); 314 printf("Done.\n");
312 315
313 return 0; 316 return 0;
314 } 317 }
OLDNEW
« net/disk_cache/disk_cache_test_util.cc ('K') | « net/disk_cache/disk_cache_test_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698