OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/predictors/resource_prefetch_predictor.h" | 5 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 std::vector<URLRequestSummary>* requests, | 111 std::vector<URLRequestSummary>* requests, |
112 VisitInfoCallback callback) | 112 VisitInfoCallback callback) |
113 : visit_count_(0), | 113 : visit_count_(0), |
114 navigation_id_(navigation_id), | 114 navigation_id_(navigation_id), |
115 requests_(requests), | 115 requests_(requests), |
116 callback_(callback) { | 116 callback_(callback) { |
117 DCHECK(requests_.get()); | 117 DCHECK(requests_.get()); |
118 } | 118 } |
119 | 119 |
120 virtual bool RunOnDBThread(history::HistoryBackend* backend, | 120 virtual bool RunOnDBThread(history::HistoryBackend* backend, |
121 history::HistoryDatabase* db) OVERRIDE { | 121 history::HistoryDatabase* db) override { |
122 history::URLRow url_row; | 122 history::URLRow url_row; |
123 if (db->GetRowForURL(navigation_id_.main_frame_url, &url_row)) | 123 if (db->GetRowForURL(navigation_id_.main_frame_url, &url_row)) |
124 visit_count_ = url_row.visit_count(); | 124 visit_count_ = url_row.visit_count(); |
125 return true; | 125 return true; |
126 } | 126 } |
127 | 127 |
128 virtual void DoneRunOnMainThread() OVERRIDE { | 128 virtual void DoneRunOnMainThread() override { |
129 callback_.Run(visit_count_, navigation_id_, *requests_); | 129 callback_.Run(visit_count_, navigation_id_, *requests_); |
130 } | 130 } |
131 | 131 |
132 private: | 132 private: |
133 virtual ~GetUrlVisitCountTask() { } | 133 virtual ~GetUrlVisitCountTask() { } |
134 | 134 |
135 int visit_count_; | 135 int visit_count_; |
136 NavigationID navigation_id_; | 136 NavigationID navigation_id_; |
137 scoped_ptr<std::vector<URLRequestSummary> > requests_; | 137 scoped_ptr<std::vector<URLRequestSummary> > requests_; |
138 VisitInfoCallback callback_; | 138 VisitInfoCallback callback_; |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 RPP_PREDICTED_HISTOGRAM_PERCENTAGE( | 1213 RPP_PREDICTED_HISTOGRAM_PERCENTAGE( |
1214 "PrefetchFromNetworkPercentOfTotalFromNetwork", | 1214 "PrefetchFromNetworkPercentOfTotalFromNetwork", |
1215 prefetch_network * 100.0 / total_resources_fetched_from_network); | 1215 prefetch_network * 100.0 / total_resources_fetched_from_network); |
1216 } | 1216 } |
1217 | 1217 |
1218 #undef RPP_PREDICTED_HISTOGRAM_PERCENTAGE | 1218 #undef RPP_PREDICTED_HISTOGRAM_PERCENTAGE |
1219 #undef RPP_PREDICTED_HISTOGRAM_COUNTS | 1219 #undef RPP_PREDICTED_HISTOGRAM_COUNTS |
1220 } | 1220 } |
1221 | 1221 |
1222 } // namespace predictors | 1222 } // namespace predictors |
OLD | NEW |