| 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 HistoryService* history = GetHistoryIfExists(); | 553 HistoryService* history = GetHistoryIfExists(); |
| 554 if (history) { | 554 if (history) { |
| 555 RecordEvent(EVENT_GOT_HISTORY_ISSUING_LOOKUP); | 555 RecordEvent(EVENT_GOT_HISTORY_ISSUING_LOOKUP); |
| 556 CandidatePrerenderInfo* lookup_info_ptr = lookup_info.get(); | 556 CandidatePrerenderInfo* lookup_info_ptr = lookup_info.get(); |
| 557 history->ScheduleDBTask( | 557 history->ScheduleDBTask( |
| 558 new GetURLForURLIDTask( | 558 new GetURLForURLIDTask( |
| 559 lookup_info_ptr, | 559 lookup_info_ptr, |
| 560 base::Bind(&PrerenderLocalPredictor::OnLookupURL, | 560 base::Bind(&PrerenderLocalPredictor::OnLookupURL, |
| 561 base::Unretained(this), | 561 base::Unretained(this), |
| 562 base::Passed(&lookup_info))), | 562 base::Passed(&lookup_info))), |
| 563 &history_db_consumer_); | 563 &history_db_tracker_); |
| 564 } | 564 } |
| 565 } | 565 } |
| 566 | 566 |
| 567 void PrerenderLocalPredictor::OnLookupURL( | 567 void PrerenderLocalPredictor::OnLookupURL( |
| 568 scoped_ptr<CandidatePrerenderInfo> info) { | 568 scoped_ptr<CandidatePrerenderInfo> info) { |
| 569 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 569 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 570 | 570 |
| 571 RecordEvent(EVENT_PRERENDER_URL_LOOKUP_RESULT); | 571 RecordEvent(EVENT_PRERENDER_URL_LOOKUP_RESULT); |
| 572 | 572 |
| 573 if (!info->source_url_.url_lookup_success) { | 573 if (!info->source_url_.url_lookup_success) { |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 Profile* profile = prerender_manager_->profile(); | 992 Profile* profile = prerender_manager_->profile(); |
| 993 if (!profile || DisableLocalPredictorBasedOnSyncAndConfiguration(profile)) { | 993 if (!profile || DisableLocalPredictorBasedOnSyncAndConfiguration(profile)) { |
| 994 RecordEvent(EVENT_INIT_FAILED_UNENCRYPTED_SYNC_NOT_ENABLED); | 994 RecordEvent(EVENT_INIT_FAILED_UNENCRYPTED_SYNC_NOT_ENABLED); |
| 995 return; | 995 return; |
| 996 } | 996 } |
| 997 HistoryService* history = GetHistoryIfExists(); | 997 HistoryService* history = GetHistoryIfExists(); |
| 998 if (history) { | 998 if (history) { |
| 999 CHECK(!is_visit_database_observer_); | 999 CHECK(!is_visit_database_observer_); |
| 1000 history->ScheduleDBTask( | 1000 history->ScheduleDBTask( |
| 1001 new GetVisitHistoryTask(this, kMaxVisitHistory), | 1001 new GetVisitHistoryTask(this, kMaxVisitHistory), |
| 1002 &history_db_consumer_); | 1002 &history_db_tracker_); |
| 1003 history->AddVisitDatabaseObserver(this); | 1003 history->AddVisitDatabaseObserver(this); |
| 1004 is_visit_database_observer_ = true; | 1004 is_visit_database_observer_ = true; |
| 1005 } else { | 1005 } else { |
| 1006 RecordEvent(EVENT_INIT_FAILED_NO_HISTORY); | 1006 RecordEvent(EVENT_INIT_FAILED_NO_HISTORY); |
| 1007 } | 1007 } |
| 1008 } | 1008 } |
| 1009 | 1009 |
| 1010 void PrerenderLocalPredictor::OnPLTEventForURL(const GURL& url, | 1010 void PrerenderLocalPredictor::OnPLTEventForURL(const GURL& url, |
| 1011 base::TimeDelta page_load_time) { | 1011 base::TimeDelta page_load_time) { |
| 1012 scoped_ptr<PrerenderProperties> prerender; | 1012 scoped_ptr<PrerenderProperties> prerender; |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1415 break; | 1415 break; |
| 1416 case content::SessionStorageNamespace::MERGE_RESULT_MERGEABLE: | 1416 case content::SessionStorageNamespace::MERGE_RESULT_MERGEABLE: |
| 1417 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_MERGEABLE); | 1417 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_MERGEABLE); |
| 1418 break; | 1418 break; |
| 1419 default: | 1419 default: |
| 1420 NOTREACHED(); | 1420 NOTREACHED(); |
| 1421 } | 1421 } |
| 1422 } | 1422 } |
| 1423 | 1423 |
| 1424 } // namespace prerender | 1424 } // namespace prerender |
| OLD | NEW |