blob: 77c608052045ca6a18a74c84e5f243ab93ca5a3f (
plain)
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
36
|
// 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.
#include "chrome/renderer/performance_manager/mechanisms/tcmalloc_tunables_impl.h"
#include "base/allocator/allocator_extension.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
namespace performance_manager {
namespace mechanism {
namespace {
constexpr char kMaxTotalThreadCacheBytesKey[] =
"tcmalloc.max_total_thread_cache_bytes";
} // namespace
TcmallocTunablesImpl::TcmallocTunablesImpl() = default;
TcmallocTunablesImpl::~TcmallocTunablesImpl() = default;
// Static
void TcmallocTunablesImpl::Create(
mojo::PendingReceiver<tcmalloc::mojom::TcmallocTunables> receiver) {
mojo::MakeSelfOwnedReceiver(std::make_unique<TcmallocTunablesImpl>(),
std::move(receiver));
}
void TcmallocTunablesImpl::SetMaxTotalThreadCacheBytes(uint32_t size_bytes) {
bool res = base::allocator::SetNumericProperty(kMaxTotalThreadCacheBytesKey,
size_bytes);
LOG_IF(ERROR, !res) << "Unable to SetNumericProperty("
<< kMaxTotalThreadCacheBytesKey << ") to " << size_bytes;
}
} // namespace mechanism
} // namespace performance_manager
|