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

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

Issue 22571011: Remove simple_util::GetMTime from simple cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 | 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_synchronous_entry.h" 5 #include "net/disk_cache/simple/simple_synchronous_entry.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <functional> 9 #include <functional>
10 #include <limits> 10 #include <limits>
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 496
497 have_open_files_ = true; 497 have_open_files_ = true;
498 if (create) { 498 if (create) {
499 out_entry_stat->last_modified = out_entry_stat->last_used = Time::Now(); 499 out_entry_stat->last_modified = out_entry_stat->last_used = Time::Now();
500 for (int i = 0; i < kSimpleEntryFileCount; ++i) 500 for (int i = 0; i < kSimpleEntryFileCount; ++i)
501 out_entry_stat->data_size[i] = 0; 501 out_entry_stat->data_size[i] = 0;
502 } else { 502 } else {
503 for (int i = 0; i < kSimpleEntryFileCount; ++i) { 503 for (int i = 0; i < kSimpleEntryFileCount; ++i) {
504 PlatformFileInfo file_info; 504 PlatformFileInfo file_info;
505 bool success = GetPlatformFileInfo(files_[i], &file_info); 505 bool success = GetPlatformFileInfo(files_[i], &file_info);
506 base::Time file_last_modified;
507 if (!success) { 506 if (!success) {
508 DLOG(WARNING) << "Could not get platform file info."; 507 DLOG(WARNING) << "Could not get platform file info.";
509 continue; 508 continue;
510 } 509 }
511 out_entry_stat->last_used = file_info.last_accessed; 510 out_entry_stat->last_used = file_info.last_accessed;
512 if (simple_util::GetMTime(path_, &file_last_modified)) 511 out_entry_stat->last_modified = file_info.last_modified;
513 out_entry_stat->last_modified = file_last_modified;
514 else
515 out_entry_stat->last_modified = file_info.last_modified;
516 512
517 base::TimeDelta entry_age = 513 base::TimeDelta entry_age =
518 base::Time::Now() - out_entry_stat->last_modified; 514 base::Time::Now() - out_entry_stat->last_modified;
519 UMA_HISTOGRAM_CUSTOM_COUNTS( 515 UMA_HISTOGRAM_CUSTOM_COUNTS(
520 "SimpleCache.SyncOpenEntryAge", entry_age.InHours(), 1, 1000, 50); 516 "SimpleCache.SyncOpenEntryAge", entry_age.InHours(), 1, 1000, 50);
521 517
522 // Keep the file size in |data size_| briefly until the key is initialized 518 // Keep the file size in |data size_| briefly until the key is initialized
523 // properly. 519 // properly.
524 out_entry_stat->data_size[i] = file_info.size; 520 out_entry_stat->data_size[i] = file_info.size;
525 } 521 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 initialized_ = true; 627 initialized_ = true;
632 return net::OK; 628 return net::OK;
633 } 629 }
634 630
635 void SimpleSynchronousEntry::Doom() const { 631 void SimpleSynchronousEntry::Doom() const {
636 // TODO(gavinp): Consider if we should guard against redundant Doom() calls. 632 // TODO(gavinp): Consider if we should guard against redundant Doom() calls.
637 DeleteFilesForEntryHash(path_, entry_hash_); 633 DeleteFilesForEntryHash(path_, entry_hash_);
638 } 634 }
639 635
640 } // namespace disk_cache 636 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_index_file_unittest.cc ('k') | net/disk_cache/simple/simple_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698