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

Side by Side Diff: chrome/browser/history/expire_history_backend.h

Issue 8910024: Add ExpireHistoryBackend::DeleteURLs method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_EXPIRE_HISTORY_BACKEND_H_ 5 #ifndef CHROME_BROWSER_HISTORY_EXPIRE_HISTORY_BACKEND_H_
6 #define CHROME_BROWSER_HISTORY_EXPIRE_HISTORY_BACKEND_H_ 6 #define CHROME_BROWSER_HISTORY_EXPIRE_HISTORY_BACKEND_H_
7 #pragma once 7 #pragma once
8 8
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 ThumbnailDatabase* thumb_db, 76 ThumbnailDatabase* thumb_db,
77 TextDatabaseManager* text_db); 77 TextDatabaseManager* text_db);
78 78
79 // Begins periodic expiration of history older than the given threshold. This 79 // Begins periodic expiration of history older than the given threshold. This
80 // will continue until the object is deleted. 80 // will continue until the object is deleted.
81 void StartArchivingOldStuff(base::TimeDelta expiration_threshold); 81 void StartArchivingOldStuff(base::TimeDelta expiration_threshold);
82 82
83 // Deletes everything associated with a URL. 83 // Deletes everything associated with a URL.
84 void DeleteURL(const GURL& url); 84 void DeleteURL(const GURL& url);
85 85
86 // Deletes everything associated with each URL in the list.
87 void DeleteURLs(const std::vector<GURL>& url);
88
86 // Removes all visits to restrict_urls (or all URLs if empty) in the given 89 // Removes all visits to restrict_urls (or all URLs if empty) in the given
87 // time range, updating the URLs accordingly, 90 // time range, updating the URLs accordingly,
88 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls, 91 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls,
89 base::Time begin_time, base::Time end_time); 92 base::Time begin_time, base::Time end_time);
90 93
91 // Removes the given list of visits, updating the URLs accordingly (similar to 94 // Removes the given list of visits, updating the URLs accordingly (similar to
92 // ExpireHistoryBetween(), but affecting a specific set of visits). 95 // ExpireHistoryBetween(), but affecting a specific set of visits).
93 void ExpireVisits(const VisitVector& visits); 96 void ExpireVisits(const VisitVector& visits);
94 97
95 // Archives all visits before and including the given time, updating the URLs 98 // Archives all visits before and including the given time, updating the URLs
96 // accordingly. This function is intended for migrating old databases 99 // accordingly. This function is intended for migrating old databases
97 // (which encompased all time) to the tiered structure and testing, and 100 // (which encompased all time) to the tiered structure and testing, and
98 // probably isn't useful for anything else. 101 // probably isn't useful for anything else.
99 void ArchiveHistoryBefore(base::Time end_time); 102 void ArchiveHistoryBefore(base::Time end_time);
100 103
101 // Returns the current time that we are archiving stuff to. This will return 104 // Returns the current time that we are archiving stuff to. This will return
102 // the threshold in absolute time rather than a delta, so the caller should 105 // the threshold in absolute time rather than a delta, so the caller should
103 // not save it. 106 // not save it.
104 base::Time GetCurrentArchiveTime() const { 107 base::Time GetCurrentArchiveTime() const {
105 return base::Time::Now() - expiration_threshold_; 108 return base::Time::Now() - expiration_threshold_;
106 } 109 }
107 110
108 private: 111 private:
109 FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, DeleteTextIndexForURL);
110 FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, DeleteFaviconsIfPossible); 112 FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, DeleteFaviconsIfPossible);
111 FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ArchiveSomeOldHistory); 113 FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ArchiveSomeOldHistory);
112 FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ExpiringVisitsReader); 114 FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ExpiringVisitsReader);
113 FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ArchiveSomeOldHistoryWithSource); 115 FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ArchiveSomeOldHistoryWithSource);
114 friend class ::TestingProfile; 116 friend class ::TestingProfile;
115 117
116 struct DeleteDependencies; 118 struct DeleteDependencies;
117 119
118 // Removes the data from the full text index associated with the given URL
119 // string/ID pair. If |update_visits| is set, the visits that reference the
120 // indexed data will be updated to reflect the fact that the indexed data is
121 // gone. Setting this to false is a performance optimization when the caller
122 // knows that the visits will be deleted after the call.
123 //
124 // TODO(brettw) when we have an "archived" history database, this should take
125 // a flag to optionally delete from there. This way it can be used for page
126 // re-indexing as well as for full URL deletion.
127 void DeleteTextIndexForURL(const GURL& url, URLID url_id, bool update_visits);
128
129 // Deletes the visit-related stuff for all the visits in the given list, and 120 // Deletes the visit-related stuff for all the visits in the given list, and
130 // adds the rows for unique URLs affected to the affected_urls list in 121 // adds the rows for unique URLs affected to the affected_urls list in
131 // the dependencies structure. 122 // the dependencies structure.
132 // 123 //
133 // Deleted information is the visits themselves and the full-text index 124 // Deleted information is the visits themselves and the full-text index
134 // entries corresponding to them. 125 // entries corresponding to them.
135 void DeleteVisitRelatedInfo(const VisitVector& visits, 126 void DeleteVisitRelatedInfo(const VisitVector& visits,
136 DeleteDependencies* dependencies); 127 DeleteDependencies* dependencies);
137 128
138 // Moves the given visits from the main database to the archived one. 129 // Moves the given visits from the main database to the archived one.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Use GetBookmarkService to access this, which makes sure the service is 278 // Use GetBookmarkService to access this, which makes sure the service is
288 // loaded. 279 // loaded.
289 BookmarkService* bookmark_service_; 280 BookmarkService* bookmark_service_;
290 281
291 DISALLOW_COPY_AND_ASSIGN(ExpireHistoryBackend); 282 DISALLOW_COPY_AND_ASSIGN(ExpireHistoryBackend);
292 }; 283 };
293 284
294 } // namespace history 285 } // namespace history
295 286
296 #endif // CHROME_BROWSER_HISTORY_EXPIRE_HISTORY_BACKEND_H_ 287 #endif // CHROME_BROWSER_HISTORY_EXPIRE_HISTORY_BACKEND_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/history/expire_history_backend.cc » ('j') | chrome/browser/history/expire_history_backend.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698