Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 } | 64 } |
| 65 | 65 |
| 66 // static | 66 // static |
| 67 void EntryMetadata::DeSerialize(const char* in_buffer, | 67 void EntryMetadata::DeSerialize(const char* in_buffer, |
| 68 EntryMetadata* out_entry_metadata) { | 68 EntryMetadata* out_entry_metadata) { |
| 69 DCHECK(in_buffer); | 69 DCHECK(in_buffer); |
| 70 DCHECK(out_entry_metadata); | 70 DCHECK(out_entry_metadata); |
| 71 memcpy(out_entry_metadata, in_buffer, kEntryMetadataSize); | 71 memcpy(out_entry_metadata, in_buffer, kEntryMetadataSize); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // static | |
| 75 void EntryMetadata::Merge(const EntryMetadata& entry_metadata, | |
| 76 EntryMetadata* out_entry_metadata) { | |
| 77 if (out_entry_metadata->last_used_time == 0) | |
| 78 out_entry_metadata->last_used_time = entry_metadata.last_used_time; | |
| 79 if (out_entry_metadata->entry_size == 0) | |
|
gavinp
2013/04/10 10:51:56
So 0 is both an invalid size, and the size of a 0
felipeg
2013/04/10 14:21:45
You said there should never be a valid entry with
| |
| 80 out_entry_metadata->entry_size = entry_metadata.entry_size; | |
| 81 } | |
| 82 | |
| 74 } // namespace SimpleIndexFile | 83 } // namespace SimpleIndexFile |
| 75 | 84 |
| 76 } // namespace disk_cache | 85 } // namespace disk_cache |
| OLD | NEW |