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

Unified Diff: content/browser/memory/memory_coordinator_impl.cc

Issue 2565323002: Stop using callbacks in MemoryCoordinatorProxy (Closed)
Patch Set: fix Created 4 years 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: content/browser/memory/memory_coordinator_impl.cc
diff --git a/content/browser/memory/memory_coordinator_impl.cc b/content/browser/memory/memory_coordinator_impl.cc
index ca18cbacdfd3ae581493db0f7d91263e27d95099..ed9871398c8c795e57d87cabac4aaa07f90c2895 100644
--- a/content/browser/memory/memory_coordinator_impl.cc
+++ b/content/browser/memory/memory_coordinator_impl.cc
@@ -192,7 +192,12 @@ base::MemoryState MemoryCoordinatorImpl::GetGlobalMemoryState() const {
return current_state_;
}
-base::MemoryState MemoryCoordinatorImpl::GetCurrentMemoryState() const {
+base::WeakPtr<base::MemoryCoordinatorInterface>
+MemoryCoordinatorImpl::GetWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
+}
+
+base::MemoryState MemoryCoordinatorImpl::GetLocalMemoryState() {
// SUSPENDED state may not make sense to the browser process. Use THROTTLED
// instead when the global state is SUSPENDED.
// TODO(bashi): Maybe worth considering another state for the browser.
@@ -200,7 +205,7 @@ base::MemoryState MemoryCoordinatorImpl::GetCurrentMemoryState() const {
: current_state_;
}
-void MemoryCoordinatorImpl::SetCurrentMemoryStateForTesting(
+void MemoryCoordinatorImpl::SetMemoryStateForTesting(
base::MemoryState memory_state) {
// This changes the current state temporariy for testing. The state will be
// updated 1 minute later.
@@ -301,7 +306,7 @@ void MemoryCoordinatorImpl::UpdateState() {
}
void MemoryCoordinatorImpl::NotifyStateToClients() {
- auto state = GetCurrentMemoryState();
+ auto state = GetLocalMemoryState();
base::MemoryCoordinatorClientRegistry::GetInstance()->Notify(state);
}

Powered by Google App Engine
This is Rietveld 408576698