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

Unified Diff: components/history/core/browser/history_backend.h

Issue 2261073002: Make HistoryBackend a client of memory coordinator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: singleton Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/history/core/browser/history_backend.h
diff --git a/components/history/core/browser/history_backend.h b/components/history/core/browser/history_backend.h
index aeecc96ab01663b118f0bcafaa8501c00f830d13..64c2b62c9ec1530251dad47710acc1763c947fdb 100644
--- a/components/history/core/browser/history_backend.h
+++ b/components/history/core/browser/history_backend.h
@@ -32,6 +32,7 @@
#include "components/history/core/browser/keyword_id.h"
#include "components/history/core/browser/thumbnail_database.h"
#include "components/history/core/browser/visit_tracker.h"
+#include "components/memory_coordinator/common/memory_coordinator_client.h"
#include "sql/init_status.h"
class HistoryURLProvider;
@@ -102,7 +103,8 @@ class QueuedHistoryDBTask {
// functions in the history service. These functions are not documented
// here, see the history service for behavior.
class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
- public HistoryBackendNotifier {
+ public HistoryBackendNotifier,
+ public memory_coordinator::MemoryCoordinatorClient {
public:
// Interface implemented by the owner of the HistoryBackend object. Normally,
// the history service implements this to send stuff back to the main thread.
@@ -478,6 +480,9 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
base::Time GetFirstRecordedTimeForTest() { return first_recorded_time_; }
+ // memory_coordinator::MemoryCoordinatorClient implementation:
+ void OnMemoryStateChange(memory_coordinator::MemoryState state) override;
+
protected:
~HistoryBackend() override;
@@ -579,6 +584,9 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
// Does the work of Init.
void InitImpl(const HistoryDatabaseParams& history_database_params);
+ // Asks database to trim memory.
+ void TrimMemory(bool trim_aggressively);
+
// Called when the system is under memory pressure.
void OnMemoryPressure(
base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);

Powered by Google App Engine
This is Rietveld 408576698