| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ |
| 6 #define COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "components/history/core/browser/history_types.h" | 12 #include "components/history/core/browser/history_types.h" |
| 13 #include "sql/connection.h" | 13 #include "sql/connection.h" |
| 14 #include "sql/init_status.h" | 14 #include "sql/init_status.h" |
| 15 #include "sql/meta_table.h" | 15 #include "sql/meta_table.h" |
| 16 #include "sql/statement.h" | 16 #include "sql/statement.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class FilePath; | 19 class FilePath; |
| 20 class RefCountedMemory; | 20 class RefCountedMemory; |
| 21 class Time; | 21 class Time; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace history { | 24 namespace history { |
| 25 | 25 |
| 26 class HistoryClient; | 26 class HistoryBackendClient; |
| 27 | 27 |
| 28 // This database interface is owned by the history backend and runs on the | 28 // This database interface is owned by the history backend and runs on the |
| 29 // history thread. It is a totally separate component from history partially | 29 // history thread. It is a totally separate component from history partially |
| 30 // because we may want to move it to its own thread in the future. The | 30 // because we may want to move it to its own thread in the future. The |
| 31 // operations we will do on this database will be slow, but we can tolerate | 31 // operations we will do on this database will be slow, but we can tolerate |
| 32 // higher latency (it's OK for thumbnails to come in slower than the rest | 32 // higher latency (it's OK for thumbnails to come in slower than the rest |
| 33 // of the data). Moving this to a separate thread would not block potentially | 33 // of the data). Moving this to a separate thread would not block potentially |
| 34 // higher priority history operations. | 34 // higher priority history operations. |
| 35 class ThumbnailDatabase { | 35 class ThumbnailDatabase { |
| 36 public: | 36 public: |
| 37 explicit ThumbnailDatabase(HistoryClient* history_client); | 37 explicit ThumbnailDatabase(HistoryBackendClient* backend_client); |
| 38 ~ThumbnailDatabase(); | 38 ~ThumbnailDatabase(); |
| 39 | 39 |
| 40 // Must be called after creation but before any other methods are called. | 40 // Must be called after creation but before any other methods are called. |
| 41 // When not INIT_OK, no other functions should be called. | 41 // When not INIT_OK, no other functions should be called. |
| 42 sql::InitStatus Init(const base::FilePath& db_name); | 42 sql::InitStatus Init(const base::FilePath& db_name); |
| 43 | 43 |
| 44 // Computes and records various metrics for the database. Should only be | 44 // Computes and records various metrics for the database. Should only be |
| 45 // called once and only upon successful Init. | 45 // called once and only upon successful Init. |
| 46 void ComputeDatabaseMetrics(); | 46 void ComputeDatabaseMetrics(); |
| 47 | 47 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 265 |
| 266 // Adds support for bitmap usage tracking. | 266 // Adds support for bitmap usage tracking. |
| 267 bool UpgradeToVersion8(); | 267 bool UpgradeToVersion8(); |
| 268 | 268 |
| 269 // Returns true if the |favicons| database is missing a column. | 269 // Returns true if the |favicons| database is missing a column. |
| 270 bool IsFaviconDBStructureIncorrect(); | 270 bool IsFaviconDBStructureIncorrect(); |
| 271 | 271 |
| 272 sql::Connection db_; | 272 sql::Connection db_; |
| 273 sql::MetaTable meta_table_; | 273 sql::MetaTable meta_table_; |
| 274 | 274 |
| 275 HistoryClient* history_client_; | 275 HistoryBackendClient* backend_client_; |
| 276 }; | 276 }; |
| 277 | 277 |
| 278 } // namespace history | 278 } // namespace history |
| 279 | 279 |
| 280 #endif // COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ | 280 #endif // COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ |
| OLD | NEW |