diff options
author | The Qt Project <gerrit-noreply@qt-project.org> | 2020-03-11 10:00:21 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2020-03-11 10:00:21 +0000 |
commit | 7dac0dcbe24b3fe53a575342b848eb2a127a199e (patch) | |
tree | 3a4a7d3590dfa31296b3b345f539eccc85295aa2 /chromium/chrome/renderer/performance_manager/mechanisms/tcmalloc_tunables_impl.cc | |
parent | 9ee7f2b72eff3ef35d50db0cb7fa268dcc46adbf (diff) | |
parent | 28db9b54de6402bd38770ecc1d620255e9d1e78f (diff) | |
download | qtwebengine-chromium-7dac0dcbe24b3fe53a575342b848eb2a127a199e.tar.gz |
Merge "Merge remote-tracking branch 'origin/upstream-master' into 79-based" into 79-based
Diffstat (limited to 'chromium/chrome/renderer/performance_manager/mechanisms/tcmalloc_tunables_impl.cc')
-rw-r--r-- | chromium/chrome/renderer/performance_manager/mechanisms/tcmalloc_tunables_impl.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/chromium/chrome/renderer/performance_manager/mechanisms/tcmalloc_tunables_impl.cc b/chromium/chrome/renderer/performance_manager/mechanisms/tcmalloc_tunables_impl.cc new file mode 100644 index 00000000000..77c60805204 --- /dev/null +++ b/chromium/chrome/renderer/performance_manager/mechanisms/tcmalloc_tunables_impl.cc @@ -0,0 +1,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 |