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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 // *See the .cc file for more information on the design.* | 50 // *See the .cc file for more information on the design.* |
51 // | 51 // |
52 // Internal history implementation which does most of the work of the history | 52 // Internal history implementation which does most of the work of the history |
53 // system. This runs on a background thread (to not block the browser when we | 53 // system. This runs on a background thread (to not block the browser when we |
54 // do expensive operations) and is NOT threadsafe, so it must only be called | 54 // do expensive operations) and is NOT threadsafe, so it must only be called |
55 // from message handlers on the background thread. Invoking on another thread | 55 // from message handlers on the background thread. Invoking on another thread |
56 // requires threadsafe refcounting. | 56 // requires threadsafe refcounting. |
57 // | 57 // |
58 // Most functions here are just the implementations of the corresponding | 58 // Most functions here are just the implementations of the corresponding |
59 // functions in the history service. These functions are not documented | 59 // functions in the history service. These functions are not documented |
60 // here, see the history service for behavior. | 60 // here, see the history service for behavior. |
方觉(Fang Jue)
2014/06/11 12:41:47
I removed comments of ClearCachedDataForContextID
| |
61 class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, | 61 class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, |
62 public BroadcastNotificationDelegate { | 62 public BroadcastNotificationDelegate { |
63 public: | 63 public: |
64 // Interface implemented by the owner of the HistoryBackend object. Normally, | 64 // Interface implemented by the owner of the HistoryBackend object. Normally, |
65 // the history service implements this to send stuff back to the main thread. | 65 // the history service implements this to send stuff back to the main thread. |
66 // The unit tests can provide a different implementation if they don't have | 66 // The unit tests can provide a different implementation if they don't have |
67 // a history service object. | 67 // a history service object. |
68 class Delegate { | 68 class Delegate { |
69 public: | 69 public: |
70 virtual ~Delegate() {} | 70 virtual ~Delegate() {} |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 // |languages| gives a list of language encodings with which the history | 119 // |languages| gives a list of language encodings with which the history |
120 // URLs and omnibox searches are interpreted. | 120 // URLs and omnibox searches are interpreted. |
121 // |force_fail| can be set during unittests to unconditionally fail to init. | 121 // |force_fail| can be set during unittests to unconditionally fail to init. |
122 void Init(const std::string& languages, bool force_fail); | 122 void Init(const std::string& languages, bool force_fail); |
123 | 123 |
124 // Notification that the history system is shutting down. This will break | 124 // Notification that the history system is shutting down. This will break |
125 // the refs owned by the delegate and any pending transaction so it will | 125 // the refs owned by the delegate and any pending transaction so it will |
126 // actually be deleted. | 126 // actually be deleted. |
127 void Closing(); | 127 void Closing(); |
128 | 128 |
129 // See NotifyRenderProcessHostDestruction. | 129 void ClearCachedDataForContextID(ContextID context_id); |
blundell
2014/06/11 12:17:48
This should have a comment specifying what the fun
| |
130 void NotifyRenderProcessHostDestruction(const void* host); | |
131 | 130 |
132 // Navigation ---------------------------------------------------------------- | 131 // Navigation ---------------------------------------------------------------- |
133 | 132 |
134 // |request.time| must be unique with high probability. | 133 // |request.time| must be unique with high probability. |
135 void AddPage(const HistoryAddPageArgs& request); | 134 void AddPage(const HistoryAddPageArgs& request); |
136 virtual void SetPageTitle(const GURL& url, const base::string16& title); | 135 virtual void SetPageTitle(const GURL& url, const base::string16& title); |
137 void AddPageNoVisitForBookmark(const GURL& url, const base::string16& title); | 136 void AddPageNoVisitForBookmark(const GURL& url, const base::string16& title); |
138 | 137 void UpdateWithPageEndTime(ContextID context_id, |
139 // Updates the database backend with a page's ending time stamp information. | |
blundell
2014/06/11 12:17:48
This comment can stay with "pointer to a RenderPro
| |
140 // The page can be identified by the combination of the pointer to | |
141 // a RenderProcessHost, the page id and the url. | |
142 // | |
143 // The given pointer will not be dereferenced, it is only used for | |
144 // identification purposes, hence it is a void*. | |
145 void UpdateWithPageEndTime(const void* host, | |
146 int32 page_id, | 138 int32 page_id, |
147 const GURL& url, | 139 const GURL& url, |
148 base::Time end_ts); | 140 base::Time end_ts); |
149 | 141 |
150 // Querying ------------------------------------------------------------------ | 142 // Querying ------------------------------------------------------------------ |
151 | 143 |
152 // ScheduleAutocomplete() never frees |provider| (which is globally live). | 144 // ScheduleAutocomplete() never frees |provider| (which is globally live). |
153 // It passes |params| on to the autocomplete system which will eventually | 145 // It passes |params| on to the autocomplete system which will eventually |
154 // free it. | 146 // free it. |
155 void ScheduleAutocomplete(HistoryURLProvider* provider, | 147 void ScheduleAutocomplete(HistoryURLProvider* provider, |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
879 | 871 |
880 // Listens for the system being under memory pressure. | 872 // Listens for the system being under memory pressure. |
881 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; | 873 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
882 | 874 |
883 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 875 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
884 }; | 876 }; |
885 | 877 |
886 } // namespace history | 878 } // namespace history |
887 | 879 |
888 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 880 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
OLD | NEW |