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

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

Issue 2497703002: [Offline pages] Resetting offline page metadata store to handle LOAD/INIT failures (Closed)
Patch Set: Fixing newly added test 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
« no previous file with comments | « no previous file | components/offline_pages/offline_page_metadata_store_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_METADATA_STORE_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 20 matching lines...) Expand all
31 enum LoadStatus { 31 enum LoadStatus {
32 LOAD_SUCCEEDED, 32 LOAD_SUCCEEDED,
33 STORE_INIT_FAILED, 33 STORE_INIT_FAILED,
34 STORE_LOAD_FAILED, 34 STORE_LOAD_FAILED,
35 DATA_PARSING_FAILED, 35 DATA_PARSING_FAILED,
36 36
37 // NOTE: always keep this entry at the end. 37 // NOTE: always keep this entry at the end.
38 LOAD_STATUS_COUNT 38 LOAD_STATUS_COUNT
39 }; 39 };
40 40
41 typedef base::Callback<void(LoadStatus, const std::vector<OfflinePageItem>&)> 41 typedef base::Callback<void(const std::vector<OfflinePageItem>&)>
42 LoadCallback; 42 LoadCallback;
43 typedef base::Callback<void(bool)> InitializeCallback;
43 typedef base::Callback<void(ItemActionStatus)> AddCallback; 44 typedef base::Callback<void(ItemActionStatus)> AddCallback;
44 typedef base::Callback<void(std::unique_ptr<OfflinePagesUpdateResult>)> 45 typedef base::Callback<void(std::unique_ptr<OfflinePagesUpdateResult>)>
45 UpdateCallback; 46 UpdateCallback;
46 typedef base::Callback<void(bool)> ResetCallback; 47 typedef base::Callback<void(bool)> ResetCallback;
47 48
48 OfflinePageMetadataStore(); 49 OfflinePageMetadataStore();
49 virtual ~OfflinePageMetadataStore(); 50 virtual ~OfflinePageMetadataStore();
50 51
52 // Initializes the store. Should be called before any other methods.
53 virtual void Initialize(const InitializeCallback& callback) = 0;
54
51 // Get all of the offline pages from the store. 55 // Get all of the offline pages from the store.
52 virtual void GetOfflinePages(const LoadCallback& callback) = 0; 56 virtual void GetOfflinePages(const LoadCallback& callback) = 0;
53 57
54 // Asynchronously adds an offline page item metadata to the store. 58 // Asynchronously adds an offline page item metadata to the store.
55 virtual void AddOfflinePage(const OfflinePageItem& offline_page, 59 virtual void AddOfflinePage(const OfflinePageItem& offline_page,
56 const AddCallback& callback) = 0; 60 const AddCallback& callback) = 0;
57 61
58 // Asynchronously updates a set of offline page items in the store. 62 // Asynchronously updates a set of offline page items in the store.
59 virtual void UpdateOfflinePages(const std::vector<OfflinePageItem>& pages, 63 virtual void UpdateOfflinePages(const std::vector<OfflinePageItem>& pages,
60 const UpdateCallback& callback) = 0; 64 const UpdateCallback& callback) = 0;
61 65
62 // Asynchronously removes offline page metadata from the store. 66 // Asynchronously removes offline page metadata from the store.
63 // Result of the update is passed in callback. 67 // Result of the update is passed in callback.
64 virtual void RemoveOfflinePages(const std::vector<int64_t>& offline_ids, 68 virtual void RemoveOfflinePages(const std::vector<int64_t>& offline_ids,
65 const UpdateCallback& callback) = 0; 69 const UpdateCallback& callback) = 0;
66 70
67 // Resets the store. 71 // Resets the store.
68 virtual void Reset(const ResetCallback& callback) = 0; 72 virtual void Reset(const ResetCallback& callback) = 0;
69 73
70 // Gets the store state. 74 // Gets the store state.
71 virtual StoreState state() const = 0; 75 virtual StoreState state() const = 0;
72 }; 76 };
73 77
74 } // namespace offline_pages 78 } // namespace offline_pages
75 79
76 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ 80 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_
OLDNEW
« no previous file with comments | « no previous file | components/offline_pages/offline_page_metadata_store_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698