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

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 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
2470 &favicon->icon_url, &favicon->icon_type)) 2472 &favicon->icon_url, &favicon->icon_type))
2471 return false; 2473 return false;
2472 2474
2473 favicon->expired = (Time::Now() - last_updated) > 2475 favicon->expired = (Time::Now() - last_updated) >
2474 TimeDelta::FromDays(kFaviconRefetchDays); 2476 TimeDelta::FromDays(kFaviconRefetchDays);
2475 favicon->known_icon = true; 2477 favicon->known_icon = true;
2476 favicon->image_data = data; 2478 favicon->image_data = data;
2477 return true; 2479 return true;
2478 } 2480 }
2479 2481
2482 void HistoryBackend::NotifyVisitObservers(const VisitRow& visit) {
2483 BriefVisitInfo info;
2484 info.url_id = visit.url_id;
2485 info.time = visit.visit_time;
2486 info.transition = visit.transition;
2487 // If we don't have a delegate yet during setup or shutdown, we will drop
2488 // these notifications.
2489 if (delegate_.get())
2490 delegate_->NotifyVisitDBObserversOnAddVisit(info);
2491 }
2492
2480 } // namespace history 2493 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_backend.h ('k') | chrome/browser/history/history_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698