| 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/prerender/prerender_local_predictor.h" | 5 #include "chrome/browser/prerender/prerender_local_predictor.h" |
| 6 | 6 |
| 7 #include <ctype.h> | 7 #include <ctype.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 it != next_urls_currently_found.end(); | 507 it != next_urls_currently_found.end(); |
| 508 ++it) { | 508 ++it) { |
| 509 std::pair<std::map<URLID, int>::iterator, bool> insert_ret = | 509 std::pair<std::map<URLID, int>::iterator, bool> insert_ret = |
| 510 next_urls_num_found.insert(std::pair<URLID, int>(*it, 0)); | 510 next_urls_num_found.insert(std::pair<URLID, int>(*it, 0)); |
| 511 std::map<URLID, int>::iterator num_found_it = insert_ret.first; | 511 std::map<URLID, int>::iterator num_found_it = insert_ret.first; |
| 512 num_found_it->second++; | 512 num_found_it->second++; |
| 513 } | 513 } |
| 514 } | 514 } |
| 515 } | 515 } |
| 516 | 516 |
| 517 if (num_occurrences_of_current_visit > 1) { |
| 518 RecordEvent(EVENT_ADD_VISIT_RELEVANT_TRANSITION_REPEAT_URL); |
| 519 } else { |
| 520 RecordEvent(EVENT_ADD_VISIT_RELEVANT_TRANSITION_NEW_URL); |
| 521 } |
| 522 |
| 517 for (std::map<URLID, int>::const_iterator it = next_urls_num_found.begin(); | 523 for (std::map<URLID, int>::const_iterator it = next_urls_num_found.begin(); |
| 518 it != next_urls_num_found.end(); | 524 it != next_urls_num_found.end(); |
| 519 ++it) { | 525 ++it) { |
| 520 // Only consider a candidate next page for prerendering if it was viewed | 526 // Only consider a candidate next page for prerendering if it was viewed |
| 521 // at least twice, and at least 10% of the time. | 527 // at least twice, and at least 10% of the time. |
| 522 if (num_occurrences_of_current_visit > 0 && | 528 if (num_occurrences_of_current_visit > 0 && |
| 523 it->second > 1 && | 529 it->second > 1 && |
| 524 it->second * 10 >= num_occurrences_of_current_visit) { | 530 it->second * 10 >= num_occurrences_of_current_visit) { |
| 525 RecordEvent(EVENT_ADD_VISIT_IDENTIFIED_PRERENDER_CANDIDATE); | 531 RecordEvent(EVENT_ADD_VISIT_IDENTIFIED_PRERENDER_CANDIDATE); |
| 526 double priority = static_cast<double>(it->second) / | 532 double priority = static_cast<double>(it->second) / |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 } | 1272 } |
| 1267 if (best_matched_prerender) { | 1273 if (best_matched_prerender) { |
| 1268 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_MATCH); | 1274 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_MATCH); |
| 1269 best_matched_prerender->would_have_matched = true; | 1275 best_matched_prerender->would_have_matched = true; |
| 1270 if (session_storage_namespace_matches) | 1276 if (session_storage_namespace_matches) |
| 1271 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MATCH); | 1277 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MATCH); |
| 1272 } | 1278 } |
| 1273 } | 1279 } |
| 1274 | 1280 |
| 1275 } // namespace prerender | 1281 } // namespace prerender |
| OLD | NEW |