Skip to content

Commit

Permalink
Move code from chrome/profiling to components/services/heap_profiling
Browse files Browse the repository at this point in the history
This CL has no intended behavior change.

In addition to moving the code, this CL:
  * Updates the names of classes/files to remove the Memlog prefix.
  * Updates the name of the service to be "Heap Profiling Service" from
    "Profiling Service".
  * profiling_browsertest was removed as it wasn't testing anything useful.
    There is a large suite of end-to-end browser tests in memlog_browsertest.cc
    [untouched by this CL].

Bug: 827545
Change-Id: I7ef0947d7de4070d1863c509e2d280cefd4fec2d
Reviewed-on: https://chromium-review.googlesource.com/995641
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Cait Phillips <caitkp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548510}
  • Loading branch information
erikchen authored and Commit Bot committed Apr 5, 2018
1 parent 7176aed commit fa983fa
Show file tree
Hide file tree
Showing 47 changed files with 326 additions and 439 deletions.
4 changes: 2 additions & 2 deletions chrome/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1492,9 +1492,9 @@ group("child_dependencies") {
"//chrome/child",
"//chrome/common",
"//chrome/gpu",
"//chrome/profiling",
"//chrome/renderer",
"//chrome/utility",
"//components/services/heap_profiling",
"//components/sync",
"//content/public/child",
"//pdf",
Expand Down Expand Up @@ -1820,10 +1820,10 @@ if (is_android) {
"//chrome/child",
"//chrome/common",
"//chrome/gpu",
"//chrome/profiling",
"//chrome/renderer",
"//chrome/utility",
"//components/safe_browsing/android:safe_browsing_mobile",
"//components/services/heap_profiling",
"//content/public/app:both",
"//content/public/common:service_names",
"//services/service_manager/embedder",
Expand Down
2 changes: 1 addition & 1 deletion chrome/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ static_library("test_support") {

chrome_packaged_services = [
":chrome_manifest",
"//chrome/profiling:manifest",
"//components/services/heap_profiling:manifest",
"//components/services/patch:manifest",
"//components/services/unzip:manifest",
"//chrome/services/file_util:manifest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"patch": [ "patch_file" ],
"pdf_compositor": [ "compositor" ],
"profile_import": [ "import" ],
"profiling": [ "profiling", "heap_profiler" ],
"heap_profiling": [ "profiling", "heap_profiler" ],
"proxy_resolver": [ "factory" ],
"preferences": [ "pref_client", "pref_control" ],
"removable_storage_writer": [ "removable_storage_writer" ],
Expand Down
5 changes: 0 additions & 5 deletions chrome/profiling/OWNERS

This file was deleted.

58 changes: 0 additions & 58 deletions chrome/profiling/README.md

This file was deleted.

39 changes: 0 additions & 39 deletions chrome/profiling/profiling_browsertest.cc

This file was deleted.

2 changes: 0 additions & 2 deletions chrome/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,6 @@ test("browser_tests") {
"../common/mac/mock_launchd.cc",
"../common/mac/mock_launchd.h",
"../common/time_format_browsertest.cc",
"../profiling/profiling_browsertest.cc",
"../renderer/autofill/autofill_renderer_browsertest.cc",
"../renderer/autofill/fake_content_password_manager_driver.cc",
"../renderer/autofill/fake_content_password_manager_driver.h",
Expand Down Expand Up @@ -2714,7 +2713,6 @@ test("unit_tests") {
"//chrome:strings",
"//chrome/browser/media/router:test_support",
"//chrome/common:test_support",
"//chrome/profiling:unit_tests",
"//components/autofill/content/renderer:test_support",
"//components/browser_sync:test_support",
"//components/component_updater:test_support",
Expand Down
2 changes: 1 addition & 1 deletion chrome/utility/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ static_library("utility") {
"//chrome:strings",
"//chrome/common",
"//chrome/common:mojo_bindings",
"//chrome/profiling",
"//components/search_engines",
"//components/services/heap_profiling",
"//components/services/heap_profiling/public/cpp",
"//components/services/patch:lib",
"//components/services/unzip:lib",
Expand Down
2 changes: 1 addition & 1 deletion chrome/utility/DEPS
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
include_rules = [
"+chrome/grit",
"+chrome/installer/util",
"+chrome/profiling",
"+chrome/services/file_util/file_util_service.h",
"+chrome/services/file_util/public/mojom",
"+chrome/services/media_gallery_util/media_gallery_util_service.h",
Expand All @@ -18,6 +17,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/heap_profiling_service.h",
"+components/services/heap_profiling/public",
"+components/services/font/font_service_app.h",
"+components/services/patch",
Expand Down
4 changes: 2 additions & 2 deletions chrome/utility/chrome_content_utility_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "chrome/common/buildflags.h"
#include "chrome/profiling/profiling_service.h"
#include "components/services/heap_profiling/heap_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"
Expand Down Expand Up @@ -193,7 +193,7 @@ void ChromeContentUtilityClient::RegisterServices(
service_manager::EmbeddedServiceInfo profiling_info;
profiling_info.task_runner = content::ChildThread::Get()->GetIOTaskRunner();
profiling_info.factory =
base::Bind(&profiling::ProfilingService::CreateService);
base::Bind(&profiling::HeapProfilingService::CreateService);
services->emplace(profiling::mojom::kServiceName, profiling_info);

#if !defined(OS_ANDROID)
Expand Down
1 change: 1 addition & 0 deletions components/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ test("components_unittests") {
"//components/safe_browsing/password_protection:password_protection_unittest",
"//components/safe_browsing/triggers:unit_tests",
"//components/security_state/content:unit_tests",
"//components/services/heap_profiling:unit_tests",
"//components/spellcheck/browser:unit_tests",
"//components/spellcheck/renderer:unit_tests",
"//components/subresource_filter/content/browser:unit_tests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//chrome/common/features.gni")
import("//services/service_manager/public/cpp/service.gni")
import("//services/service_manager/public/service_manifest.gni")
import("//testing/libfuzzer/fuzzer_test.gni")

static_library("profiling") {
static_library("heap_profiling") {
sources = [
"address.h",
"allocation_event.cc",
Expand All @@ -17,28 +17,27 @@ static_library("profiling") {
"backtrace.h",
"backtrace_storage.cc",
"backtrace_storage.h",
"connection_manager.cc",
"connection_manager.h",
"heap_profiling_service.cc",
"heap_profiling_service.h",
"json_exporter.cc",
"json_exporter.h",
"memlog_connection_manager.cc",
"memlog_connection_manager.h",
"memlog_receiver.h",
"memlog_receiver_pipe.cc",
"memlog_receiver_pipe.h",
"memlog_receiver_pipe_posix.cc",
"memlog_receiver_pipe_posix.h",
"memlog_receiver_pipe_win.cc",
"memlog_receiver_pipe_win.h",
"memlog_stream_parser.cc",
"memlog_stream_parser.h",
"memlog_stream_receiver.h",
"profiling_service.cc",
"profiling_service.h",
"receiver.h",
"receiver_pipe.cc",
"receiver_pipe.h",
"receiver_pipe_posix.cc",
"receiver_pipe_posix.h",
"receiver_pipe_win.cc",
"receiver_pipe_win.h",
"stream_parser.cc",
"stream_parser.h",
"stream_receiver.h",
]

deps = [
"//base",
"//chrome/common",
"//content/public/child",
"//components/services/heap_profiling/public/cpp",
"//mojo/edk",
"//services/resource_coordinator/public/cpp:resource_coordinator_cpp",
"//third_party/zlib",
Expand All @@ -50,27 +49,28 @@ source_set("unit_tests") {
sources = [
"backtrace_storage_unittest.cc",
"json_exporter_unittest.cc",
"memlog_stream_parser_unittest.cc",
"stream_parser_unittest.cc",
]
deps = [
":profiling",
":heap_profiling",
"//base",
"//services/resource_coordinator/public/cpp:resource_coordinator_cpp",
"//testing/gtest",
]
}

service_manifest("manifest") {
name = "profiling"
source = "profiling_manifest.json"
name = "heap_profiling"
source = "heap_profiling_manifest.json"
}

fuzzer_test("profiling_fuzzer") {
sources = [
"memlog_stream_fuzzer.cc",
"stream_fuzzer.cc",
]
deps = [
":profiling",
":heap_profiling",
]
libfuzzer_options = [ "max_len = 64000" ]
dict = "memlog_stream_fuzzer.dict"
dict = "stream_fuzzer.dict"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
include_rules = [
"+components/services/heap_profiling/public",
"+content/public/child",
"+mojo/edk/embedder",
"+services/resource_coordinator/public",
"+services/service_manager/public/cpp",
"+third_party/zlib/zlib.h",
]
3 changes: 3 additions & 0 deletions components/services/heap_profiling/OWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
erikchen@chromium.org

per-file heap_profiling_manifest.json=set noparent
per-file heap_profiling_manifest.json=file://ipc/SECURITY_OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_PROFILING_ADDRESS_H_
#define CHROME_PROFILING_ADDRESS_H_
#ifndef COMPONENTS_SERVICES_HEAP_PROFILING_ADDRESS_H_
#define COMPONENTS_SERVICES_HEAP_PROFILING_ADDRESS_H_

#include <stdint.h>

Expand Down Expand Up @@ -62,4 +62,4 @@ struct hash<profiling::Address> {

} // namespace std

#endif // CHROME_PROFILING_ADDRESS_H_
#endif // COMPONENTS_SERVICES_HEAP_PROFILING_ADDRESS_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/profiling/allocation_event.h"
#include "components/services/heap_profiling/allocation_event.h"

namespace profiling {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_PROFILING_ALLOCATION_EVENT_H_
#define CHROME_PROFILING_ALLOCATION_EVENT_H_
#ifndef COMPONENTS_SERVICES_HEAP_PROFILING_ALLOCATION_EVENT_H_
#define COMPONENTS_SERVICES_HEAP_PROFILING_ALLOCATION_EVENT_H_

#include <functional>
#include <map>
#include <unordered_set>

#include "chrome/profiling/address.h"
#include "chrome/profiling/backtrace_storage.h"
#include "components/services/heap_profiling/address.h"
#include "components/services/heap_profiling/backtrace_storage.h"
#include "components/services/heap_profiling/public/cpp/stream.h"

namespace profiling {
Expand Down Expand Up @@ -100,4 +100,4 @@ AllocationCountMap AllocationEventSetToCountMap(const AllocationEventSet& set);

} // namespace profiling

#endif // CHROME_PROFILING_ALLOCATION_EVENT_H_
#endif // COMPONENTS_SERVICES_HEAP_PROFILING_ALLOCATION_EVENT_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/profiling/allocation_tracker.h"
#include "components/services/heap_profiling/allocation_tracker.h"

#include "base/callback.h"
#include "base/json/string_escape.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/profiling/backtrace_storage.h"
#include "components/services/heap_profiling/backtrace_storage.h"

namespace profiling {

Expand Down
Loading

0 comments on commit fa983fa

Please sign in to comment.