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_HISTORY_DATABASE_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_DATABASE_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_DATABASE_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_DATABASE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "components/history/core/browser/download_database.h" | 14 #include "components/history/core/browser/download_database.h" |
15 #include "components/history/core/browser/history_types.h" | 15 #include "components/history/core/browser/history_types.h" |
16 #include "components/history/core/browser/url_database.h" | 16 #include "components/history/core/browser/url_database.h" |
17 #include "components/history/core/browser/visit_database.h" | 17 #include "components/history/core/browser/visit_database.h" |
18 #include "components/history/core/browser/visitsegment_database.h" | 18 #include "components/history/core/browser/visitsegment_database.h" |
| 19 #include "components/memory_coordinator/common/memory_coordinator_client.h" |
19 #include "sql/connection.h" | 20 #include "sql/connection.h" |
20 #include "sql/init_status.h" | 21 #include "sql/init_status.h" |
21 #include "sql/meta_table.h" | 22 #include "sql/meta_table.h" |
22 | 23 |
23 #if defined(OS_ANDROID) | 24 #if defined(OS_ANDROID) |
24 #include "components/history/core/browser/android/android_cache_database.h" | 25 #include "components/history/core/browser/android/android_cache_database.h" |
25 #include "components/history/core/browser/android/android_urls_database.h" | 26 #include "components/history/core/browser/android/android_urls_database.h" |
26 #endif | 27 #endif |
27 | 28 |
28 namespace base { | 29 namespace base { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 bool RecreateAllTablesButURL(); | 136 bool RecreateAllTablesButURL(); |
136 | 137 |
137 // Vacuums the database. This will cause sqlite to defragment and collect | 138 // Vacuums the database. This will cause sqlite to defragment and collect |
138 // unused space in the file. It can be VERY SLOW. | 139 // unused space in the file. It can be VERY SLOW. |
139 void Vacuum(); | 140 void Vacuum(); |
140 | 141 |
141 // Try to trim the cache memory used by the database. If |aggressively| is | 142 // Try to trim the cache memory used by the database. If |aggressively| is |
142 // true try to trim all unused cache, otherwise trim by half. | 143 // true try to trim all unused cache, otherwise trim by half. |
143 void TrimMemory(bool aggressively); | 144 void TrimMemory(bool aggressively); |
144 | 145 |
| 146 // Adjusts the cache memory used by the database. |
| 147 void AdjustCacheMemory(memory_coordinator::MemoryState state); |
| 148 |
145 // Razes the database. Returns true if successful. | 149 // Razes the database. Returns true if successful. |
146 bool Raze(); | 150 bool Raze(); |
147 | 151 |
148 std::string GetDiagnosticInfo(int extended_error, sql::Statement* statement); | 152 std::string GetDiagnosticInfo(int extended_error, sql::Statement* statement); |
149 | 153 |
150 // Visit table functions ---------------------------------------------------- | 154 // Visit table functions ---------------------------------------------------- |
151 | 155 |
152 // Update the segment id of a visit. Return true on success. | 156 // Update the segment id of a visit. Return true on success. |
153 bool SetSegmentID(VisitID visit_id, SegmentID segment_id); | 157 bool SetSegmentID(VisitID visit_id, SegmentID segment_id); |
154 | 158 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 sql::MetaTable meta_table_; | 200 sql::MetaTable meta_table_; |
197 | 201 |
198 base::Time cached_early_expiration_threshold_; | 202 base::Time cached_early_expiration_threshold_; |
199 | 203 |
200 DISALLOW_COPY_AND_ASSIGN(HistoryDatabase); | 204 DISALLOW_COPY_AND_ASSIGN(HistoryDatabase); |
201 }; | 205 }; |
202 | 206 |
203 } // namespace history | 207 } // namespace history |
204 | 208 |
205 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_DATABASE_H_ | 209 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_DATABASE_H_ |
OLD | NEW |