| 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 CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ |
| 6 #define CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/history/download_database.h" | 12 #include "chrome/browser/history/download_database.h" |
| 13 #include "chrome/browser/history/history_types.h" | 13 #include "chrome/browser/history/history_types.h" |
| 14 #include "chrome/browser/history/url_database.h" | 14 #include "chrome/browser/history/url_database.h" |
| 15 #include "chrome/browser/history/visit_database.h" | 15 #include "chrome/browser/history/visit_database.h" |
| 16 #include "chrome/browser/history/visitsegment_database.h" | 16 #include "chrome/browser/history/visitsegment_database.h" |
| 17 #include "sql/connection.h" | 17 #include "sql/connection.h" |
| 18 #include "sql/init_status.h" | 18 #include "sql/init_status.h" |
| 19 #include "sql/meta_table.h" | 19 #include "sql/meta_table.h" |
| 20 | 20 |
| 21 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
| 22 #include "chrome/browser/history/android/android_cache_database.h" | 22 #include "chrome/browser/history/android/android_cache_database.h" |
| 23 #include "chrome/browser/history/android/android_urls_database.h" | 23 #include "chrome/browser/history/android/android_urls_database.h" |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 namespace base { |
| 26 class FilePath; | 27 class FilePath; |
| 28 } |
| 27 | 29 |
| 28 namespace history { | 30 namespace history { |
| 29 | 31 |
| 30 // Encapsulates the SQL connection for the history database. This class holds | 32 // Encapsulates the SQL connection for the history database. This class holds |
| 31 // the database connection and has methods the history system (including full | 33 // the database connection and has methods the history system (including full |
| 32 // text search) uses for writing and retrieving information. | 34 // text search) uses for writing and retrieving information. |
| 33 // | 35 // |
| 34 // We try to keep most logic out of the history database; this should be seen | 36 // We try to keep most logic out of the history database; this should be seen |
| 35 // as the storage interface. Logic for manipulating this storage layer should | 37 // as the storage interface. Logic for manipulating this storage layer should |
| 36 // be in HistoryBackend.cc. | 38 // be in HistoryBackend.cc. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 60 // Must call Init() to complete construction. Although it can be created on | 62 // Must call Init() to complete construction. Although it can be created on |
| 61 // any thread, it must be destructed on the history thread for proper | 63 // any thread, it must be destructed on the history thread for proper |
| 62 // database cleanup. | 64 // database cleanup. |
| 63 HistoryDatabase(); | 65 HistoryDatabase(); |
| 64 | 66 |
| 65 virtual ~HistoryDatabase(); | 67 virtual ~HistoryDatabase(); |
| 66 | 68 |
| 67 // Must call this function to complete initialization. Will return | 69 // Must call this function to complete initialization. Will return |
| 68 // sql::INIT_OK on success. Otherwise, no other function should be called. You | 70 // sql::INIT_OK on success. Otherwise, no other function should be called. You |
| 69 // may want to call BeginExclusiveMode after this when you are ready. | 71 // may want to call BeginExclusiveMode after this when you are ready. |
| 70 sql::InitStatus Init(const FilePath& history_name, | 72 sql::InitStatus Init(const base::FilePath& history_name, |
| 71 sql::ErrorDelegate* error_delegate); | 73 sql::ErrorDelegate* error_delegate); |
| 72 | 74 |
| 73 // Call to set the mode on the database to exclusive. The default locking mode | 75 // Call to set the mode on the database to exclusive. The default locking mode |
| 74 // is "normal" but we want to run in exclusive mode for slightly better | 76 // is "normal" but we want to run in exclusive mode for slightly better |
| 75 // performance since we know nobody else is using the database. This is | 77 // performance since we know nobody else is using the database. This is |
| 76 // separate from Init() since the in-memory database attaches to slurp the | 78 // separate from Init() since the in-memory database attaches to slurp the |
| 77 // data out, and this can't happen in exclusive mode. | 79 // data out, and this can't happen in exclusive mode. |
| 78 void BeginExclusiveMode(); | 80 void BeginExclusiveMode(); |
| 79 | 81 |
| 80 // Returns the current version that we will generate history databases with. | 82 // Returns the current version that we will generate history databases with. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 194 |
| 193 // See the getters above. | 195 // See the getters above. |
| 194 bool needs_version_17_migration_; | 196 bool needs_version_17_migration_; |
| 195 | 197 |
| 196 DISALLOW_COPY_AND_ASSIGN(HistoryDatabase); | 198 DISALLOW_COPY_AND_ASSIGN(HistoryDatabase); |
| 197 }; | 199 }; |
| 198 | 200 |
| 199 } // namespace history | 201 } // namespace history |
| 200 | 202 |
| 201 #endif // CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ | 203 #endif // CHROME_BROWSER_HISTORY_HISTORY_DATABASE_H_ |
| OLD | NEW |