1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29

ash / components / arc / test / fake_memory_instance.cc [blame]

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/components/arc/test/fake_memory_instance.h"

#include "ash/components/arc/mojom/memory.mojom-forward.h"
#include "ash/components/arc/mojom/memory.mojom-shared.h"

namespace arc {

FakeMemoryInstance::FakeMemoryInstance() = default;
FakeMemoryInstance::~FakeMemoryInstance() = default;

void FakeMemoryInstance::DropCaches(DropCachesCallback callback) {
  std::move(callback).Run(drop_caches_result_);
}

void FakeMemoryInstance::Reclaim(mojom::ReclaimRequestPtr request,
                                 ReclaimCallback callback) {
  if (request->type == mojom::ReclaimType::ANON) {
    std::move(callback).Run(mojom::ReclaimResult::New(
        reclaimed_anon_process_count_, unreclaimed_anon_process_count_));
  } else {
    std::move(callback).Run(mojom::ReclaimResult::New(
        reclaimed_all_process_count_, unreclaimed_all_process_count_));
  }
}
}  // namespace arc