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: components/offline_pages/offline_page_model_impl.h

Issue 2512073002: [Offline Pages] Removes two-step expiration related. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 const std::vector<ClientId>& client_ids, 83 const std::vector<ClientId>& client_ids,
84 const MultipleOfflinePageItemCallback& callback) override; 84 const MultipleOfflinePageItemCallback& callback) override;
85 85
86 void DeleteCachedPagesByURLPredicate( 86 void DeleteCachedPagesByURLPredicate(
87 const UrlPredicate& predicate, 87 const UrlPredicate& predicate,
88 const DeletePageCallback& callback) override; 88 const DeletePageCallback& callback) override;
89 void CheckPagesExistOffline( 89 void CheckPagesExistOffline(
90 const std::set<GURL>& urls, 90 const std::set<GURL>& urls,
91 const CheckPagesExistOfflineCallback& callback) override; 91 const CheckPagesExistOfflineCallback& callback) override;
92 void GetAllPages(const MultipleOfflinePageItemCallback& callback) override; 92 void GetAllPages(const MultipleOfflinePageItemCallback& callback) override;
93 void GetAllPagesWithExpired(
94 const MultipleOfflinePageItemCallback& callback) override;
95 void GetOfflineIdsForClientId( 93 void GetOfflineIdsForClientId(
96 const ClientId& client_id, 94 const ClientId& client_id,
97 const MultipleOfflineIdCallback& callback) override; 95 const MultipleOfflineIdCallback& callback) override;
98 void GetPageByOfflineId( 96 void GetPageByOfflineId(
99 int64_t offline_id, 97 int64_t offline_id,
100 const SingleOfflinePageItemCallback& callback) override; 98 const SingleOfflinePageItemCallback& callback) override;
101 void GetPagesByOnlineURL( 99 void GetPagesByOnlineURL(
102 const GURL& online_url, 100 const GURL& online_url,
103 const MultipleOfflinePageItemCallback& callback) override; 101 const MultipleOfflinePageItemCallback& callback) override;
104 void ExpirePages(const std::vector<int64_t>& offline_ids,
105 const base::Time& expiration_time,
106 const base::Callback<void(bool)>& callback) override;
107 ClientPolicyController* GetPolicyController() override; 102 ClientPolicyController* GetPolicyController() override;
108 103
109 // Methods for testing only: 104 // Methods for testing only:
110 OfflinePageMetadataStore* GetStoreForTesting(); 105 OfflinePageMetadataStore* GetStoreForTesting();
111 void set_testing_clock(base::Clock* clock) { testing_clock_ = clock; } 106 void set_testing_clock(base::Clock* clock) { testing_clock_ = clock; }
112 107
113 OfflinePageStorageManager* GetStorageManager(); 108 OfflinePageStorageManager* GetStorageManager();
114 109
115 bool is_loaded() const override; 110 bool is_loaded() const override;
116 111
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 std::unique_ptr<OfflinePagesUpdateResult> result); 177 std::unique_ptr<OfflinePagesUpdateResult> result);
183 void InformDeletePageDone(const DeletePageCallback& callback, 178 void InformDeletePageDone(const DeletePageCallback& callback,
184 DeletePageResult result); 179 DeletePageResult result);
185 180
186 void OnMarkPageAccesseDone(const OfflinePageItem& offline_page_item, 181 void OnMarkPageAccesseDone(const OfflinePageItem& offline_page_item,
187 std::unique_ptr<OfflinePagesUpdateResult> result); 182 std::unique_ptr<OfflinePagesUpdateResult> result);
188 183
189 // Callbacks for checking metadata consistency. 184 // Callbacks for checking metadata consistency.
190 void CheckMetadataConsistencyForArchivePaths( 185 void CheckMetadataConsistencyForArchivePaths(
191 const std::set<base::FilePath>& archive_paths); 186 const std::set<base::FilePath>& archive_paths);
192 // Callback called after headless archives deleted. Orphaned archives are 187 // Callbacks called after orphaned archives deleted. Orphaned archives are
193 // archives files on disk which are not pointed to by any of the page items 188 // archives files on disk which are not pointed to by any of the page items
194 // in metadata store. 189 // in metadata store.
195 void ExpirePagesMissingArchiveFile( 190 void DeletePagesMissingArchiveFile(
196 const std::set<base::FilePath>& archive_paths); 191 const std::set<base::FilePath>& archive_paths);
197 void OnExpirePagesMissingArchiveFileDone( 192 void OnDeletePagesMissingArchiveFileDone(
198 const std::vector<int64_t>& offline_ids, 193 const std::vector<int64_t>& offline_ids,
199 bool success); 194 DeletePageResult result);
200 void DeleteOrphanedArchives(const std::set<base::FilePath>& archive_paths); 195 void DeleteOrphanedArchives(const std::set<base::FilePath>& archive_paths);
201 void OnDeleteOrphanedArchivesDone(const std::vector<base::FilePath>& archives, 196 void OnDeleteOrphanedArchivesDone(const std::vector<base::FilePath>& archives,
202 bool success); 197 bool success);
203 198
204 // Callbacks for deleting pages with same URL when saving pages. 199 // Callbacks for deleting pages with same URL when saving pages.
205 void DeleteExistingPagesWithSameURL(const OfflinePageItem& offline_page); 200 void DeleteExistingPagesWithSameURL(const OfflinePageItem& offline_page);
206 void OnPagesFoundWithSameURL(const OfflinePageItem& offline_page, 201 void OnPagesFoundWithSameURL(const OfflinePageItem& offline_page,
207 size_t pages_allowed, 202 size_t pages_allowed,
208 const MultipleOfflinePageItemResult& items); 203 const MultipleOfflinePageItemResult& items);
209 void OnDeleteOldPagesWithSameURL(DeletePageResult result); 204 void OnDeleteOldPagesWithSameURL(DeletePageResult result);
210 205
211 void CacheLoadedData(const std::vector<OfflinePageItem>& offline_pages); 206 void CacheLoadedData(const std::vector<OfflinePageItem>& offline_pages);
212 207
213 // Actually does the work of deleting, requires the model is loaded. 208 // Actually does the work of deleting, requires the model is loaded.
214 void DoDeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, 209 void DoDeletePagesByOfflineId(const std::vector<int64_t>& offline_ids,
215 const DeletePageCallback& callback); 210 const DeletePageCallback& callback);
216 211
217 // Actually does the work of deleting, requires the model is loaded. 212 // Actually does the work of deleting, requires the model is loaded.
218 void DeletePages(const DeletePageCallback& callback, 213 void DeletePages(const DeletePageCallback& callback,
219 const MultipleOfflinePageItemResult& items); 214 const MultipleOfflinePageItemResult& items);
220 215
221 void DoGetPagesByClientIds(const std::vector<ClientId>& client_ids, 216 void DoGetPagesByClientIds(const std::vector<ClientId>& client_ids,
222 const MultipleOfflinePageItemCallback& callback); 217 const MultipleOfflinePageItemCallback& callback);
223 218
224 // Similar to DoDeletePagesByOfflineId, does actual work of deleting, and 219 // Similar to DoDeletePagesByOfflineId, does actual work of deleting, and
225 // requires that the model is loaded. 220 // requires that the model is loaded.
226 void DoDeleteCachedPagesByURLPredicate(const UrlPredicate& predicate, 221 void DoDeleteCachedPagesByURLPredicate(const UrlPredicate& predicate,
227 const DeletePageCallback& callback); 222 const DeletePageCallback& callback);
228 223
229 // Callback completing page expiration.
230 void OnExpirePageDone(const base::Time& expiration_time,
231 std::unique_ptr<OfflinePagesUpdateResult> result);
232
233 // Clears expired pages if there are any. 224 // Clears expired pages if there are any.
jianli 2016/11/18 00:15:48 Update comment.
romax 2016/11/18 20:50:49 we still have pages which have been living longer
234 void ClearStorageIfNeeded( 225 void ClearStorageIfNeeded(
235 const OfflinePageStorageManager::ClearStorageCallback& callback); 226 const OfflinePageStorageManager::ClearStorageCallback& callback);
236 227
237 // Callback completing storage clearing. 228 // Callback completing storage clearing.
238 void OnStorageCleared(size_t expired_page_count, 229 void OnStorageCleared(size_t cleared_page_count,
239 OfflinePageStorageManager::ClearStorageResult result); 230 OfflinePageStorageManager::ClearStorageResult result);
240 231
241 // Post task to clear storage. 232 // Post task to clear storage.
242 void PostClearStorageIfNeededTask(); 233 void PostClearStorageIfNeededTask();
243 234
244 // Check if |offline_page| should be removed on cache reset by user. 235 // Check if |offline_page| should be removed on cache reset by user.
245 bool IsRemovedOnCacheReset(const OfflinePageItem& offline_page) const; 236 bool IsRemovedOnCacheReset(const OfflinePageItem& offline_page) const;
246 237
247 void RunWhenLoaded(const base::Closure& job); 238 void RunWhenLoaded(const base::Closure& job);
248 239
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 base::Clock* testing_clock_; 277 base::Clock* testing_clock_;
287 278
288 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; 279 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_;
289 280
290 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); 281 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl);
291 }; 282 };
292 283
293 } // namespace offline_pages 284 } // namespace offline_pages
294 285
295 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ 286 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698