| Index: chrome/browser/ui/webui/predictors/predictors_handler.cc
|
| diff --git a/chrome/browser/ui/webui/predictors/predictors_handler.cc b/chrome/browser/ui/webui/predictors/predictors_handler.cc
|
| index bd03c65f205d354fadcc992c19ef796e640646b0..d9dce056699c2e72ac19793b8f2751a516b2ec64 100644
|
| --- a/chrome/browser/ui/webui/predictors/predictors_handler.cc
|
| +++ b/chrome/browser/ui/webui/predictors/predictors_handler.cc
|
| @@ -9,6 +9,7 @@
|
| #include <utility>
|
|
|
| #include "base/bind.h"
|
| +#include "base/memory/ptr_util.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/predictors/autocomplete_action_predictor.h"
|
| #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h"
|
| @@ -68,7 +69,7 @@ void PredictorsHandler::RequestAutocompleteActionPredictorDb(
|
| base::DictionaryValue dict;
|
| dict.SetBoolean("enabled", enabled);
|
| if (enabled) {
|
| - base::ListValue* db = new base::ListValue();
|
| + auto db = base::MakeUnique<base::ListValue>();
|
| for (AutocompleteActionPredictor::DBCacheMap::const_iterator it =
|
| autocomplete_action_predictor_->db_cache_.begin();
|
| it != autocomplete_action_predictor_->db_cache_.end();
|
| @@ -82,7 +83,7 @@ void PredictorsHandler::RequestAutocompleteActionPredictorDb(
|
| autocomplete_action_predictor_->CalculateConfidenceForDbEntry(it));
|
| db->Append(std::move(entry));
|
| }
|
| - dict.Set("db", db);
|
| + dict.Set("db", std::move(db));
|
| }
|
|
|
| web_ui()->CallJavascriptFunctionUnsafe("updateAutocompleteActionPredictorDb",
|
| @@ -97,15 +98,15 @@ void PredictorsHandler::RequestResourcePrefetchPredictorDb(
|
|
|
| if (enabled) {
|
| // Url Database cache.
|
| - base::ListValue* db = new base::ListValue();
|
| + auto db = base::MakeUnique<base::ListValue>();
|
| AddPrefetchDataMapToListValue(
|
| - *resource_prefetch_predictor_->url_table_cache_, db);
|
| - dict.Set("url_db", db);
|
| + *resource_prefetch_predictor_->url_table_cache_, db.get());
|
| + dict.Set("url_db", std::move(db));
|
|
|
| - db = new base::ListValue();
|
| + db = base::MakeUnique<base::ListValue>();
|
| AddPrefetchDataMapToListValue(
|
| - *resource_prefetch_predictor_->host_table_cache_, db);
|
| - dict.Set("host_db", db);
|
| + *resource_prefetch_predictor_->host_table_cache_, db.get());
|
| + dict.Set("host_db", std::move(db));
|
| }
|
|
|
| web_ui()->CallJavascriptFunctionUnsafe("updateResourcePrefetchPredictorDb",
|
| @@ -118,7 +119,7 @@ void PredictorsHandler::AddPrefetchDataMapToListValue(
|
| for (const auto& p : data_map) {
|
| std::unique_ptr<base::DictionaryValue> main(new base::DictionaryValue());
|
| main->SetString("main_frame_url", p.first);
|
| - base::ListValue* resources = new base::ListValue();
|
| + auto resources = base::MakeUnique<base::ListValue>();
|
| for (const predictors::ResourceData& r : p.second.resources()) {
|
| std::unique_ptr<base::DictionaryValue> resource(
|
| new base::DictionaryValue());
|
| @@ -136,7 +137,7 @@ void PredictorsHandler::AddPrefetchDataMapToListValue(
|
| resource_prefetch_predictor_->IsResourcePrefetchable(r));
|
| resources->Append(std::move(resource));
|
| }
|
| - main->Set("resources", resources);
|
| + main->Set("resources", std::move(resources));
|
| db->Append(std::move(main));
|
| }
|
| }
|
|
|