Skip to content

Commit

Permalink
Create components/services/heap_profiling.
Browse files Browse the repository at this point in the history
This CL sets up the directory structure of components/services/heap_profiling
and moves in the profiling mojom files. It has no intended behavioral change.

This is in preparation for moving the rest of the heap profiling logic into
components/services/heap_profiling in order to support Android WebView.

Bug: 827545
Change-Id: I8409c2fc67d96b18ac148538da7f2a0f7a79b9dd
Reviewed-on: https://chromium-review.googlesource.com/990495
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547724}
  • Loading branch information
erikchen authored and Commit Bot committed Apr 3, 2018
1 parent 6cb8ff4 commit 0d4a601
Show file tree
Hide file tree
Showing 21 changed files with 56 additions and 29 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/chrome_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
#include "chrome/common/pepper_permission_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/prerender_url_loader_throttle.h"
#include "chrome/common/profiling/constants.mojom.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/renderer_configuration.mojom.h"
#include "chrome/common/secure_origin_whitelist.h"
Expand Down Expand Up @@ -182,6 +181,7 @@
#include "components/safe_browsing/db/database_manager.h"
#include "components/safe_browsing/features.h"
#include "components/safe_browsing/password_protection/password_protection_navigation_throttle.h"
#include "components/services/heap_profiling/public/mojom/constants.mojom.h"
#include "components/services/patch/public/interfaces/constants.mojom.h"
#include "components/services/unzip/public/interfaces/constants.mojom.h"
#include "components/signin/core/browser/profile_management_switches.h"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/profiling_host/profiling_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
#include "chrome/browser/tracing/crash_service_uploader.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/profiling/constants.mojom.h"
#include "chrome/common/profiling/memlog_sender_pipe.h"
#include "chrome/common/profiling/profiling_constants.h"
#include "components/services/heap_profiling/public/mojom/constants.mojom.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_child_process_host.h"
#include "content/public/browser/browser_child_process_host_iterator.h"
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/profiling_host/profiling_process_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#include "chrome/browser/profiling_host/background_profiling_triggers.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/profiling/profiling_client.h"
#include "chrome/common/profiling/profiling_client.mojom.h"
#include "chrome/common/profiling/profiling_service.mojom.h"
#include "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom.h"
#include "components/services/heap_profiling/public/mojom/heap_profiling_service.mojom.h"
#include "content/public/browser/browser_child_process_observer.h"
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/notification_observer.h"
Expand Down
14 changes: 1 addition & 13 deletions chrome/common/profiling/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static_library("profiling") {
]

public_deps = [
":interfaces",
"//components/services/heap_profiling/public:interfaces",
]
deps = [
"//base",
Expand All @@ -32,18 +32,6 @@ static_library("profiling") {
]
}

mojom("interfaces") {
sources = [
"constants.mojom",
"profiling_client.mojom",
"profiling_service.mojom",
]
deps = [
"//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
]
}

source_set("unit_tests") {
testonly = true
sources = [
Expand Down
1 change: 1 addition & 0 deletions chrome/common/profiling/DEPS
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include_rules = [
"+mojo/edk/embedder",
"+services/service_manager/public/cpp",
"+components/services/heap_profiling/public",
]
2 changes: 1 addition & 1 deletion chrome/common/profiling/memlog_allocator_shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "chrome/common/profiling/memlog_sender_pipe.h"
#include "chrome/common/profiling/memlog_stream.h"
#include "chrome/common/profiling/profiling_client.mojom.h"
#include "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom.h"

namespace profiling {

Expand Down
2 changes: 1 addition & 1 deletion chrome/common/profiling/profiling_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef CHROME_COMMON_PROFILING_PROFILING_CLIENT_H_
#define CHROME_COMMON_PROFILING_PROFILING_CLIENT_H_

#include "chrome/common/profiling/profiling_client.mojom.h"
#include "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/system/handle.h"

Expand Down
1 change: 1 addition & 0 deletions chrome/profiling/DEPS
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include_rules = [
"+components/services/heap_profiling/public",
"+content/public/child",
"+mojo/edk/embedder",
"+services/resource_coordinator/public",
Expand Down
2 changes: 1 addition & 1 deletion chrome/profiling/json_exporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

#include "base/values.h"
#include "chrome/common/profiling/memlog_stream.h"
#include "chrome/common/profiling/profiling_service.mojom.h"
#include "chrome/profiling/allocation_event.h"
#include "components/services/heap_profiling/public/mojom/heap_profiling_service.mojom.h"
#include "services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom.h"

namespace profiling {
Expand Down
2 changes: 1 addition & 1 deletion chrome/profiling/memlog_connection_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#include "base/threading/thread.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/common/profiling/profiling_service.mojom.h"
#include "chrome/profiling/allocation_event.h"
#include "chrome/profiling/allocation_tracker.h"
#include "chrome/profiling/backtrace_storage.h"
#include "components/services/heap_profiling/public/mojom/heap_profiling_service.mojom.h"
#include "mojo/edk/embedder/scoped_platform_handle.h"
#include "services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom.h"

Expand Down
2 changes: 1 addition & 1 deletion chrome/profiling/profiling_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#define CHROME_PROFILING_PROFILING_SERVICE_H_

#include "base/memory/weak_ptr.h"
#include "chrome/common/profiling/profiling_service.mojom.h"
#include "chrome/profiling/memlog_connection_manager.h"
#include "components/services/heap_profiling/public/mojom/heap_profiling_service.mojom.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom.h"
#include "services/service_manager/public/cpp/binder_registry.h"
Expand Down
1 change: 1 addition & 0 deletions chrome/utility/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ include_rules = [
"+chrome/services/wifi_util_win/wifi_util_win_service.h",
"+chrome/services/wifi_util_win/public/mojom",
"+components/crash/core/common/crash_keys.h",
"+components/services/heap_profiling/public",
"+components/services/font/font_service_app.h",
"+components/services/patch",
"+components/payments/content/utility",
Expand Down
2 changes: 1 addition & 1 deletion chrome/utility/chrome_content_utility_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/profiling/constants.mojom.h"
#include "chrome/profiling/profiling_service.h"
#include "components/services/heap_profiling/public/mojom/constants.mojom.h"
#include "components/services/patch/patch_service.h"
#include "components/services/patch/public/interfaces/constants.mojom.h"
#include "components/services/unzip/public/interfaces/constants.mojom.h"
Expand Down
1 change: 1 addition & 0 deletions components/services/heap_profiling/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
erikchen@chromium.org
18 changes: 18 additions & 0 deletions components/services/heap_profiling/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
The heap profiling service provides:
* Storage for recording metadata about heap allocations and deallocations,
for any number of clients.
* A lightweight, synchronous API for clients to send metadata about heap
allocations and deallocations.

There are two main entities:
* Heap Profiling Clients send heap allocation data to the Heap Profiling
Service. Clients require no special privileges. There should be at most 1
Client per process, since heap hooks are instantiated on a per-process
basis.
* The Heap Profiling Service runs in an unprivileged, sandboxed process. It's
sole purpose is to record allocations and serve them in heap dumps.

Heap dumps are emitted in traces with the "memory-infra" category enabled. This
is coordinated by the (memory_instrumentation
service)[https://cs.chromium.org/chromium/src/services/resource_coordinator/public/mojom/memory_instrumentation/memory_instrumentation.mojom].
See the HeapProfiler and HeapProfilerHelper interfaces.
17 changes: 17 additions & 0 deletions components/services/heap_profiling/public/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2018 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.

import("//mojo/public/tools/bindings/mojom.gni")

mojom("interfaces") {
sources = [
"mojom/constants.mojom",
"mojom/heap_profiling_client.mojom",
"mojom/heap_profiling_service.mojom",
]
deps = [
"//mojo/common:common_custom_types",
"//mojo/public/mojom/base",
]
}
2 changes: 2 additions & 0 deletions components/services/heap_profiling/public/mojom/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module profiling.mojom;

import "chrome/common/profiling/profiling_client.mojom";
import "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom";
import "mojo/public/mojom/base/process_id.mojom";
import "mojo/common/values.mojom";

Expand All @@ -31,10 +31,8 @@ interface ProfilingService {
//
// |stack_mode| refers to the type of stacks that the client should record for
// allocations.
AddProfilingClient(mojo_base.mojom.ProcessId pid,
ProfilingClient client,
handle memlog_pipe_receiver,
ProcessType process_type,
AddProfilingClient(mojo_base.mojom.ProcessId pid, ProfilingClient client,
handle memlog_pipe_receiver, ProcessType process_type,
ProfilingParams params);

// |keep_small_allocations| controls whether small allocations are emitted in
Expand Down
2 changes: 1 addition & 1 deletion services/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Individual services are structured like so:
//services/foo/ <-- Implementation code, may have subdirs.
/public/
/cpp/ <-- C++ client libraries (optional)
/interfaces/ <-- Mojom interfaces
/mojom/ <-- Mojom interfaces
```

## Dependencies
Expand Down

0 comments on commit 0d4a601

Please sign in to comment.