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

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

Issue 1610023003: Revert of Allow std::unordered_*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 entries->reserve(index_metadata.GetNumberOfEntries() + kExtraSizeForMerge); 426 #if !defined(OS_WIN)
427 // TODO(gavinp): Consider using std::unordered_map.
428 entries->resize(index_metadata.GetNumberOfEntries() + kExtraSizeForMerge);
429 #endif
427 while (entries->size() < index_metadata.GetNumberOfEntries()) { 430 while (entries->size() < index_metadata.GetNumberOfEntries()) {
428 uint64_t hash_key; 431 uint64_t hash_key;
429 EntryMetadata entry_metadata; 432 EntryMetadata entry_metadata;
430 if (!pickle_it.ReadUInt64(&hash_key) || 433 if (!pickle_it.ReadUInt64(&hash_key) ||
431 !entry_metadata.Deserialize(&pickle_it)) { 434 !entry_metadata.Deserialize(&pickle_it)) {
432 LOG(WARNING) << "Invalid EntryMetadata in Simple Index file."; 435 LOG(WARNING) << "Invalid EntryMetadata in Simple Index file.";
433 entries->clear(); 436 entries->clear();
434 return; 437 return;
435 } 438 }
436 SimpleIndex::InsertInEntrySet(hash_key, entry_metadata, entries); 439 SimpleIndex::InsertInEntrySet(hash_key, entry_metadata, entries);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 bool SimpleIndexFile::LegacyIsIndexFileStale( 476 bool SimpleIndexFile::LegacyIsIndexFileStale(
474 base::Time cache_last_modified, 477 base::Time cache_last_modified,
475 const base::FilePath& index_file_path) { 478 const base::FilePath& index_file_path) {
476 base::Time index_mtime; 479 base::Time index_mtime;
477 if (!simple_util::GetMTime(index_file_path, &index_mtime)) 480 if (!simple_util::GetMTime(index_file_path, &index_mtime))
478 return true; 481 return true;
479 return index_mtime < cache_last_modified; 482 return index_mtime < cache_last_modified;
480 } 483 }
481 484
482 } // namespace disk_cache 485 } // 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