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

Unified Diff: athena/resource_manager/public/resource_manager.h

Issue 536013002: Decoupling visibility states from webcontent, adding visibility management in ResourceManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a few more unittests Created 6 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 side-by-side diff with in-line comments
Download patch
Index: athena/resource_manager/public/resource_manager.h
diff --git a/athena/resource_manager/public/resource_manager.h b/athena/resource_manager/public/resource_manager.h
index be07b6e6f33986e926d971b6fb74bc7fb783b02d..8bc7a6077d7f9276e39a09e59d36d30a203937f6 100644
--- a/athena/resource_manager/public/resource_manager.h
+++ b/athena/resource_manager/public/resource_manager.h
@@ -31,10 +31,29 @@ class ResourceManager {
virtual void SetMemoryPressureAndStopMonitoring(
MemoryPressureObserver::MemoryPressure pressure) = 0;
+ // Disable the resource manager temporarily if |pause| is set. This can be
oshima 2014/09/04 16:39:23 "Disable" may be misleading. How about just say "P
Mr4D (OOO till 08-26) 2014/09/04 19:10:57 Done.
+ // called before e.g. re-arranging the order of activities. Once called with
+ // |pause| == false any queued operations will be performed and the resource
+ // manager will continue its work.
+ virtual void Pause(bool pause) = 0;
+
private:
DISALLOW_COPY_AND_ASSIGN(ResourceManager);
};
+// Use this scoped object to pause/restart the resource manager.
+class ScopedPauseResourceManager {
+ public:
+ ScopedPauseResourceManager() {
+ ResourceManager::Get()->Pause(true);
+ }
+ ~ScopedPauseResourceManager() {
+ ResourceManager::Get()->Pause(false);
+ }
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScopedPauseResourceManager);
+};
+
} // namespace athena
#endif // ATHENA_RESOURCE_MANAGER_PUBLIC_RESOURCE_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698