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

Side by Side Diff: chrome/browser/history/history_backend.cc

Issue 10067018: Add PrerenderLocalPredictor, which will eventually perform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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/history/history_backend.h" 5 #include "chrome/browser/history/history_backend.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 // user can search for URL components and get the page. 763 // user can search for URL components and get the page.
764 // 764 //
765 // However, in most cases, we'll get at least a title and usually contents, 765 // However, in most cases, we'll get at least a title and usually contents,
766 // and this add will be redundant, slowing everything down. As a result, 766 // and this add will be redundant, slowing everything down. As a result,
767 // we ignore this edge case. 767 // we ignore this edge case.
768 } 768 }
769 769
770 // Add the visit with the time to the database. 770 // Add the visit with the time to the database.
771 VisitRow visit_info(url_id, time, referring_visit, transition, 0); 771 VisitRow visit_info(url_id, time, referring_visit, transition, 0);
772 VisitID visit_id = db_->AddVisit(&visit_info, visit_source); 772 VisitID visit_id = db_->AddVisit(&visit_info, visit_source);
773 NotifyVisitObservers(&visit_info);
773 774
774 if (visit_info.visit_time < first_recorded_time_) 775 if (visit_info.visit_time < first_recorded_time_)
775 first_recorded_time_ = visit_info.visit_time; 776 first_recorded_time_ = visit_info.visit_time;
776 777
777 // Broadcast a notification of the visit. 778 // Broadcast a notification of the visit.
778 if (visit_id) { 779 if (visit_id) {
779 URLVisitedDetails* details = new URLVisitedDetails; 780 URLVisitedDetails* details = new URLVisitedDetails;
780 details->transition = transition; 781 details->transition = transition;
781 details->row = url_info; 782 details->row = url_info;
782 // TODO(meelapshah) Disabled due to potential PageCycler regression. 783 // TODO(meelapshah) Disabled due to potential PageCycler regression.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 VisitRow visit_info(url_id, i->last_visit(), 0, 857 VisitRow visit_info(url_id, i->last_visit(), 0,
857 content::PageTransitionFromInt( 858 content::PageTransitionFromInt(
858 content::PAGE_TRANSITION_LINK | 859 content::PAGE_TRANSITION_LINK |
859 content::PAGE_TRANSITION_CHAIN_START | 860 content::PAGE_TRANSITION_CHAIN_START |
860 content::PAGE_TRANSITION_CHAIN_END), 0); 861 content::PAGE_TRANSITION_CHAIN_END), 0);
861 visit_info.is_indexed = has_indexed; 862 visit_info.is_indexed = has_indexed;
862 if (!visit_database->AddVisit(&visit_info, visit_source)) { 863 if (!visit_database->AddVisit(&visit_info, visit_source)) {
863 NOTREACHED() << "Adding visit failed."; 864 NOTREACHED() << "Adding visit failed.";
864 return; 865 return;
865 } 866 }
867 NotifyVisitObservers(&visit_info);
866 868
867 if (visit_info.visit_time < first_recorded_time_) 869 if (visit_info.visit_time < first_recorded_time_)
868 first_recorded_time_ = visit_info.visit_time; 870 first_recorded_time_ = visit_info.visit_time;
869 } 871 }
870 } 872 }
871 873
872 // Broadcast a notification for typed URLs that have been modified. This 874 // Broadcast a notification for typed URLs that have been modified. This
873 // will be picked up by the in-memory URL database on the main thread. 875 // will be picked up by the in-memory URL database on the main thread.
874 // 876 //
875 // TODO(brettw) bug 1140015: Add an "add page" notification so the history 877 // TODO(brettw) bug 1140015: Add an "add page" notification so the history
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 &favicon->icon_url, &favicon->icon_type)) 2487 &favicon->icon_url, &favicon->icon_type))
2486 return false; 2488 return false;
2487 2489
2488 favicon->expired = (Time::Now() - last_updated) > 2490 favicon->expired = (Time::Now() - last_updated) >
2489 TimeDelta::FromDays(kFaviconRefetchDays); 2491 TimeDelta::FromDays(kFaviconRefetchDays);
2490 favicon->known_icon = true; 2492 favicon->known_icon = true;
2491 favicon->image_data = data; 2493 favicon->image_data = data;
2492 return true; 2494 return true;
2493 } 2495 }
2494 2496
2497 void HistoryBackend::NotifyVisitObservers(VisitRow* visit) {
2498 BriefVisitInfo info;
2499 info.url_id = visit->url_id;
2500 info.time = visit->visit_time;
2501 info.transition = visit->transition;
2502 // If we don't have a delegate yet during setup or shutdown, we will drop
2503 // these notifications.
2504 if (delegate_.get())
2505 delegate_->NotifyVisitDBObserversOnAddVisit(info);
2506 }
2507
2495 } // namespace history 2508 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698