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

Unified Diff: athena/resource_manager/delegate/resource_manager_delegate.cc

Issue 863033002: Delete athena/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « athena/resource_manager/OWNERS ('k') | athena/resource_manager/memory_pressure_notifier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/resource_manager/delegate/resource_manager_delegate.cc
diff --git a/athena/resource_manager/delegate/resource_manager_delegate.cc b/athena/resource_manager/delegate/resource_manager_delegate.cc
deleted file mode 100644
index ee15b18f5dfa9f3801dbd00c6d4233089e208df0..0000000000000000000000000000000000000000
--- a/athena/resource_manager/delegate/resource_manager_delegate.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "athena/resource_manager/public/resource_manager_delegate.h"
-
-#include <string>
-
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/process/process_metrics.h"
-
-namespace athena {
-
-namespace {
-// This is the minimum amount of time in milliseconds between checks for
-// memory pressure.
-const int kMemoryPressureIntervalMs = 750;
-} // namespace
-
-class ResourceManagerDelegateImpl : public ResourceManagerDelegate {
- public:
- ResourceManagerDelegateImpl() {}
- ~ResourceManagerDelegateImpl() override {}
-
- private:
- int GetUsedMemoryInPercent() override {
- base::SystemMemoryInfoKB info;
- if (!base::GetSystemMemoryInfo(&info)) {
- LOG(WARNING) << "Cannot determine the free memory of the system.";
- return 0;
- }
- // TODO(skuhne): Instead of adding the kernel memory pressure calculation
- // logic here, we should have a kernel mechanism similar to the low memory
- // notifier in ChromeOS which offers multiple pressure states.
- // To track this, we have crbug.com/381196.
-
- // The available memory consists of "real" and virtual (z)ram memory.
- // Since swappable memory uses a non pre-deterministic compression and
- // the compression creates its own "dynamic" in the system, it gets
- // de-emphasized by the |kSwapWeight| factor.
- const int kSwapWeight = 4;
-
- // The total memory we have is the "real memory" plus the virtual (z)ram.
- int total_memory = info.total + info.swap_total / kSwapWeight;
-
- // The kernel internally uses 50MB.
- const int kMinFileMemory = 50 * 1024;
-
- // Most file memory can be easily reclaimed.
- int file_memory = info.active_file + info.inactive_file;
- // unless it is dirty or it's a minimal portion which is required.
- file_memory -= info.dirty + kMinFileMemory;
-
- // Available memory is the sum of free, swap and easy reclaimable memory.
- int available_memory =
- info.free + info.swap_free / kSwapWeight + file_memory;
-
- DCHECK(available_memory < total_memory);
- int percentage = ((total_memory - available_memory) * 100) / total_memory;
- return percentage;
- }
-
- int MemoryPressureIntervalInMS() override {
- return kMemoryPressureIntervalMs;
- }
- DISALLOW_COPY_AND_ASSIGN(ResourceManagerDelegateImpl);
-};
-
-// static
-ResourceManagerDelegate*
-ResourceManagerDelegate::CreateResourceManagerDelegate() {
- return new ResourceManagerDelegateImpl;
-}
-
-} // namespace athena
« no previous file with comments | « athena/resource_manager/OWNERS ('k') | athena/resource_manager/memory_pressure_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698