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

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

Issue 13913010: Add Cache size to the Simple Index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing the branching issue Created 7 years, 8 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_disk_format.h" 5 #include "net/disk_cache/simple/simple_disk_format.h"
6 6
7 #include "base/hash.h" 7 #include "base/hash.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/sha1.h" 9 #include "base/sha1.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 10 matching lines...) Expand all
21 implicit_cast<unsigned char>(sha_hash[2]), 21 implicit_cast<unsigned char>(sha_hash[2]),
22 implicit_cast<unsigned char>(sha_hash[3]), 22 implicit_cast<unsigned char>(sha_hash[3]),
23 implicit_cast<unsigned char>(sha_hash[4])); 23 implicit_cast<unsigned char>(sha_hash[4]));
24 DCHECK_EQ(static_cast<size_t>(kEntryHashKeySize), key_hash.size()); 24 DCHECK_EQ(static_cast<size_t>(kEntryHashKeySize), key_hash.size());
25 return key_hash; 25 return key_hash;
26 } 26 }
27 27
28 namespace SimpleIndexFile { 28 namespace SimpleIndexFile {
29 29
30 EntryMetadata::EntryMetadata() : 30 EntryMetadata::EntryMetadata() :
31 last_used_time(0) {} 31 last_used_time(0),
32 entry_size(0) {
33 }
32 34
33 EntryMetadata::EntryMetadata(const std::string& hash_key_p, 35 EntryMetadata::EntryMetadata(const std::string& hash_key_p,
34 base::Time last_used_time_p) : 36 base::Time last_used_time_p,
35 last_used_time(last_used_time_p.ToInternalValue()) { 37 uint64 entry_size_p) :
38 last_used_time(last_used_time_p.ToInternalValue()),
39 entry_size(entry_size_p) {
36 DCHECK_EQ(kEntryHashKeySize, implicit_cast<int>(hash_key_p.size())); 40 DCHECK_EQ(kEntryHashKeySize, implicit_cast<int>(hash_key_p.size()));
37 hash_key_p.copy(hash_key, kEntryHashKeySize); 41 hash_key_p.copy(hash_key, kEntryHashKeySize);
38 } 42 }
39 43
40 std::string EntryMetadata::GetHashKey() const { 44 std::string EntryMetadata::GetHashKey() const {
41 return std::string(hash_key, kEntryHashKeySize); 45 return std::string(hash_key, kEntryHashKeySize);
42 } 46 }
43 47
44 base::Time EntryMetadata::GetLastUsedTime() const { 48 base::Time EntryMetadata::GetLastUsedTime() const {
45 return base::Time::FromInternalValue(last_used_time); 49 return base::Time::FromInternalValue(last_used_time);
(...skipping 17 matching lines...) Expand all
63 void EntryMetadata::DeSerialize(const char* in_buffer, 67 void EntryMetadata::DeSerialize(const char* in_buffer,
64 EntryMetadata* out_entry_metadata) { 68 EntryMetadata* out_entry_metadata) {
65 DCHECK(in_buffer); 69 DCHECK(in_buffer);
66 DCHECK(out_entry_metadata); 70 DCHECK(out_entry_metadata);
67 memcpy(out_entry_metadata, in_buffer, kEntryMetadataSize); 71 memcpy(out_entry_metadata, in_buffer, kEntryMetadataSize);
68 } 72 }
69 73
70 } // namespace SimpleIndexFile 74 } // namespace SimpleIndexFile
71 75
72 } // namespace disk_cache 76 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698