| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // Rice-Golomb decoder for blacklist updates. | 5 // Rice-Golomb decoder for blacklist updates. |
| 6 // Details at: https://en.wikipedia.org/wiki/Golomb_coding | 6 // Details at: https://en.wikipedia.org/wiki/Golomb_coding |
| 7 | 7 |
| 8 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_RICE_H_ | 8 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_RICE_H_ |
| 9 #define COMPONENTS_SAFE_BROWSING_DB_V4_RICE_H_ | 9 #define COMPONENTS_SAFE_BROWSING_DB_V4_RICE_H_ |
| 10 | 10 |
| 11 #include <ostream> | 11 #include <ostream> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 | |
| 16 #if defined(USE_SYSTEM_PROTOBUF) | |
| 17 #include <google/protobuf/repeated_field.h> | |
| 18 #else | |
| 19 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" | 15 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" |
| 20 #endif | |
| 21 | 16 |
| 22 namespace safe_browsing { | 17 namespace safe_browsing { |
| 23 | 18 |
| 24 // Enumerate different failure events while decoding the Rice-encoded string | 19 // Enumerate different failure events while decoding the Rice-encoded string |
| 25 // sent by the server for histogramming purposes. DO NOT CHANGE THE ORDERING OF | 20 // sent by the server for histogramming purposes. DO NOT CHANGE THE ORDERING OF |
| 26 // THESE VALUES. | 21 // THESE VALUES. |
| 27 enum V4DecodeResult { | 22 enum V4DecodeResult { |
| 28 // No error. | 23 // No error. |
| 29 DECODE_SUCCESS = 0, | 24 DECODE_SUCCESS = 0, |
| 30 | 25 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // The 32-bit value read from |data_|. All bit reading operations operate on | 155 // The 32-bit value read from |data_|. All bit reading operations operate on |
| 161 // |current_word_|. | 156 // |current_word_|. |
| 162 uint32_t current_word_; | 157 uint32_t current_word_; |
| 163 }; | 158 }; |
| 164 | 159 |
| 165 std::ostream& operator<<(std::ostream& os, const V4RiceDecoder& rice_decoder); | 160 std::ostream& operator<<(std::ostream& os, const V4RiceDecoder& rice_decoder); |
| 166 | 161 |
| 167 } // namespace safe_browsing | 162 } // namespace safe_browsing |
| 168 | 163 |
| 169 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_RICE_H_ | 164 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_RICE_H_ |
| OLD | NEW |