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

Side by Side Diff: net/disk_cache/simple/simple_index_file.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
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 #include "net/disk_cache/simple/simple_index_file.h" 5 #include "net/disk_cache/simple/simple_index_file.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/memory_mapped_file.h" 10 #include "base/files/memory_mapped_file.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 }; 59 };
60 60
61 void UmaRecordIndexInitMethod(IndexInitMethod method, 61 void UmaRecordIndexInitMethod(IndexInitMethod method,
62 net::CacheType cache_type) { 62 net::CacheType cache_type) {
63 SIMPLE_CACHE_UMA(ENUMERATION, 63 SIMPLE_CACHE_UMA(ENUMERATION,
64 "IndexInitializeMethod", cache_type, 64 "IndexInitializeMethod", cache_type,
65 method, INITIALIZE_METHOD_MAX); 65 method, INITIALIZE_METHOD_MAX);
66 } 66 }
67 67
68 bool WritePickleFile(Pickle* pickle, const base::FilePath& file_name) { 68 bool WritePickleFile(Pickle* pickle, const base::FilePath& file_name) {
69 int bytes_written = file_util::WriteFile( 69 int bytes_written = base::WriteFile(
70 file_name, static_cast<const char*>(pickle->data()), pickle->size()); 70 file_name, static_cast<const char*>(pickle->data()), pickle->size());
71 if (bytes_written != implicit_cast<int>(pickle->size())) { 71 if (bytes_written != implicit_cast<int>(pickle->size())) {
72 base::DeleteFile(file_name, /* recursive = */ false); 72 base::DeleteFile(file_name, /* recursive = */ false);
73 return false; 73 return false;
74 } 74 }
75 return true; 75 return true;
76 } 76 }
77 77
78 // Called for each cache directory traversal iteration. 78 // Called for each cache directory traversal iteration.
79 void ProcessEntryFile(SimpleIndex::EntrySet* entries, 79 void ProcessEntryFile(SimpleIndex::EntrySet* entries,
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 bool SimpleIndexFile::LegacyIsIndexFileStale( 454 bool SimpleIndexFile::LegacyIsIndexFileStale(
455 base::Time cache_last_modified, 455 base::Time cache_last_modified,
456 const base::FilePath& index_file_path) { 456 const base::FilePath& index_file_path) {
457 base::Time index_mtime; 457 base::Time index_mtime;
458 if (!simple_util::GetMTime(index_file_path, &index_mtime)) 458 if (!simple_util::GetMTime(index_file_path, &index_mtime))
459 return true; 459 return true;
460 return index_mtime < cache_last_modified; 460 return index_mtime < cache_last_modified;
461 } 461 }
462 462
463 } // namespace disk_cache 463 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/block_files_unittest.cc ('k') | net/disk_cache/simple/simple_index_file_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698