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

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: 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 const GURL& offline_url, 153 const GURL& offline_url,
154 const MultipleOfflinePageItemCallback& callback) const; 154 const MultipleOfflinePageItemCallback& callback) const;
155 void GetPageByOfflineURLWhenLoadDone( 155 void GetPageByOfflineURLWhenLoadDone(
156 const GURL& offline_url, 156 const GURL& offline_url,
157 const SingleOfflinePageItemCallback& callback) const; 157 const SingleOfflinePageItemCallback& callback) const;
158 void MarkPageAccessedWhenLoadDone(int64_t offline_id); 158 void MarkPageAccessedWhenLoadDone(int64_t offline_id);
159 159
160 void CheckMetadataConsistency(); 160 void CheckMetadataConsistency();
161 161
162 // Callback for loading pages from the offline page metadata store. 162 // Callback for loading pages from the offline page metadata store.
163 void OnLoadDone(const base::TimeTicks& start_time, 163 void OnGetOfflinePagesDoneForInit(
164 OfflinePageMetadataStore::LoadStatus load_status, 164 const base::TimeTicks& start_time,
165 const std::vector<OfflinePageItem>& offline_pages); 165 StoreState store_state,
166 const std::vector<OfflinePageItem>& offline_pages);
167
168 // Attempts to reset the store.
169 bool MaybeResetStore(const base::TimeTicks& start_time);
170 // Callback for resetting the offline page metadata store.
171 void OnStoreResetDone(const base::TimeTicks& start_time, bool success);
166 172
167 // Steps for saving a page offline. 173 // Steps for saving a page offline.
168 void OnCreateArchiveDone(const GURL& requested_url, 174 void OnCreateArchiveDone(const GURL& requested_url,
169 int64_t offline_id, 175 int64_t offline_id,
170 const ClientId& client_id, 176 const ClientId& client_id,
171 const base::Time& start_time, 177 const base::Time& start_time,
172 const SavePageCallback& callback, 178 const SavePageCallback& callback,
173 OfflinePageArchiver* archiver, 179 OfflinePageArchiver* archiver,
174 OfflinePageArchiver::ArchiverResult result, 180 OfflinePageArchiver::ArchiverResult result,
175 const GURL& url, 181 const GURL& url,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // Manager for the storage consumed by archives and responsible for 286 // Manager for the storage consumed by archives and responsible for
281 // automatic page clearing. 287 // automatic page clearing.
282 std::unique_ptr<OfflinePageStorageManager> storage_manager_; 288 std::unique_ptr<OfflinePageStorageManager> storage_manager_;
283 289
284 // Manager for the offline archive files and directory. 290 // Manager for the offline archive files and directory.
285 std::unique_ptr<ArchiveManager> archive_manager_; 291 std::unique_ptr<ArchiveManager> archive_manager_;
286 292
287 // Logger to facilitate recording of events. 293 // Logger to facilitate recording of events.
288 OfflinePageModelEventLogger offline_event_logger_; 294 OfflinePageModelEventLogger offline_event_logger_;
289 295
296 // Remaining store reset attempts left. (To prevent infinite attempts.)
297 int store_reset_attempts_left_;
298
290 // Clock for getting time in testing code. The setter is responsible to reset 299 // Clock for getting time in testing code. The setter is responsible to reset
291 // it once it is not longer needed. 300 // it once it is not longer needed.
292 base::Clock* testing_clock_; 301 base::Clock* testing_clock_;
293 302
294 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_; 303 base::WeakPtrFactory<OfflinePageModelImpl> weak_ptr_factory_;
295 304
296 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl); 305 DISALLOW_COPY_AND_ASSIGN(OfflinePageModelImpl);
297 }; 306 };
298 307
299 } // namespace offline_pages 308 } // namespace offline_pages
300 309
301 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_ 310 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_MODEL_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698