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

Side by Side Diff: chrome/browser/ui/webui/predictors/predictors_handler.cc

Issue 2321343002: Redirect handling in resource prefetch predictor (Closed)
Patch Set: Redirects database schema changed 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/predictors/predictors_handler.h" 5 #include "chrome/browser/ui/webui/predictors/predictors_handler.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 void PredictorsHandler::AddPrefetchDataMapToListValue( 110 void PredictorsHandler::AddPrefetchDataMapToListValue(
111 const ResourcePrefetchPredictor::PrefetchDataMap& data_map, 111 const ResourcePrefetchPredictor::PrefetchDataMap& data_map,
112 base::ListValue* db) const { 112 base::ListValue* db) const {
113 for (ResourcePrefetchPredictor::PrefetchDataMap::const_iterator it = 113 for (ResourcePrefetchPredictor::PrefetchDataMap::const_iterator it =
114 data_map.begin(); it != data_map.end(); ++it) { 114 data_map.begin(); it != data_map.end(); ++it) {
115 std::unique_ptr<base::DictionaryValue> main(new base::DictionaryValue()); 115 std::unique_ptr<base::DictionaryValue> main(new base::DictionaryValue());
116 main->SetString("main_frame_url", it->first); 116 main->SetString("main_frame_url", it->first);
117 base::ListValue* resources = new base::ListValue(); 117 base::ListValue* resources = new base::ListValue();
118 for (ResourcePrefetchPredictor::ResourceRows::const_iterator 118 for (std::vector<ResourcePrefetchPredictor::ResourceRow>::const_iterator
119 row = it->second.resources.begin(); 119 row = it->second.resources.begin();
120 row != it->second.resources.end(); ++row) { 120 row != it->second.resources.end(); ++row) {
121 std::unique_ptr<base::DictionaryValue> resource( 121 std::unique_ptr<base::DictionaryValue> resource(
122 new base::DictionaryValue()); 122 new base::DictionaryValue());
123 resource->SetString("resource_url", row->resource_url.spec()); 123 resource->SetString("resource_url", row->resource_url.spec());
124 resource->SetString("resource_type", 124 resource->SetString("resource_type",
125 ConvertResourceType(row->resource_type)); 125 ConvertResourceType(row->resource_type));
126 resource->SetInteger("number_of_hits", row->number_of_hits); 126 resource->SetInteger("number_of_hits", row->number_of_hits);
127 resource->SetInteger("number_of_misses", row->number_of_misses); 127 resource->SetInteger("number_of_misses", row->number_of_misses);
128 resource->SetInteger("consecutive_misses", row->consecutive_misses); 128 resource->SetInteger("consecutive_misses", row->consecutive_misses);
129 resource->SetDouble("position", row->average_position); 129 resource->SetDouble("position", row->average_position);
130 resource->SetDouble("score", row->score); 130 resource->SetDouble("score", row->score);
131 resources->Append(std::move(resource)); 131 resources->Append(std::move(resource));
132 } 132 }
133 main->Set("resources", resources); 133 main->Set("resources", resources);
134 db->Append(std::move(main)); 134 db->Append(std::move(main));
135 } 135 }
136 } 136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698