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

Side by Side Diff: components/subresource_filter/core/browser/ruleset_service.cc

Issue 2279803002: Fix UnindexedRulesetWriter finishing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove redundant test. Created 4 years, 3 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
« no previous file with comments | « no previous file | components/subresource_filter/core/common/unindexed_ruleset.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/browser/ruleset_service.h" 5 #include "components/subresource_filter/core/browser/ruleset_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 if (!indexer->AddUrlRule(rule)) 217 if (!indexer->AddUrlRule(rule))
218 ++num_unsupported_rules; 218 ++num_unsupported_rules;
219 } 219 }
220 } 220 }
221 indexer->Finish(); 221 indexer->Finish();
222 222
223 UMA_HISTOGRAM_COUNTS_10000( 223 UMA_HISTOGRAM_COUNTS_10000(
224 "SubresourceFilter.IndexRuleset.NumUnsupportedRules", 224 "SubresourceFilter.IndexRuleset.NumUnsupportedRules",
225 num_unsupported_rules); 225 num_unsupported_rules);
226 226
227 return zero_copy_stream_adaptor.ByteCount() == unindexed_ruleset_size; 227 return reader.num_bytes_read() == unindexed_ruleset_size;
228 } 228 }
229 229
230 // static 230 // static
231 RulesetService::IndexAndWriteRulesetResult RulesetService::WriteRuleset( 231 RulesetService::IndexAndWriteRulesetResult RulesetService::WriteRuleset(
232 const base::FilePath& indexed_ruleset_base_dir, 232 const base::FilePath& indexed_ruleset_base_dir,
233 const IndexedRulesetVersion& indexed_version, 233 const IndexedRulesetVersion& indexed_version,
234 const base::FilePath& license_path, 234 const base::FilePath& license_path,
235 const uint8_t* indexed_ruleset_data, 235 const uint8_t* indexed_ruleset_data,
236 size_t indexed_ruleset_size) { 236 size_t indexed_ruleset_size) {
237 base::FilePath indexed_ruleset_version_dir = 237 base::FilePath indexed_ruleset_version_dir =
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 DCHECK(ruleset_data_); 339 DCHECK(ruleset_data_);
340 if (!ruleset_data_->IsValid()) 340 if (!ruleset_data_->IsValid())
341 return; 341 return;
342 342
343 DCHECK_EQ(error, base::File::Error::FILE_OK); 343 DCHECK_EQ(error, base::File::Error::FILE_OK);
344 for (auto& distributor : distributors_) 344 for (auto& distributor : distributors_)
345 distributor->PublishNewVersion(ruleset_data_->DuplicateFile()); 345 distributor->PublishNewVersion(ruleset_data_->DuplicateFile());
346 } 346 }
347 347
348 } // namespace subresource_filter 348 } // namespace subresource_filter
OLDNEW
« no previous file with comments | « no previous file | components/subresource_filter/core/common/unindexed_ruleset.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698