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

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

Issue 1502373009: Allow std::unordered_*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, more HashPair -> HashInts Created 4 years, 11 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/base/port_util.cc ('k') | net/server/web_socket_encoder.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 <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 if (!index_metadata.Deserialize(&pickle_it)) { 416 if (!index_metadata.Deserialize(&pickle_it)) {
417 LOG(ERROR) << "Invalid index_metadata on Simple Cache Index."; 417 LOG(ERROR) << "Invalid index_metadata on Simple Cache Index.";
418 return; 418 return;
419 } 419 }
420 420
421 if (!index_metadata.CheckIndexMetadata()) { 421 if (!index_metadata.CheckIndexMetadata()) {
422 LOG(ERROR) << "Invalid index_metadata on Simple Cache Index."; 422 LOG(ERROR) << "Invalid index_metadata on Simple Cache Index.";
423 return; 423 return;
424 } 424 }
425 425
426 #if !defined(OS_WIN) 426 entries->reserve(index_metadata.GetNumberOfEntries() + kExtraSizeForMerge);
427 // TODO(gavinp): Consider using std::unordered_map.
428 entries->resize(index_metadata.GetNumberOfEntries() + kExtraSizeForMerge);
429 #endif
430 while (entries->size() < index_metadata.GetNumberOfEntries()) { 427 while (entries->size() < index_metadata.GetNumberOfEntries()) {
431 uint64_t hash_key; 428 uint64_t hash_key;
432 EntryMetadata entry_metadata; 429 EntryMetadata entry_metadata;
433 if (!pickle_it.ReadUInt64(&hash_key) || 430 if (!pickle_it.ReadUInt64(&hash_key) ||
434 !entry_metadata.Deserialize(&pickle_it)) { 431 !entry_metadata.Deserialize(&pickle_it)) {
435 LOG(WARNING) << "Invalid EntryMetadata in Simple Index file."; 432 LOG(WARNING) << "Invalid EntryMetadata in Simple Index file.";
436 entries->clear(); 433 entries->clear();
437 return; 434 return;
438 } 435 }
439 SimpleIndex::InsertInEntrySet(hash_key, entry_metadata, entries); 436 SimpleIndex::InsertInEntrySet(hash_key, entry_metadata, entries);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 bool SimpleIndexFile::LegacyIsIndexFileStale( 473 bool SimpleIndexFile::LegacyIsIndexFileStale(
477 base::Time cache_last_modified, 474 base::Time cache_last_modified,
478 const base::FilePath& index_file_path) { 475 const base::FilePath& index_file_path) {
479 base::Time index_mtime; 476 base::Time index_mtime;
480 if (!simple_util::GetMTime(index_file_path, &index_mtime)) 477 if (!simple_util::GetMTime(index_file_path, &index_mtime))
481 return true; 478 return true;
482 return index_mtime < cache_last_modified; 479 return index_mtime < cache_last_modified;
483 } 480 }
484 481
485 } // namespace disk_cache 482 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/base/port_util.cc ('k') | net/server/web_socket_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698