| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 const NavigationID& navigation_id, | 110 const NavigationID& navigation_id, |
| 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 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 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 ~GetUrlVisitCountTask() override {} |
| 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_; |
| 139 | 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(GetUrlVisitCountTask); | 140 DISALLOW_COPY_AND_ASSIGN(GetUrlVisitCountTask); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 //////////////////////////////////////////////////////////////////////////////// | 143 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 RPP_PREDICTED_HISTOGRAM_PERCENTAGE( | 1215 RPP_PREDICTED_HISTOGRAM_PERCENTAGE( |
| 1216 "PrefetchFromNetworkPercentOfTotalFromNetwork", | 1216 "PrefetchFromNetworkPercentOfTotalFromNetwork", |
| 1217 prefetch_network * 100.0 / total_resources_fetched_from_network); | 1217 prefetch_network * 100.0 / total_resources_fetched_from_network); |
| 1218 } | 1218 } |
| 1219 | 1219 |
| 1220 #undef RPP_PREDICTED_HISTOGRAM_PERCENTAGE | 1220 #undef RPP_PREDICTED_HISTOGRAM_PERCENTAGE |
| 1221 #undef RPP_PREDICTED_HISTOGRAM_COUNTS | 1221 #undef RPP_PREDICTED_HISTOGRAM_COUNTS |
| 1222 } | 1222 } |
| 1223 | 1223 |
| 1224 } // namespace predictors | 1224 } // namespace predictors |
| OLD | NEW |