| 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_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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 CHECK_EOF_RESULT_MAGIC_NUMBER_MISMATCH, | 66 CHECK_EOF_RESULT_MAGIC_NUMBER_MISMATCH, |
| 67 CHECK_EOF_RESULT_CRC_MISMATCH, | 67 CHECK_EOF_RESULT_CRC_MISMATCH, |
| 68 CHECK_EOF_RESULT_KEY_SHA256_MISMATCH, | 68 CHECK_EOF_RESULT_KEY_SHA256_MISMATCH, |
| 69 CHECK_EOF_RESULT_MAX, | 69 CHECK_EOF_RESULT_MAX, |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 // Used in histograms, please only add entries at the end. | 72 // Used in histograms, please only add entries at the end. |
| 73 enum CloseResult { | 73 enum CloseResult { |
| 74 CLOSE_RESULT_SUCCESS, | 74 CLOSE_RESULT_SUCCESS, |
| 75 CLOSE_RESULT_WRITE_FAILURE, | 75 CLOSE_RESULT_WRITE_FAILURE, |
| 76 CLOSE_RESULT_MAX, |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 // Used in histograms, please only add entries at the end. | 79 // Used in histograms, please only add entries at the end. |
| 79 enum class KeySHA256Result { NOT_PRESENT, MATCHED, NO_MATCH, MAX }; | 80 enum class KeySHA256Result { NOT_PRESENT, MATCHED, NO_MATCH, MAX }; |
| 80 | 81 |
| 81 void RecordSyncOpenResult(net::CacheType cache_type, | 82 void RecordSyncOpenResult(net::CacheType cache_type, |
| 82 OpenEntryResult result, | 83 OpenEntryResult result, |
| 83 bool had_index) { | 84 bool had_index) { |
| 84 DCHECK_LT(result, OPEN_ENTRY_MAX); | 85 DCHECK_LT(result, OPEN_ENTRY_MAX); |
| 85 SIMPLE_CACHE_UMA(ENUMERATION, | 86 SIMPLE_CACHE_UMA(ENUMERATION, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 101 } | 102 } |
| 102 | 103 |
| 103 void RecordCheckEOFResult(net::CacheType cache_type, CheckEOFResult result) { | 104 void RecordCheckEOFResult(net::CacheType cache_type, CheckEOFResult result) { |
| 104 SIMPLE_CACHE_UMA(ENUMERATION, | 105 SIMPLE_CACHE_UMA(ENUMERATION, |
| 105 "SyncCheckEOFResult", cache_type, | 106 "SyncCheckEOFResult", cache_type, |
| 106 result, CHECK_EOF_RESULT_MAX); | 107 result, CHECK_EOF_RESULT_MAX); |
| 107 } | 108 } |
| 108 | 109 |
| 109 void RecordCloseResult(net::CacheType cache_type, CloseResult result) { | 110 void RecordCloseResult(net::CacheType cache_type, CloseResult result) { |
| 110 SIMPLE_CACHE_UMA(ENUMERATION, | 111 SIMPLE_CACHE_UMA(ENUMERATION, |
| 111 "SyncCloseResult", cache_type, result, WRITE_RESULT_MAX); | 112 "SyncCloseResult", cache_type, result, CLOSE_RESULT_MAX); |
| 112 } | 113 } |
| 113 | 114 |
| 114 void RecordKeySHA256Result(net::CacheType cache_type, KeySHA256Result result) { | 115 void RecordKeySHA256Result(net::CacheType cache_type, KeySHA256Result result) { |
| 115 SIMPLE_CACHE_UMA(ENUMERATION, "SyncKeySHA256Result", cache_type, | 116 SIMPLE_CACHE_UMA(ENUMERATION, "SyncKeySHA256Result", cache_type, |
| 116 static_cast<int>(result), | 117 static_cast<int>(result), |
| 117 static_cast<int>(KeySHA256Result::MAX)); | 118 static_cast<int>(KeySHA256Result::MAX)); |
| 118 } | 119 } |
| 119 | 120 |
| 120 bool CanOmitEmptyFile(int file_index) { | 121 bool CanOmitEmptyFile(int file_index) { |
| 121 DCHECK_GE(file_index, 0); | 122 DCHECK_GE(file_index, 0); |
| (...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1592 range.offset = offset; | 1593 range.offset = offset; |
| 1593 range.length = len; | 1594 range.length = len; |
| 1594 range.data_crc32 = data_crc32; | 1595 range.data_crc32 = data_crc32; |
| 1595 range.file_offset = data_file_offset; | 1596 range.file_offset = data_file_offset; |
| 1596 sparse_ranges_.insert(std::make_pair(offset, range)); | 1597 sparse_ranges_.insert(std::make_pair(offset, range)); |
| 1597 | 1598 |
| 1598 return true; | 1599 return true; |
| 1599 } | 1600 } |
| 1600 | 1601 |
| 1601 } // namespace disk_cache | 1602 } // namespace disk_cache |
| OLD | NEW |