| OLD | NEW | 
|---|
| 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_SAFE_BROWSING_DB_V4_DATABASE_H_ | 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_ | 
| 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_ | 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_ | 
| 7 | 7 | 
| 8 #include "base/callback.h" | 8 #include "base/callback.h" | 
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" | 
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" | 
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" | 
| 12 #include "base/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" | 
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" | 
| 14 #include "components/safe_browsing_db/v4_protocol_manager_util.h" | 14 #include "components/safe_browsing_db/v4_protocol_manager_util.h" | 
| 15 #include "components/safe_browsing_db/v4_store.h" | 15 #include "components/safe_browsing_db/v4_store.h" | 
| 16 | 16 | 
|  | 17 namespace subresource_filter { | 
|  | 18 class SubresourceFilterBrowserTestImpl; | 
|  | 19 } | 
|  | 20 | 
| 17 namespace safe_browsing { | 21 namespace safe_browsing { | 
| 18 | 22 | 
| 19 class V4Database; | 23 class V4Database; | 
| 20 | 24 | 
| 21 // Scheduled when the database has been read from disk and is ready to process | 25 // Scheduled when the database has been read from disk and is ready to process | 
| 22 // resource reputation requests. | 26 // resource reputation requests. | 
| 23 typedef base::Callback<void(std::unique_ptr<V4Database>)> | 27 typedef base::Callback<void(std::unique_ptr<V4Database>)> | 
| 24     NewDatabaseReadyCallback; | 28     NewDatabaseReadyCallback; | 
| 25 | 29 | 
| 26 // Scheduled when the checksum for all the stores in the database has been | 30 // Scheduled when the checksum for all the stores in the database has been | 
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 145 | 149 | 
| 146   // Records the size of each of the stores managed by this database, along | 150   // Records the size of each of the stores managed by this database, along | 
| 147   // with the combined size of all the stores. | 151   // with the combined size of all the stores. | 
| 148   void RecordFileSizeHistograms(); | 152   void RecordFileSizeHistograms(); | 
| 149 | 153 | 
| 150  protected: | 154  protected: | 
| 151   V4Database(const scoped_refptr<base::SequencedTaskRunner>& db_task_runner, | 155   V4Database(const scoped_refptr<base::SequencedTaskRunner>& db_task_runner, | 
| 152              std::unique_ptr<StoreMap> store_map); | 156              std::unique_ptr<StoreMap> store_map); | 
| 153 | 157 | 
| 154  private: | 158  private: | 
|  | 159   friend class subresource_filter::SubresourceFilterBrowserTestImpl; | 
| 155   friend class V4DatabaseFactory; | 160   friend class V4DatabaseFactory; | 
| 156   friend class V4DatabaseTest; | 161   friend class V4DatabaseTest; | 
| 157   friend class V4SafeBrowsingServiceTest; | 162   friend class V4SafeBrowsingServiceTest; | 
| 158   FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestSetupDatabaseWithFakeStores); | 163   FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestSetupDatabaseWithFakeStores); | 
| 159   FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, | 164   FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, | 
| 160                            TestSetupDatabaseWithFakeStoresFailsReset); | 165                            TestSetupDatabaseWithFakeStoresFailsReset); | 
| 161   FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestApplyUpdateWithNewStates); | 166   FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestApplyUpdateWithNewStates); | 
| 162   FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestApplyUpdateWithNoNewState); | 167   FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestApplyUpdateWithNoNewState); | 
| 163   FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestApplyUpdateWithEmptyUpdate); | 168   FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestApplyUpdateWithEmptyUpdate); | 
| 164   FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestApplyUpdateWithInvalidUpdate); | 169   FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestApplyUpdateWithInvalidUpdate); | 
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 219   // Only meant to be dereferenced and invalidated on the IO thread and hence | 224   // Only meant to be dereferenced and invalidated on the IO thread and hence | 
| 220   // named. For details, see the comment at the top of weak_ptr.h | 225   // named. For details, see the comment at the top of weak_ptr.h | 
| 221   base::WeakPtrFactory<V4Database> weak_factory_on_io_; | 226   base::WeakPtrFactory<V4Database> weak_factory_on_io_; | 
| 222 | 227 | 
| 223   DISALLOW_COPY_AND_ASSIGN(V4Database); | 228   DISALLOW_COPY_AND_ASSIGN(V4Database); | 
| 224 }; | 229 }; | 
| 225 | 230 | 
| 226 }  // namespace safe_browsing | 231 }  // namespace safe_browsing | 
| 227 | 232 | 
| 228 #endif  // COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_ | 233 #endif  // COMPONENTS_SAFE_BROWSING_DB_V4_DATABASE_H_ | 
| OLD | NEW | 
|---|