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 #ifndef CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 // Internal history implementation which does most of the work of the history | 92 // Internal history implementation which does most of the work of the history |
93 // system. This runs on a background thread (to not block the browser when we | 93 // system. This runs on a background thread (to not block the browser when we |
94 // do expensive operations) and is NOT threadsafe, so it must only be called | 94 // do expensive operations) and is NOT threadsafe, so it must only be called |
95 // from message handlers on the background thread. Invoking on another thread | 95 // from message handlers on the background thread. Invoking on another thread |
96 // requires threadsafe refcounting. | 96 // requires threadsafe refcounting. |
97 // | 97 // |
98 // Most functions here are just the implementations of the corresponding | 98 // Most functions here are just the implementations of the corresponding |
99 // functions in the history service. These functions are not documented | 99 // functions in the history service. These functions are not documented |
100 // here, see the history service for behavior. | 100 // here, see the history service for behavior. |
101 class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, | 101 class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, |
102 public BroadcastNotificationDelegate { | 102 public ExpireHistoryBackendDelegate { |
103 public: | 103 public: |
104 // Interface implemented by the owner of the HistoryBackend object. Normally, | 104 // Interface implemented by the owner of the HistoryBackend object. Normally, |
105 // the history service implements this to send stuff back to the main thread. | 105 // the history service implements this to send stuff back to the main thread. |
106 // The unit tests can provide a different implementation if they don't have | 106 // The unit tests can provide a different implementation if they don't have |
107 // a history service object. | 107 // a history service object. |
108 class Delegate { | 108 class Delegate { |
109 public: | 109 public: |
110 virtual ~Delegate() {} | 110 virtual ~Delegate() {} |
111 | 111 |
112 // Called when the database cannot be read correctly for some reason. | 112 // Called when the database cannot be read correctly for some reason. |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
788 // redirects. | 788 // redirects. |
789 void SendFaviconChangedNotificationForPageAndRedirects( | 789 void SendFaviconChangedNotificationForPageAndRedirects( |
790 const GURL& page_url); | 790 const GURL& page_url); |
791 | 791 |
792 // Generic stuff ------------------------------------------------------------- | 792 // Generic stuff ------------------------------------------------------------- |
793 | 793 |
794 // Processes the next scheduled HistoryDBTask, scheduling this method | 794 // Processes the next scheduled HistoryDBTask, scheduling this method |
795 // to be invoked again if there are more tasks that need to run. | 795 // to be invoked again if there are more tasks that need to run. |
796 void ProcessDBTaskImpl(); | 796 void ProcessDBTaskImpl(); |
797 | 797 |
798 void BroadcastNotifications(int type, | 798 void BroadcastNotifications(int type, scoped_ptr<HistoryDetails> details); |
droger
2014/10/29 17:55:11
Optional:
Remove the function?
Or add a comment?
sdefresne
2014/10/30 10:54:31
It is still used (but not through ExpireHistoryBac
| |
799 scoped_ptr<HistoryDetails> details) override; | 799 |
800 void NotifySyncURLsModified(URLRows* rows) override; | 800 // ExpireHistoryBackendDelegate: |
801 void NotifySyncURLsDeleted(bool all_history, | 801 void NotifyURLsModified(const URLRows& rows) override; |
802 bool expired, | 802 void NotifyURLsDeleted(bool all_history, |
803 URLRows* rows) override; | 803 bool expired, |
804 const URLRows& rows, | |
805 const std::set<GURL>& favicon_urls) override; | |
804 | 806 |
805 // Deleting all history ------------------------------------------------------ | 807 // Deleting all history ------------------------------------------------------ |
806 | 808 |
807 // Deletes all history. This is a special case of deleting that is separated | 809 // Deletes all history. This is a special case of deleting that is separated |
808 // from our normal dependency-following method for performance reasons. The | 810 // from our normal dependency-following method for performance reasons. The |
809 // logic lives here instead of ExpireHistoryBackend since it will cause | 811 // logic lives here instead of ExpireHistoryBackend since it will cause |
810 // re-initialization of some databases (e.g. Thumbnails) that could fail. | 812 // re-initialization of some databases (e.g. Thumbnails) that could fail. |
811 // When these databases are not valid, our pointers must be NULL, so we need | 813 // When these databases are not valid, our pointers must be NULL, so we need |
812 // to handle this type of operation to keep the pointers in sync. | 814 // to handle this type of operation to keep the pointers in sync. |
813 void DeleteAllHistory(); | 815 void DeleteAllHistory(); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
919 | 921 |
920 // List of observers | 922 // List of observers |
921 ObserverList<HistoryBackendObserver> observers_; | 923 ObserverList<HistoryBackendObserver> observers_; |
922 | 924 |
923 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 925 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
924 }; | 926 }; |
925 | 927 |
926 } // namespace history | 928 } // namespace history |
927 | 929 |
928 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 930 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
OLD | NEW |