Chromium Code Reviews| 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 #include "athena/resource_manager/public/resource_manager_delegate.h" | 5 #include "athena/resource_manager/public/resource_manager_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/process/process_metrics.h" | 11 #include "base/process/process_metrics.h" |
| 12 | 12 |
| 13 namespace athena { | 13 namespace athena { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 // This is the minimum amount of time in milliseconds between checks for | 16 // This is the minimum amount of time in milliseconds between checks for |
| 17 // memory pressure. | 17 // memory pressure. |
| 18 const int kMemoryPressureIntervalMs = 750; | 18 const int kMemoryPressureIntervalMs = 750; |
| 19 } // namespace | 19 } // namespace |
| 20 | 20 |
| 21 class ResourceManagerDelegateImpl : public ResourceManagerDelegate { | 21 class ResourceManagerDelegateImpl : public ResourceManagerDelegate { |
| 22 public: | 22 public: |
| 23 ResourceManagerDelegateImpl() {} | 23 ResourceManagerDelegateImpl() {} |
| 24 virtual ~ResourceManagerDelegateImpl() {} | 24 virtual ~ResourceManagerDelegateImpl() {} |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 virtual int GetUsedMemoryInPercent() OVERRIDE { | 27 virtual int GetUsedMemoryInPercent() OVERRIDE { |
| 28 return 99; | |
|
sadrul
2014/09/12 16:30:14
?
Mr4D (OOO till 08-26)
2014/09/12 20:11:27
Good one. :) Done.
| |
| 28 base::SystemMemoryInfoKB info; | 29 base::SystemMemoryInfoKB info; |
| 29 if (!base::GetSystemMemoryInfo(&info)) { | 30 if (!base::GetSystemMemoryInfo(&info)) { |
| 30 LOG(WARNING) << "Cannot determine the free memory of the system."; | 31 LOG(WARNING) << "Cannot determine the free memory of the system."; |
| 31 return 0; | 32 return 0; |
| 32 } | 33 } |
| 33 // TODO(skuhne): Instead of adding the kernel memory pressure calculation | 34 // TODO(skuhne): Instead of adding the kernel memory pressure calculation |
| 34 // logic here, we should have a kernel mechanism similar to the low memory | 35 // logic here, we should have a kernel mechanism similar to the low memory |
| 35 // notifier in ChromeOS which offers multiple pressure states. | 36 // notifier in ChromeOS which offers multiple pressure states. |
| 36 // To track this, we have crbug.com/381196. | 37 // To track this, we have crbug.com/381196. |
| 37 | 38 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 67 DISALLOW_COPY_AND_ASSIGN(ResourceManagerDelegateImpl); | 68 DISALLOW_COPY_AND_ASSIGN(ResourceManagerDelegateImpl); |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 // static | 71 // static |
| 71 ResourceManagerDelegate* | 72 ResourceManagerDelegate* |
| 72 ResourceManagerDelegate::CreateResourceManagerDelegate() { | 73 ResourceManagerDelegate::CreateResourceManagerDelegate() { |
| 73 return new ResourceManagerDelegateImpl; | 74 return new ResourceManagerDelegateImpl; |
| 74 } | 75 } |
| 75 | 76 |
| 76 } // namespace athena | 77 } // namespace athena |
| OLD | NEW |