Commit dc041de0 authored by Jeremy Roman's avatar Jeremy Roman Committed by Chromium LUCI CQ

optimization_guide: Correct remaining SEQUENCE_CHECKER errors.

HintsChecker::sequence_checker_ is made effective, which may cause the
checker to discover previously unknown sequence bugs if any exist.

class contains no non-const data or any other apparent reason to require
a sequence checker.

DecisionTreePredictionModel: :sequence_checker_ is removed, since that
Change-Id: I4c62720d62e2cbb32ea45acfcd9f482406361f14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2606130
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: default avatarSophie Chang <sophiechang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840419}
parent 8915896f
...@@ -121,8 +121,6 @@ bool DecisionTreePredictionModel::ValidateTreeNode( ...@@ -121,8 +121,6 @@ bool DecisionTreePredictionModel::ValidateTreeNode(
OptimizationTargetDecision DecisionTreePredictionModel::Predict( OptimizationTargetDecision DecisionTreePredictionModel::Predict(
const base::flat_map<std::string, float>& model_features, const base::flat_map<std::string, float>& model_features,
double* prediction_score) { double* prediction_score) {
SEQUENCE_CHECKER(sequence_checker_);
*prediction_score = 0.0; *prediction_score = 0.0;
// TODO(mcrouse): Add metrics to record if the model evaluation fails. // TODO(mcrouse): Add metrics to record if the model evaluation fails.
if (!EvaluateModel(model_, model_features, prediction_score)) if (!EvaluateModel(model_, model_features, prediction_score))
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "base/containers/flat_map.h" #include "base/containers/flat_map.h"
#include "base/containers/flat_set.h" #include "base/containers/flat_set.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/sequence_checker.h"
#include "components/optimization_guide/prediction_model.h" #include "components/optimization_guide/prediction_model.h"
#include "components/optimization_guide/proto/models.pb.h" #include "components/optimization_guide/proto/models.pb.h"
...@@ -90,8 +89,6 @@ class DecisionTreePredictionModel : public PredictionModel { ...@@ -90,8 +89,6 @@ class DecisionTreePredictionModel : public PredictionModel {
const proto::TreeNode& node, const proto::TreeNode& node,
int node_index) const; int node_index) const;
SEQUENCE_CHECKER(sequence_checker_);
DISALLOW_COPY_AND_ASSIGN(DecisionTreePredictionModel); DISALLOW_COPY_AND_ASSIGN(DecisionTreePredictionModel);
}; };
......
...@@ -151,7 +151,7 @@ bool HintsFetcher::FetchOptimizationGuideServiceHints( ...@@ -151,7 +151,7 @@ bool HintsFetcher::FetchOptimizationGuideServiceHints(
optimization_types, optimization_types,
optimization_guide::proto::RequestContext request_context, optimization_guide::proto::RequestContext request_context,
HintsFetchedCallback hints_fetched_callback) { HintsFetchedCallback hints_fetched_callback) {
SEQUENCE_CHECKER(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_GT(optimization_types.size(), 0u); DCHECK_GT(optimization_types.size(), 0u);
if (content::GetNetworkConnectionTracker()->IsOffline()) { if (content::GetNetworkConnectionTracker()->IsOffline()) {
...@@ -286,7 +286,7 @@ bool HintsFetcher::FetchOptimizationGuideServiceHints( ...@@ -286,7 +286,7 @@ bool HintsFetcher::FetchOptimizationGuideServiceHints(
void HintsFetcher::HandleResponse(const std::string& get_hints_response_data, void HintsFetcher::HandleResponse(const std::string& get_hints_response_data,
int net_status, int net_status,
int response_code) { int response_code) {
SEQUENCE_CHECKER(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
std::unique_ptr<proto::GetHintsResponse> get_hints_response = std::unique_ptr<proto::GetHintsResponse> get_hints_response =
std::make_unique<proto::GetHintsResponse>(); std::make_unique<proto::GetHintsResponse>();
...@@ -390,7 +390,7 @@ void HintsFetcher::UpdateHostsSuccessfullyFetched( ...@@ -390,7 +390,7 @@ void HintsFetcher::UpdateHostsSuccessfullyFetched(
// Callback is only invoked if |active_url_loader_| is bound and still alive. // Callback is only invoked if |active_url_loader_| is bound and still alive.
void HintsFetcher::OnURLLoadComplete( void HintsFetcher::OnURLLoadComplete(
std::unique_ptr<std::string> response_body) { std::unique_ptr<std::string> response_body) {
SEQUENCE_CHECKER(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
int response_code = -1; int response_code = -1;
if (active_url_loader_->ResponseInfo() && if (active_url_loader_->ResponseInfo() &&
...@@ -408,7 +408,7 @@ void HintsFetcher::OnURLLoadComplete( ...@@ -408,7 +408,7 @@ void HintsFetcher::OnURLLoadComplete(
std::vector<std::string> HintsFetcher::GetSizeLimitedHostsDueForHintsRefresh( std::vector<std::string> HintsFetcher::GetSizeLimitedHostsDueForHintsRefresh(
const std::vector<std::string>& hosts) const { const std::vector<std::string>& hosts) const {
SEQUENCE_CHECKER(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DictionaryPrefUpdate hosts_fetched( DictionaryPrefUpdate hosts_fetched(
pref_service_, prefs::kHintsFetcherHostsSuccessfullyFetched); pref_service_, prefs::kHintsFetcherHostsSuccessfullyFetched);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment