OLD | NEW |
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/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 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 data_map->erase(key); | 1005 data_map->erase(key); |
1006 BrowserThread::PostTask( | 1006 BrowserThread::PostTask( |
1007 BrowserThread::DB, FROM_HERE, | 1007 BrowserThread::DB, FROM_HERE, |
1008 base::Bind(&ResourcePrefetchPredictorTables::DeleteSingleDataPoint, | 1008 base::Bind(&ResourcePrefetchPredictorTables::DeleteSingleDataPoint, |
1009 tables_, | 1009 tables_, |
1010 key, | 1010 key, |
1011 key_type)); | 1011 key_type)); |
1012 } else { | 1012 } else { |
1013 bool is_host = key_type == PREFETCH_KEY_TYPE_HOST; | 1013 bool is_host = key_type == PREFETCH_KEY_TYPE_HOST; |
1014 PrefetchData empty_data( | 1014 PrefetchData empty_data( |
1015 !is_host ? PREFETCH_KEY_TYPE_HOST : PREFETCH_KEY_TYPE_URL , ""); | 1015 !is_host ? PREFETCH_KEY_TYPE_HOST : PREFETCH_KEY_TYPE_URL, |
| 1016 std::string()); |
1016 const PrefetchData& host_data = is_host ? cache_entry->second : empty_data; | 1017 const PrefetchData& host_data = is_host ? cache_entry->second : empty_data; |
1017 const PrefetchData& url_data = is_host ? empty_data : cache_entry->second; | 1018 const PrefetchData& url_data = is_host ? empty_data : cache_entry->second; |
1018 BrowserThread::PostTask( | 1019 BrowserThread::PostTask( |
1019 BrowserThread::DB, FROM_HERE, | 1020 BrowserThread::DB, FROM_HERE, |
1020 base::Bind(&ResourcePrefetchPredictorTables::UpdateData, | 1021 base::Bind(&ResourcePrefetchPredictorTables::UpdateData, |
1021 tables_, | 1022 tables_, |
1022 url_data, | 1023 url_data, |
1023 host_data)); | 1024 host_data)); |
1024 } | 1025 } |
1025 } | 1026 } |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 RPP_PREDICTED_HISTOGRAM_PERCENTAGE( | 1239 RPP_PREDICTED_HISTOGRAM_PERCENTAGE( |
1239 "PrefetchFromNetworkPercentOfTotalFromNetwork", | 1240 "PrefetchFromNetworkPercentOfTotalFromNetwork", |
1240 prefetch_network * 100.0 / total_resources_fetched_from_network); | 1241 prefetch_network * 100.0 / total_resources_fetched_from_network); |
1241 } | 1242 } |
1242 | 1243 |
1243 #undef RPP_PREDICTED_HISTOGRAM_PERCENTAGE | 1244 #undef RPP_PREDICTED_HISTOGRAM_PERCENTAGE |
1244 #undef RPP_PREDICTED_HISTOGRAM_COUNTS | 1245 #undef RPP_PREDICTED_HISTOGRAM_COUNTS |
1245 } | 1246 } |
1246 | 1247 |
1247 } // namespace predictors | 1248 } // namespace predictors |
OLD | NEW |