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

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

Issue 1340683002: Remove base's implicit_cast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: implicitcast: numericstest Created 5 years, 3 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
« no previous file with comments | « net/disk_cache/entry_unittest.cc ('k') | net/disk_cache/simple/simple_index_file_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/files/memory_mapped_file.h" 11 #include "base/files/memory_mapped_file.h"
12 #include "base/hash.h" 12 #include "base/hash.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/numerics/safe_conversions.h"
14 #include "base/pickle.h" 15 #include "base/pickle.h"
15 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
16 #include "base/task_runner_util.h" 17 #include "base/task_runner_util.h"
17 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
18 #include "net/disk_cache/simple/simple_backend_version.h" 19 #include "net/disk_cache/simple/simple_backend_version.h"
19 #include "net/disk_cache/simple/simple_entry_format.h" 20 #include "net/disk_cache/simple/simple_entry_format.h"
20 #include "net/disk_cache/simple/simple_histogram_macros.h" 21 #include "net/disk_cache/simple/simple_histogram_macros.h"
21 #include "net/disk_cache/simple/simple_index.h" 22 #include "net/disk_cache/simple/simple_index.h"
22 #include "net/disk_cache/simple/simple_synchronous_entry.h" 23 #include "net/disk_cache/simple/simple_synchronous_entry.h"
23 #include "net/disk_cache/simple/simple_util.h" 24 #include "net/disk_cache/simple/simple_util.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 71
71 bool WritePickleFile(base::Pickle* pickle, const base::FilePath& file_name) { 72 bool WritePickleFile(base::Pickle* pickle, const base::FilePath& file_name) {
72 File file( 73 File file(
73 file_name, 74 file_name,
74 File::FLAG_CREATE | File::FLAG_WRITE | File::FLAG_SHARE_DELETE); 75 File::FLAG_CREATE | File::FLAG_WRITE | File::FLAG_SHARE_DELETE);
75 if (!file.IsValid()) 76 if (!file.IsValid())
76 return false; 77 return false;
77 78
78 int bytes_written = 79 int bytes_written =
79 file.Write(0, static_cast<const char*>(pickle->data()), pickle->size()); 80 file.Write(0, static_cast<const char*>(pickle->data()), pickle->size());
80 if (bytes_written != implicit_cast<int>(pickle->size())) { 81 if (bytes_written != base::checked_cast<int>(pickle->size())) {
81 simple_util::SimpleCacheDeleteFile(file_name); 82 simple_util::SimpleCacheDeleteFile(file_name);
82 return false; 83 return false;
83 } 84 }
84 return true; 85 return true;
85 } 86 }
86 87
87 // Called for each cache directory traversal iteration. 88 // Called for each cache directory traversal iteration.
88 void ProcessEntryFile(SimpleIndex::EntrySet* entries, 89 void ProcessEntryFile(SimpleIndex::EntrySet* entries,
89 const base::FilePath& file_path) { 90 const base::FilePath& file_path) {
90 static const size_t kEntryFilesLength = 91 static const size_t kEntryFilesLength =
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 bool SimpleIndexFile::LegacyIsIndexFileStale( 475 bool SimpleIndexFile::LegacyIsIndexFileStale(
475 base::Time cache_last_modified, 476 base::Time cache_last_modified,
476 const base::FilePath& index_file_path) { 477 const base::FilePath& index_file_path) {
477 base::Time index_mtime; 478 base::Time index_mtime;
478 if (!simple_util::GetMTime(index_file_path, &index_mtime)) 479 if (!simple_util::GetMTime(index_file_path, &index_mtime))
479 return true; 480 return true;
480 return index_mtime < cache_last_modified; 481 return index_mtime < cache_last_modified;
481 } 482 }
482 483
483 } // namespace disk_cache 484 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/entry_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