| Index: components/history/core/browser/history_database.cc
|
| diff --git a/components/history/core/browser/history_database.cc b/components/history/core/browser/history_database.cc
|
| index 260f0578f4dd3c88c251afa021cb29852df38efb..2a383b8b2579cf6096bb5756b9e7e22aafc681b2 100644
|
| --- a/components/history/core/browser/history_database.cc
|
| +++ b/components/history/core/browser/history_database.cc
|
| @@ -40,6 +40,7 @@ const int kCurrentVersionNumber = 32;
|
| const int kCompatibleVersionNumber = 16;
|
| const char kEarlyExpirationThresholdKey[] = "early_expiration_threshold";
|
| const int kMaxHostsInMemory = 10000;
|
| +const int kDefaultCacheSize = 1000;
|
|
|
| } // namespace
|
|
|
| @@ -66,7 +67,7 @@ sql::InitStatus HistoryDatabase::Init(const base::FilePath& history_name) {
|
| // value, tells us how much memory the cache will use maximum.
|
| // 1000 * 4kB = 4MB
|
| // TODO(brettw) scale this value to the amount of available memory.
|
| - db_.set_cache_size(1000);
|
| + db_.set_cache_size(kDefaultCacheSize);
|
|
|
| // Note that we don't set exclusive locking here. That's done by
|
| // BeginExclusiveMode below which is called later (we have to be in shared
|
| @@ -295,6 +296,16 @@ void HistoryDatabase::TrimMemory(bool aggressively) {
|
| db_.TrimMemory(aggressively);
|
| }
|
|
|
| +void HistoryDatabase::AdjustCacheMemory(memory_coordinator::MemoryState state) {
|
| + int cache_size = kDefaultCacheSize;
|
| + if (state == memory_coordinator::MemoryState::THROTTLED) {
|
| + cache_size = cache_size / 2;
|
| + } else if (state == memory_coordinator::MemoryState::SUSPENDED) {
|
| + cache_size = cache_size / 4;
|
| + }
|
| + db_.UpdateCacheSize(cache_size);
|
| +}
|
| +
|
| bool HistoryDatabase::Raze() {
|
| return db_.Raze();
|
| }
|
|
|