#include <fcntl.h>
#include <stdint.h>
#include <sys/mman.h>
#include <memory>
#include "base/files/scoped_file.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/madv_free_discardable_memory_allocator_posix.h"
#include "base/memory/madv_free_discardable_memory_posix.h"
#include "base/memory/page_size.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#define SUCCEED_IF_MADV_FREE_UNSUPPORTED() …
namespace base {
std::atomic<size_t> allocator_byte_count;
class MadvFreeDiscardableMemoryPosixTester
: public MadvFreeDiscardableMemoryPosix { … };
class MadvFreeDiscardableMemoryTest : public ::testing::Test { … };
MadvFreeDiscardableMemoryDeathTest;
constexpr char kTestPattern[] = …;
TEST_F(MadvFreeDiscardableMemoryTest, AllocateAndUse) { … }
TEST_F(MadvFreeDiscardableMemoryTest, LockAndUnlock) { … }
TEST_F(MadvFreeDiscardableMemoryTest, LockShouldFailAfterDiscard) { … }
}