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

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

Issue 2443093002: memory coordinator: Observe renderer visibility to update state (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | content/browser/memory/memory_coordinator_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/memory/memory_coordinator_impl.h
diff --git a/content/browser/memory/memory_coordinator_impl.h b/content/browser/memory/memory_coordinator_impl.h
index 6d975b389f5a48be439fc8dec6f70dbb0d7c70b4..3f119f65958c79bd03f249c8908b208c097e20ff 100644
--- a/content/browser/memory/memory_coordinator_impl.h
+++ b/content/browser/memory/memory_coordinator_impl.h
@@ -12,6 +12,8 @@
#include "base/threading/non_thread_safe.h"
#include "base/time/time.h"
#include "content/browser/memory/memory_coordinator.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
namespace content {
@@ -35,6 +37,7 @@ struct MemoryCoordinatorSingletonTraits;
// back to a relaxed state. (e.g. THROTTLED -> NORMAL)
// * Once a state is changed, it remains the same for a certain period of time.
class CONTENT_EXPORT MemoryCoordinatorImpl : public MemoryCoordinator,
+ public NotificationObserver,
public base::NonThreadSafe {
public:
MemoryCoordinatorImpl(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
@@ -49,6 +52,11 @@ class CONTENT_EXPORT MemoryCoordinatorImpl : public MemoryCoordinator,
base::MemoryState GetCurrentMemoryState() const override;
+ // NotificationObserver implementation:
+ void Observe(int type,
+ const NotificationSource& source,
+ const NotificationDetails& details) override;
+
private:
FRIEND_TEST_ALL_PREFIXES(MemoryCoordinatorImplTest, CalculateNextState);
FRIEND_TEST_ALL_PREFIXES(MemoryCoordinatorImplTest, UpdateState);
@@ -76,6 +84,7 @@ class CONTENT_EXPORT MemoryCoordinatorImpl : public MemoryCoordinator,
void ScheduleUpdateState(base::TimeDelta delay);
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ NotificationRegistrar notification_registrar_;
std::unique_ptr<MemoryMonitor> memory_monitor_;
base::Closure update_state_callback_;
base::MemoryState current_state_ = MemoryState::NORMAL;
« no previous file with comments | « no previous file | content/browser/memory/memory_coordinator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698