OLD | NEW |
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_IMPL_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_IMPL_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_IMPL_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 // OfflinePageMetadataStore implementation: | 41 // OfflinePageMetadataStore implementation: |
42 void Load(const LoadCallback& callback) override; | 42 void Load(const LoadCallback& callback) override; |
43 void AddOrUpdateOfflinePage(const OfflinePageItem& offline_page_record, | 43 void AddOrUpdateOfflinePage(const OfflinePageItem& offline_page_record, |
44 const UpdateCallback& callback) override; | 44 const UpdateCallback& callback) override; |
45 void RemoveOfflinePages(const std::vector<int64_t>& offline_ids, | 45 void RemoveOfflinePages(const std::vector<int64_t>& offline_ids, |
46 const UpdateCallback& callback) override; | 46 const UpdateCallback& callback) override; |
47 void Reset(const ResetCallback& callback) override; | 47 void Reset(const ResetCallback& callback) override; |
48 | 48 |
49 private: | 49 private: |
| 50 friend class OfflinePageMetadataStoreImplTest; |
| 51 |
50 void LoadContinuation(const LoadCallback& callback, bool success); | 52 void LoadContinuation(const LoadCallback& callback, bool success); |
51 void LoadDone(const LoadCallback& callback, | 53 void LoadDone(const LoadCallback& callback, |
52 bool success, | 54 bool success, |
53 scoped_ptr<std::vector<OfflinePageEntry>> entries); | 55 scoped_ptr<std::vector<OfflinePageEntry>> entries); |
54 void NotifyLoadResult(const LoadCallback& callback, | 56 void NotifyLoadResult(const LoadCallback& callback, |
55 LoadStatus status, | 57 LoadStatus status, |
56 const std::vector<OfflinePageItem>& result); | 58 const std::vector<OfflinePageItem>& result); |
57 | 59 |
58 // Implements the update. | 60 // Implements the update. |
59 void UpdateEntries( | 61 void UpdateEntries( |
(...skipping 14 matching lines...) Expand all Loading... |
74 LoadStatus status, | 76 LoadStatus status, |
75 const std::vector<OfflinePageItem>& result, | 77 const std::vector<OfflinePageItem>& result, |
76 bool success); | 78 bool success); |
77 | 79 |
78 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; | 80 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
79 base::FilePath database_dir_; | 81 base::FilePath database_dir_; |
80 scoped_ptr<leveldb_proto::ProtoDatabase<OfflinePageEntry>> database_; | 82 scoped_ptr<leveldb_proto::ProtoDatabase<OfflinePageEntry>> database_; |
81 | 83 |
82 base::WeakPtrFactory<OfflinePageMetadataStoreImpl> weak_ptr_factory_; | 84 base::WeakPtrFactory<OfflinePageMetadataStoreImpl> weak_ptr_factory_; |
83 | 85 |
84 FRIEND_TEST_ALL_PREFIXES(OfflinePageMetadataStoreImplTest, | |
85 LoadCorruptedStore); | |
86 FRIEND_TEST_ALL_PREFIXES(OfflinePageMetadataStoreImplTest, | |
87 LoadTotallyCorruptedStore); | |
88 | |
89 DISALLOW_COPY_AND_ASSIGN(OfflinePageMetadataStoreImpl); | 86 DISALLOW_COPY_AND_ASSIGN(OfflinePageMetadataStoreImpl); |
90 }; | 87 }; |
91 | 88 |
92 } // namespace offline_pages | 89 } // namespace offline_pages |
93 | 90 |
94 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_IMPL_H_ | 91 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_IMPL_H_ |
OLD | NEW |