| OLD | NEW |
| 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/athena_export.h" |
| 8 #include "athena/resource_manager/memory_pressure_notifier.h" | 9 #include "athena/resource_manager/memory_pressure_notifier.h" |
| 9 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 10 | 11 |
| 11 namespace athena { | 12 namespace athena { |
| 12 | 13 |
| 13 // The resource manager is monitoring activity changes, low memory conditions | 14 // The resource manager is monitoring activity changes, low memory conditions |
| 14 // and other events to control the activity state (pre-/un-/re-/loading them) | 15 // and other events to control the activity state (pre-/un-/re-/loading them) |
| 15 // to keep enough memory free that no jank/lag will show when new applications | 16 // to keep enough memory free that no jank/lag will show when new applications |
| 16 // are loaded and / or a navigation between applications takes place. | 17 // are loaded and / or a navigation between applications takes place. |
| 17 class ResourceManager { | 18 class ATHENA_EXPORT ResourceManager { |
| 18 public: | 19 public: |
| 19 // Creates the instance handling the resources. | 20 // Creates the instance handling the resources. |
| 20 static void Create(); | 21 static void Create(); |
| 21 static ResourceManager* Get(); | 22 static ResourceManager* Get(); |
| 22 static void Shutdown(); | 23 static void Shutdown(); |
| 23 | 24 |
| 24 ResourceManager(); | 25 ResourceManager(); |
| 25 virtual ~ResourceManager(); | 26 virtual ~ResourceManager(); |
| 26 | 27 |
| 27 // Unit tests can simulate MemoryPressure changes with this call. | 28 // Unit tests can simulate MemoryPressure changes with this call. |
| 28 // Note: Even though the default unit test ResourceManagerDelegte | 29 // Note: Even though the default unit test ResourceManagerDelegte |
| 29 // implementation ensures that the MemoryPressure event will not go off, | 30 // implementation ensures that the MemoryPressure event will not go off, |
| 30 // this call will also explicitly stop the MemoryPressureNotifier. | 31 // this call will also explicitly stop the MemoryPressureNotifier. |
| 31 virtual void SetMemoryPressureAndStopMonitoring( | 32 virtual void SetMemoryPressureAndStopMonitoring( |
| 32 MemoryPressureObserver::MemoryPressure pressure) = 0; | 33 MemoryPressureObserver::MemoryPressure pressure) = 0; |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 DISALLOW_COPY_AND_ASSIGN(ResourceManager); | 36 DISALLOW_COPY_AND_ASSIGN(ResourceManager); |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 } // namespace athena | 39 } // namespace athena |
| 39 | 40 |
| 40 #endif // ATHENA_RESOURCE_MANAGER_PUBLIC_RESOURCE_MANAGER_H_ | 41 #endif // ATHENA_RESOURCE_MANAGER_PUBLIC_RESOURCE_MANAGER_H_ |
| OLD | NEW |