| 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" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 void RollbackTransaction(); | 59 void RollbackTransaction(); |
| 60 | 60 |
| 61 // Vacuums the database. This will cause sqlite to defragment and collect | 61 // Vacuums the database. This will cause sqlite to defragment and collect |
| 62 // unused space in the file. It can be VERY SLOW. | 62 // unused space in the file. It can be VERY SLOW. |
| 63 void Vacuum(); | 63 void Vacuum(); |
| 64 | 64 |
| 65 // Try to trim the cache memory used by the database. If |aggressively| is | 65 // Try to trim the cache memory used by the database. If |aggressively| is |
| 66 // true try to trim all unused cache, otherwise trim by half. | 66 // true try to trim all unused cache, otherwise trim by half. |
| 67 void TrimMemory(bool aggressively); | 67 void TrimMemory(bool aggressively); |
| 68 | 68 |
| 69 // Get all on-demand favicon bitmaps that have been last requested prior to |
| 70 // |threshold|. |
| 71 std::map<favicon_base::FaviconID, IconMappingsForExpiry> |
| 72 GetOldOnDemandFavicons(base::Time threshold); |
| 73 |
| 69 // Favicon Bitmaps ----------------------------------------------------------- | 74 // Favicon Bitmaps ----------------------------------------------------------- |
| 70 | 75 |
| 71 // Returns true if there are favicon bitmaps for |icon_id|. If | 76 // Returns true if there are favicon bitmaps for |icon_id|. If |
| 72 // |bitmap_id_sizes| is non NULL, sets it to a list of the favicon bitmap ids | 77 // |bitmap_id_sizes| is non NULL, sets it to a list of the favicon bitmap ids |
| 73 // and their associated pixel sizes for the favicon with |icon_id|. | 78 // and their associated pixel sizes for the favicon with |icon_id|. |
| 74 // The list contains results for the bitmaps which are cached in the | 79 // The list contains results for the bitmaps which are cached in the |
| 75 // favicon_bitmaps table. The pixel sizes are a subset of the sizes in the | 80 // favicon_bitmaps table. The pixel sizes are a subset of the sizes in the |
| 76 // 'sizes' field of the favicons table for |icon_id|. | 81 // 'sizes' field of the favicons table for |icon_id|. |
| 77 bool GetFaviconBitmapIDSizes( | 82 bool GetFaviconBitmapIDSizes( |
| 78 favicon_base::FaviconID icon_id, | 83 favicon_base::FaviconID icon_id, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 198 |
| 194 // Adds a mapping between the given page_url and icon_id. | 199 // Adds a mapping between the given page_url and icon_id. |
| 195 // Returns the new mapping id if the adding succeeds, otherwise 0 is returned. | 200 // Returns the new mapping id if the adding succeeds, otherwise 0 is returned. |
| 196 IconMappingID AddIconMapping(const GURL& page_url, | 201 IconMappingID AddIconMapping(const GURL& page_url, |
| 197 favicon_base::FaviconID icon_id); | 202 favicon_base::FaviconID icon_id); |
| 198 | 203 |
| 199 // Deletes the icon mapping entries for the given page url. | 204 // Deletes the icon mapping entries for the given page url. |
| 200 // Returns true if the deletion succeeded. | 205 // Returns true if the deletion succeeded. |
| 201 bool DeleteIconMappings(const GURL& page_url); | 206 bool DeleteIconMappings(const GURL& page_url); |
| 202 | 207 |
| 208 // Deletes the icon mapping entries for the given favicon ID. |
| 209 // Returns true if the deletion succeeded. |
| 210 bool DeleteIconMappingsForFaviconId(favicon_base::FaviconID id); |
| 211 |
| 203 // Deletes the icon mapping with |mapping_id|. | 212 // Deletes the icon mapping with |mapping_id|. |
| 204 // Returns true if the deletion succeeded. | 213 // Returns true if the deletion succeeded. |
| 205 bool DeleteIconMapping(IconMappingID mapping_id); | 214 bool DeleteIconMapping(IconMappingID mapping_id); |
| 206 | 215 |
| 207 // Checks whether a favicon is used by any URLs in the database. | 216 // Checks whether a favicon is used by any URLs in the database. |
| 208 bool HasMappingFor(favicon_base::FaviconID id); | 217 bool HasMappingFor(favicon_base::FaviconID id); |
| 209 | 218 |
| 210 // The class to enumerate icon mappings. Use InitIconMappingEnumerator to | 219 // The class to enumerate icon mappings. Use InitIconMappingEnumerator to |
| 211 // initialize. | 220 // initialize. |
| 212 class IconMappingEnumerator { | 221 class IconMappingEnumerator { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 286 |
| 278 sql::Connection db_; | 287 sql::Connection db_; |
| 279 sql::MetaTable meta_table_; | 288 sql::MetaTable meta_table_; |
| 280 | 289 |
| 281 HistoryBackendClient* backend_client_; | 290 HistoryBackendClient* backend_client_; |
| 282 }; | 291 }; |
| 283 | 292 |
| 284 } // namespace history | 293 } // namespace history |
| 285 | 294 |
| 286 #endif // COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ | 295 #endif // COMPONENTS_HISTORY_CORE_BROWSER_THUMBNAIL_DATABASE_H_ |
| OLD | NEW |