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 3978f7fa10905e34856897fbc3a8d682eff5391f..a639ff8187205847667ac3f53bf013ad9546ea81 100644 |
--- a/athena/resource_manager/public/resource_manager.h |
+++ b/athena/resource_manager/public/resource_manager.h |
@@ -32,10 +32,29 @@ class ATHENA_EXPORT ResourceManager { |
virtual void SetMemoryPressureAndStopMonitoring( |
MemoryPressureObserver::MemoryPressure pressure) = 0; |
+ // Suspend the resource manager temporarily if |pause| is set. This can be |
+ // 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_ |