forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
memory.h
35 lines (25 loc) · 1.25 KB
/
memory.h
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
30
31
32
33
34
35
// Copyright 2019 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.
#ifndef CHROMEOS_MEMORY_MEMORY_H_
#define CHROMEOS_MEMORY_MEMORY_H_
#include <cstddef>
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "chromeos/chromeos_export.h"
namespace chromeos {
// MlockMaping will attempt to mlock a mapping using the newer mlock2 syscall
// if available using the MLOCK_ONFAULT option. This will allow pages to be
// locked as they are faulted in. If the running kernel does not support
// mlock2, it was added in kernel 4.4, it will fall back to mlock where it
// will lock all pages immediately by faulting them in.
CHROMEOS_EXPORT bool MlockMapping(void* addr, size_t length);
// A feature which controls the locking the main program text.
extern const base::Feature kCrOSLockMainProgramText;
// The maximum number of bytes that the browser will attempt to lock, -1 will
// disable the max size and is the default option.
extern const base::FeatureParam<int> kCrOSLockMainProgramTextMaxSize;
// Lock main program text segments fully.
CHROMEOS_EXPORT void LockMainProgramText();
} // namespace chromeos
#endif // CHROMEOS_MEMORY_MEMORY_H_