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 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_MATCH_ENTRY); | 1517 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_MATCH_ENTRY); |
1518 if (browser_navigate_initiated) | 1518 if (browser_navigate_initiated) |
1519 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_MATCH_BROWSER_NAVIGATE); | 1519 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_MATCH_BROWSER_NAVIGATE); |
1520 best_matched_prerender->would_have_matched = true; | 1520 best_matched_prerender->would_have_matched = true; |
1521 if (session_storage_namespace_matches) { | 1521 if (session_storage_namespace_matches) { |
1522 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MATCH); | 1522 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MATCH); |
1523 if (entry) | 1523 if (entry) |
1524 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MATCH_ENTRY); | 1524 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MATCH_ENTRY); |
1525 if (browser_navigate_initiated) | 1525 if (browser_navigate_initiated) |
1526 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MATCH_BROWSER_NAVIGATE); | 1526 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MATCH_BROWSER_NAVIGATE); |
1527 } else { | |
1528 SessionStorageNamespace* prerender_session_storage_namespace = | |
1529 best_matched_prerender->prerender_handle-> | |
1530 GetSessionStorageNamespace(); | |
1531 if (!prerender_session_storage_namespace) { | |
1532 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MISMATCH_NO_NAMESPACE); | |
1533 } else { | |
1534 RecordEvent(EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MISMATCH_MERGE_ISSUED); | |
1535 prerender_session_storage_namespace->Merge( | |
1536 false, | |
1537 best_matched_prerender->prerender_handle->GetChildId(), | |
1538 tab_session_storage_namespace, | |
1539 base::Bind(&PrerenderLocalPredictor::ProcessNamespaceMergeResult, | |
1540 weak_factory_.GetWeakPtr())); | |
1541 } | |
1542 } | 1527 } |
1543 } | 1528 } |
1544 } | 1529 } |
1545 | 1530 |
1546 void PrerenderLocalPredictor::ProcessNamespaceMergeResult( | |
1547 content::SessionStorageNamespace::MergeResult result) { | |
1548 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_RECEIVED); | |
1549 switch (result) { | |
1550 case content::SessionStorageNamespace::MERGE_RESULT_NAMESPACE_NOT_FOUND: | |
1551 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_NAMESPACE_NOT_FOUND); | |
1552 break; | |
1553 case content::SessionStorageNamespace::MERGE_RESULT_NAMESPACE_NOT_ALIAS: | |
1554 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_NAMESPACE_NOT_ALIAS); | |
1555 break; | |
1556 case content::SessionStorageNamespace::MERGE_RESULT_NOT_LOGGING: | |
1557 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_NOT_LOGGING); | |
1558 break; | |
1559 case content::SessionStorageNamespace::MERGE_RESULT_NO_TRANSACTIONS: | |
1560 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_NO_TRANSACTIONS); | |
1561 break; | |
1562 case content::SessionStorageNamespace::MERGE_RESULT_TOO_MANY_TRANSACTIONS: | |
1563 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_TOO_MANY_TRANSACTIONS); | |
1564 break; | |
1565 case content::SessionStorageNamespace::MERGE_RESULT_NOT_MERGEABLE: | |
1566 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_NOT_MERGEABLE); | |
1567 break; | |
1568 case content::SessionStorageNamespace::MERGE_RESULT_MERGEABLE: | |
1569 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_MERGEABLE); | |
1570 break; | |
1571 default: | |
1572 NOTREACHED(); | |
1573 } | |
1574 } | |
1575 | |
1576 } // namespace prerender | 1531 } // namespace prerender |
OLD | NEW |