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 #include "components/subresource_filter/core/common/unindexed_ruleset.h" | 5 #include "components/subresource_filter/core/common/unindexed_ruleset.h" |
6 | 6 |
| 7 #include "base/logging.h" |
7 #include "base/numerics/safe_conversions.h" | 8 #include "base/numerics/safe_conversions.h" |
8 | 9 |
9 namespace subresource_filter { | 10 namespace subresource_filter { |
10 | 11 |
11 // UnindexedRulesetReader ------------------------------------------------------ | 12 // UnindexedRulesetReader ------------------------------------------------------ |
12 | 13 |
13 UnindexedRulesetReader::UnindexedRulesetReader( | 14 UnindexedRulesetReader::UnindexedRulesetReader( |
14 google::protobuf::io::ZeroCopyInputStream* stream) | 15 google::protobuf::io::ZeroCopyInputStream* stream) |
15 : coded_stream_(stream) {} | 16 : coded_stream_(stream) {} |
16 | 17 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 DCHECK(!had_error()); | 62 DCHECK(!had_error()); |
62 DCHECK_GT(pending_chunk_.url_rules_size(), 0); | 63 DCHECK_GT(pending_chunk_.url_rules_size(), 0); |
63 | 64 |
64 proto::FilteringRules chunk; | 65 proto::FilteringRules chunk; |
65 chunk.Swap(&pending_chunk_); | 66 chunk.Swap(&pending_chunk_); |
66 coded_stream_.WriteVarint32(base::checked_cast<uint32_t>(chunk.ByteSize())); | 67 coded_stream_.WriteVarint32(base::checked_cast<uint32_t>(chunk.ByteSize())); |
67 return !had_error() && chunk.SerializeToCodedStream(&coded_stream_); | 68 return !had_error() && chunk.SerializeToCodedStream(&coded_stream_); |
68 } | 69 } |
69 | 70 |
70 } // namespace subresource_filter | 71 } // namespace subresource_filter |
OLD | NEW |