summaryrefslogtreecommitdiff
path: root/base/trace_event/heap_profiler_allocation_register_posix.cc
diff options
context:
space:
mode:
authorHidehiko Abe <hidehiko@google.com>2018-05-28 22:10:54 +0900
committerHidehiko Abe <hidehiko@google.com>2018-06-01 16:37:08 +0900
commitad62a8245af1d123a106c870203a777260d231f8 (patch)
tree3c20b00d2e41637aceb9bd58acc79a0ec787922a /base/trace_event/heap_profiler_allocation_register_posix.cc
parent0c4351892b6ce29a34474b164d301cae78d6c0ac (diff)
downloadlibchrome-ad62a8245af1d123a106c870203a777260d231f8.tar.gz
trace_event is a feature to measure profiling. However, it won't be usable in standard library like libchrome, so remove it. For build compatibility, small stub and trace_event_common.h are kept. Bug: 80375012 Test: Built locally. Change-Id: Ie2a87d2fa0d3cdbd856044498d0dd2072da2e9ab
Diffstat (limited to 'base/trace_event/heap_profiler_allocation_register_posix.cc')
-rw-r--r--base/trace_event/heap_profiler_allocation_register_posix.cc58
1 files changed, 0 insertions, 58 deletions
diff --git a/base/trace_event/heap_profiler_allocation_register_posix.cc b/base/trace_event/heap_profiler_allocation_register_posix.cc
deleted file mode 100644
index 94eeb4df88..0000000000
--- a/base/trace_event/heap_profiler_allocation_register_posix.cc
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2015 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 "base/trace_event/heap_profiler_allocation_register.h"
-
-#include <stddef.h>
-#include <sys/mman.h>
-#include <unistd.h>
-
-#include "base/bits.h"
-#include "base/logging.h"
-#include "base/process/process_metrics.h"
-
-#ifndef MAP_ANONYMOUS
-#define MAP_ANONYMOUS MAP_ANON
-#endif
-
-namespace base {
-namespace trace_event {
-namespace internal {
-
-namespace {
-size_t GetGuardSize() {
- return GetPageSize();
-}
-}
-
-void* AllocateGuardedVirtualMemory(size_t size) {
- size = bits::Align(size, GetPageSize());
-
- // Add space for a guard page at the end.
- size_t map_size = size + GetGuardSize();
-
- void* addr = mmap(nullptr, map_size, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-
- PCHECK(addr != MAP_FAILED);
-
- // Mark the last page of the allocated address space as inaccessible
- // (PROT_NONE). The read/write accessible space is still at least |min_size|
- // bytes.
- void* guard_addr =
- reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(addr) + size);
- int result = mprotect(guard_addr, GetGuardSize(), PROT_NONE);
- PCHECK(result == 0);
-
- return addr;
-}
-
-void FreeGuardedVirtualMemory(void* address, size_t allocated_size) {
- size_t size = bits::Align(allocated_size, GetPageSize()) + GetGuardSize();
- munmap(address, size);
-}
-
-} // namespace internal
-} // namespace trace_event
-} // namespace base