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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ATHENA_RESOURCE_MANAGER_PUBLIC_RESOURCE_MANAGER_H_ 5 #ifndef ATHENA_RESOURCE_MANAGER_PUBLIC_RESOURCE_MANAGER_H_
6 #define ATHENA_RESOURCE_MANAGER_PUBLIC_RESOURCE_MANAGER_H_ 6 #define ATHENA_RESOURCE_MANAGER_PUBLIC_RESOURCE_MANAGER_H_
7 7
8 #include "athena/resource_manager/memory_pressure_notifier.h" 8 #include "athena/resource_manager/memory_pressure_notifier.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 10
(...skipping 13 matching lines...) Expand all
24 ResourceManager(); 24 ResourceManager();
25 virtual ~ResourceManager(); 25 virtual ~ResourceManager();
26 26
27 // Unit tests can simulate MemoryPressure changes with this call. 27 // Unit tests can simulate MemoryPressure changes with this call.
28 // Note: Even though the default unit test ResourceManagerDelegte 28 // Note: Even though the default unit test ResourceManagerDelegte
29 // implementation ensures that the MemoryPressure event will not go off, 29 // implementation ensures that the MemoryPressure event will not go off,
30 // this call will also explicitly stop the MemoryPressureNotifier. 30 // this call will also explicitly stop the MemoryPressureNotifier.
31 virtual void SetMemoryPressureAndStopMonitoring( 31 virtual void SetMemoryPressureAndStopMonitoring(
32 MemoryPressureObserver::MemoryPressure pressure) = 0; 32 MemoryPressureObserver::MemoryPressure pressure) = 0;
33 33
34 // 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.
35 // called before e.g. re-arranging the order of activities. Once called with
36 // |pause| == false any queued operations will be performed and the resource
37 // manager will continue its work.
38 virtual void Pause(bool pause) = 0;
39
34 private: 40 private:
35 DISALLOW_COPY_AND_ASSIGN(ResourceManager); 41 DISALLOW_COPY_AND_ASSIGN(ResourceManager);
36 }; 42 };
37 43
44 // Use this scoped object to pause/restart the resource manager.
45 class ScopedPauseResourceManager {
46 public:
47 ScopedPauseResourceManager() {
48 ResourceManager::Get()->Pause(true);
49 }
50 ~ScopedPauseResourceManager() {
51 ResourceManager::Get()->Pause(false);
52 }
53 private:
54 DISALLOW_COPY_AND_ASSIGN(ScopedPauseResourceManager);
55 };
56
38 } // namespace athena 57 } // namespace athena
39 58
40 #endif // ATHENA_RESOURCE_MANAGER_PUBLIC_RESOURCE_MANAGER_H_ 59 #endif // ATHENA_RESOURCE_MANAGER_PUBLIC_RESOURCE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698