Commit 59587b94 authored by Jeremy Roman's avatar Jeremy Roman Committed by Commit Bot

Remove wtf/process_metrics.h.

Whitelist the one place which wants to query malloc usage, which is a
memory reduction histogram on Android.

Change-Id: I03a821aeec7b3b0524b02b432d2cea196b7a1f83
Reviewed-on: https://chromium-review.googlesource.com/1117634Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571098}
parent ccd4ec08
include_rules = [
"+base/memory/scoped_refptr.h",
"+base/process/process_metrics.h",
"+gin/public",
"+services/network/public/mojom/fetch_api.mojom-blink.h",
"+third_party/blink/renderer/bindings",
......
......@@ -30,27 +30,31 @@
#include "third_party/blink/renderer/bindings/core/v8/v8_gc_for_context_dispose.h"
#include "base/process/process_metrics.h"
#include "build/build_config.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h"
#include "third_party/blink/renderer/platform/histogram.h"
#include "third_party/blink/renderer/platform/memory_coordinator.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/wtf/process_metrics.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
#include "third_party/blink/renderer/platform/wtf/time.h"
#include "v8/include/v8.h"
size_t GetMemoryUsage() {
size_t usage = WTF::GetMallocUsage() + WTF::Partitions::TotalActiveBytes() +
blink::ProcessHeap::TotalAllocatedObjectSize() +
blink::ProcessHeap::TotalMarkedObjectSize();
#if defined(OS_ANDROID)
static size_t GetMemoryUsage() {
size_t usage =
base::ProcessMetrics::CreateCurrentProcessMetrics()->GetMallocUsage() +
WTF::Partitions::TotalActiveBytes() +
blink::ProcessHeap::TotalAllocatedObjectSize() +
blink::ProcessHeap::TotalMarkedObjectSize();
v8::HeapStatistics v8_heap_statistics;
blink::V8PerIsolateData::MainThreadIsolate()->GetHeapStatistics(
&v8_heap_statistics);
usage = v8_heap_statistics.total_heap_size();
return usage;
}
#endif // defined(OS_ANDROID)
namespace blink {
......
......@@ -112,7 +112,6 @@ jumbo_component("wtf") {
"math_extras.h",
"noncopyable.h",
"not_found.h",
"process_metrics.h",
"ref_counted.h",
"ref_vector.h",
"retain_ptr.h",
......
// Copyright (c) 2017 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 THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_PROCESS_METRICS_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_PROCESS_METRICS_H_
#include "base/process/process_metrics.h"
namespace WTF {
size_t GetMallocUsage() {
std::unique_ptr<base::ProcessMetrics> metric(
base::ProcessMetrics::CreateCurrentProcessMetrics());
return metric->GetMallocUsage();
}
} // namespace WTF
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_PROCESS_METRICS_H_
......@@ -236,6 +236,13 @@ _CONFIG = [
'paths': ['third_party/blink/renderer/bindings/'],
'allowed': ['gin::.+'],
},
{
'paths': ['third_party/blink/renderer/bindings/core/v8/v8_gc_for_context_dispose.cc'],
'allowed': [
# For memory reduction histogram.
'base::ProcessMetrics',
],
},
{
'paths': ['third_party/blink/renderer/core/clipboard'],
'allowed': ['gfx::PNGCodec'],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment