Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: components/history/core/browser/history_backend.cc

Issue 2297243004: [WIP] histroy: Adjust cache size OnMemoryStateChange() (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/history/core/browser/history_database.h » ('j') | sql/connection.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "components/history/core/browser/history_backend.h" 5 #include "components/history/core/browser/history_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 NotifyURLsModified(changed_urls); 914 NotifyURLsModified(changed_urls);
915 ScheduleCommit(); 915 ScheduleCommit();
916 } 916 }
917 917
918 bool HistoryBackend::IsExpiredVisitTime(const base::Time& time) { 918 bool HistoryBackend::IsExpiredVisitTime(const base::Time& time) {
919 return time < expirer_.GetCurrentExpirationTime(); 919 return time < expirer_.GetCurrentExpirationTime();
920 } 920 }
921 921
922 void HistoryBackend::OnMemoryStateChange( 922 void HistoryBackend::OnMemoryStateChange(
923 memory_coordinator::MemoryState state) { 923 memory_coordinator::MemoryState state) {
924 bool trim_aggressively = state == memory_coordinator::MemoryState::SUSPENDED; 924 db_->AdjustCacheMemory(state);
925 TrimMemory(trim_aggressively); 925 // TODO(bashi): Adjust cache memory of |thumbnail_db_| as well.
926 } 926 }
927 927
928 void HistoryBackend::SetPageTitle(const GURL& url, 928 void HistoryBackend::SetPageTitle(const GURL& url,
929 const base::string16& title) { 929 const base::string16& title) {
930 if (!db_) 930 if (!db_)
931 return; 931 return;
932 932
933 // Search for recent redirects which should get the same title. We make a 933 // Search for recent redirects which should get the same title. We make a
934 // dummy list containing the exact URL visited if there are no redirects so 934 // dummy list containing the exact URL visited if there are no redirects so
935 // the processing below can be the same. 935 // the processing below can be the same.
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after
2657 // transaction is currently open. 2657 // transaction is currently open.
2658 db_->CommitTransaction(); 2658 db_->CommitTransaction();
2659 db_->Vacuum(); 2659 db_->Vacuum();
2660 db_->BeginTransaction(); 2660 db_->BeginTransaction();
2661 db_->GetStartDate(&first_recorded_time_); 2661 db_->GetStartDate(&first_recorded_time_);
2662 2662
2663 return true; 2663 return true;
2664 } 2664 }
2665 2665
2666 } // namespace history 2666 } // namespace history
OLDNEW
« no previous file with comments | « no previous file | components/history/core/browser/history_database.h » ('j') | sql/connection.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698