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

Side by Side Diff: components/offline_pages/offline_page_model_impl.h

Issue 2384423003: [Offline pages] Resetting offline page metadata store if initial load fails (Closed)
Patch Set: Rebased and comments addressed Created 4 years, 2 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
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 int64_t offline_id, 145 int64_t offline_id,
146 const SingleOfflinePageItemCallback& callback) const; 146 const SingleOfflinePageItemCallback& callback) const;
147 void GetPagesByOnlineURLWhenLoadDone( 147 void GetPagesByOnlineURLWhenLoadDone(
148 const GURL& online_url, 148 const GURL& online_url,
149 const MultipleOfflinePageItemCallback& callback) const; 149 const MultipleOfflinePageItemCallback& callback) const;
150 void MarkPageAccessedWhenLoadDone(int64_t offline_id); 150 void MarkPageAccessedWhenLoadDone(int64_t offline_id);
151 151
152 void CheckMetadataConsistency(); 152 void CheckMetadataConsistency();
153 153
154 // Callback for loading pages from the offline page metadata store. 154 // Callback for loading pages from the offline page metadata store.
155 void OnLoadDone(const base::TimeTicks& start_time, 155 void OnGetOfflinePagesDoneForInit(
156 OfflinePageMetadataStore::LoadStatus load_status, 156 const base::TimeTicks& start_time,
157 const std::vector<OfflinePageItem>& offline_pages); 157 StoreState store_state,
158 const std::vector<OfflinePageItem>& offline_pages);
159
160 // Attempts to reset the store.
161 bool MaybeResetStore(const base::TimeTicks& start_time);
162 // Callback for resetting the offline page metadata store.
163 void OnStoreResetDone(const base::TimeTicks& start_time, bool success);
158 164
159 // Steps for saving a page offline. 165 // Steps for saving a page offline.
160 void OnCreateArchiveDone(const GURL& requested_url, 166 void OnCreateArchiveDone(const GURL& requested_url,
161 int64_t offline_id, 167 int64_t offline_id,
162 const ClientId& client_id, 168 const ClientId& client_id,
163 const base::Time& start_time, 169 const base::Time& start_time,
164 const SavePageCallback& callback, 170 const SavePageCallback& callback,
165 OfflinePageArchiver* archiver, 171 OfflinePageArchiver* archiver,
166 OfflinePageArchiver::ArchiverResult result, 172 OfflinePageArchiver::ArchiverResult result,
167 const GURL& url, 173 const GURL& url,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // Manager for the storage consumed by archives and responsible for 278 // Manager for the storage consumed by archives and responsible for
273 // automatic page clearing. 279 // automatic page clearing.
274 std::unique_ptr<OfflinePageStorageManager> storage_manager_; 280 std::unique_ptr<OfflinePageStorageManager> storage_manager_;
275 281
276 // Manager for the offline archive files and directory. 282 // Manager for the offline archive files and directory.
277 std::unique_ptr<ArchiveManager> archive_manager_; 283 std::unique_ptr<ArchiveManager> archive_manager_;
278 284
279 // Logger to facilitate recording of events. 285 // Logger to facilitate recording of events.
280 OfflinePageModelEventLogger offline_event_logger_; 286 OfflinePageModelEventLogger offline_event_logger_;
281 287
288 // Remaining store reset attempts left. (To prevent infinite attempts.)
289 int store_reset_attempts_left_;
290
282 // Clock for getting time in testing code. The setter is responsible to reset 291 // Clock for getting time in testing code. The setter is responsible to reset
283 // it once it is not longer needed. 292 // it once it is not longer needed.
284 base::Clock* testing_clock_; 293 base::Clock* testing_clock_;
285 294
286 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; 295 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_;
287 296
288 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); 297 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl);
289 }; 298 };
290 299
291 } // namespace offline_pages 300 } // namespace offline_pages
292 301
293 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ 302 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698