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

Side by Side Diff: net/http/mock_http_cache.cc

Issue 2005753004: Record the number of freshness periods since a stale HttpCache entry was last used (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 4 years, 6 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/http/http_cache_transaction.cc ('k') | tools/metrics/histograms/histograms.xml » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/http/mock_http_cache.h" 5 #include "net/http/mock_http_cache.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 void MockDiskEntry::Close() { 77 void MockDiskEntry::Close() {
78 Release(); 78 Release();
79 } 79 }
80 80
81 std::string MockDiskEntry::GetKey() const { 81 std::string MockDiskEntry::GetKey() const {
82 return key_; 82 return key_;
83 } 83 }
84 84
85 base::Time MockDiskEntry::GetLastUsed() const { 85 base::Time MockDiskEntry::GetLastUsed() const {
86 return base::Time::FromInternalValue(0); 86 return base::Time::Now();
87 } 87 }
88 88
89 base::Time MockDiskEntry::GetLastModified() const { 89 base::Time MockDiskEntry::GetLastModified() const {
90 return base::Time::FromInternalValue(0); 90 return base::Time::Now();
91 } 91 }
92 92
93 int32_t MockDiskEntry::GetDataSize(int index) const { 93 int32_t MockDiskEntry::GetDataSize(int index) const {
94 DCHECK(index >= 0 && index < kNumCacheEntryDataIndices); 94 DCHECK(index >= 0 && index < kNumCacheEntryDataIndices);
95 return static_cast<int32_t>(data_[index].size()); 95 return static_cast<int32_t>(data_[index].size());
96 } 96 }
97 97
98 int MockDiskEntry::ReadData(int index, 98 int MockDiskEntry::ReadData(int index,
99 int offset, 99 int offset,
100 IOBuffer* buf, 100 IOBuffer* buf,
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 if (!callback_.is_null()) { 672 if (!callback_.is_null()) {
673 if (!fail_) 673 if (!fail_)
674 backend_->reset(new MockDiskCache()); 674 backend_->reset(new MockDiskCache());
675 CompletionCallback cb = callback_; 675 CompletionCallback cb = callback_;
676 callback_.Reset(); 676 callback_.Reset();
677 cb.Run(Result()); // This object can be deleted here. 677 cb.Run(Result()); // This object can be deleted here.
678 } 678 }
679 } 679 }
680 680
681 } // namespace net 681 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_cache_transaction.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698