Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: trunk/src/chrome/browser/prerender/prerender_local_predictor.cc

Issue 416543006: Revert 284958 "Make HistoryDBTask not refcounted, and ensure it'..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 lookup_info->MaybeAddCandidateURLFromLocalData(it->first, priority); 548 lookup_info->MaybeAddCandidateURLFromLocalData(it->first, priority);
549 } 549 }
550 } 550 }
551 551
552 RecordEvent(EVENT_START_URL_LOOKUP); 552 RecordEvent(EVENT_START_URL_LOOKUP);
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 scoped_ptr<history::HistoryDBTask>( 558 new GetURLForURLIDTask(lookup_info_ptr,
559 new GetURLForURLIDTask( 559 base::Bind(&PrerenderLocalPredictor::OnLookupURL,
560 lookup_info_ptr, 560 base::Unretained(this),
561 base::Bind(&PrerenderLocalPredictor::OnLookupURL, 561 base::Passed(&lookup_info))),
562 base::Unretained(this),
563 base::Passed(&lookup_info)))),
564 &history_db_tracker_); 562 &history_db_tracker_);
565 } 563 }
566 } 564 }
567 565
568 void PrerenderLocalPredictor::OnLookupURL( 566 void PrerenderLocalPredictor::OnLookupURL(
569 scoped_ptr<CandidatePrerenderInfo> info) { 567 scoped_ptr<CandidatePrerenderInfo> info) {
570 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 568 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
571 569
572 RecordEvent(EVENT_PRERENDER_URL_LOOKUP_RESULT); 570 RecordEvent(EVENT_PRERENDER_URL_LOOKUP_RESULT);
573 571
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 991 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
994 RecordEvent(EVENT_INIT_STARTED); 992 RecordEvent(EVENT_INIT_STARTED);
995 Profile* profile = prerender_manager_->profile(); 993 Profile* profile = prerender_manager_->profile();
996 if (!profile || DisableLocalPredictorBasedOnSyncAndConfiguration(profile)) { 994 if (!profile || DisableLocalPredictorBasedOnSyncAndConfiguration(profile)) {
997 RecordEvent(EVENT_INIT_FAILED_UNENCRYPTED_SYNC_NOT_ENABLED); 995 RecordEvent(EVENT_INIT_FAILED_UNENCRYPTED_SYNC_NOT_ENABLED);
998 return; 996 return;
999 } 997 }
1000 HistoryService* history = GetHistoryIfExists(); 998 HistoryService* history = GetHistoryIfExists();
1001 if (history) { 999 if (history) {
1002 CHECK(!is_visit_database_observer_); 1000 CHECK(!is_visit_database_observer_);
1003 history->ScheduleDBTask( 1001 history->ScheduleDBTask(new GetVisitHistoryTask(this, kMaxVisitHistory),
1004 scoped_ptr<history::HistoryDBTask>( 1002 &history_db_tracker_);
1005 new GetVisitHistoryTask(this, kMaxVisitHistory)),
1006 &history_db_tracker_);
1007 history->AddVisitDatabaseObserver(this); 1003 history->AddVisitDatabaseObserver(this);
1008 is_visit_database_observer_ = true; 1004 is_visit_database_observer_ = true;
1009 } else { 1005 } else {
1010 RecordEvent(EVENT_INIT_FAILED_NO_HISTORY); 1006 RecordEvent(EVENT_INIT_FAILED_NO_HISTORY);
1011 } 1007 }
1012 } 1008 }
1013 1009
1014 void PrerenderLocalPredictor::OnPLTEventForURL(const GURL& url, 1010 void PrerenderLocalPredictor::OnPLTEventForURL(const GURL& url,
1015 base::TimeDelta page_load_time) { 1011 base::TimeDelta page_load_time) {
1016 scoped_ptr<PrerenderProperties> prerender; 1012 scoped_ptr<PrerenderProperties> prerender;
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 break; 1415 break;
1420 case content::SessionStorageNamespace::MERGE_RESULT_MERGEABLE: 1416 case content::SessionStorageNamespace::MERGE_RESULT_MERGEABLE:
1421 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_MERGEABLE); 1417 RecordEvent(EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_MERGEABLE);
1422 break; 1418 break;
1423 default: 1419 default:
1424 NOTREACHED(); 1420 NOTREACHED();
1425 } 1421 }
1426 } 1422 }
1427 1423
1428 } // namespace prerender 1424 } // namespace prerender
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/history/url_index_private_data.cc ('k') | trunk/src/chrome/browser/sync/glue/history_model_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698