Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7922)

Unified Diff: chrome/profiling/profiling_main.cc

Issue 2948283002: Profiling process topology (Closed)
Patch Set: Review comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/profiling/profiling_main.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/profiling/profiling_main.cc
diff --git a/chrome/profiling/profiling_main.cc b/chrome/profiling/profiling_main.cc
index c9c46679e2179501c7a7e9d3459dd79709a006f3..e549194ed1cbb3a9a672ff72d924d2367f1d59c2 100644
--- a/chrome/profiling/profiling_main.cc
+++ b/chrome/profiling/profiling_main.cc
@@ -4,17 +4,7 @@
#include "chrome/profiling/profiling_main.h"
-#include "base/base_paths.h"
#include "base/command_line.h"
-#include "base/files/file_path.h"
-#include "base/path_service.h"
-#include "base/process/launch.h"
-#include "base/process/process.h"
-#include "base/process/process_metrics.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "build/build_config.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/profiling/profiling_globals.h"
@@ -27,65 +17,6 @@
namespace profiling {
-namespace {
-
-base::CommandLine MakeBrowserCommandLine(const base::CommandLine& cmdline,
- const std::string& pipe_id) {
- const base::CommandLine::StringVector& our_argv = cmdline.argv();
-
- base::CommandLine::StringVector browser_argv;
- browser_argv.reserve(our_argv.size());
-
- // Program name.
- base::FilePath child_path;
-#if defined(OS_LINUX)
- // Use /proc/self/exe rather than our known binary path so updates
- // can't swap out the binary from underneath us.
- // When running under Valgrind, forking /proc/self/exe ends up forking the
- // Valgrind executable, which then crashes. However, it's almost safe to
- // assume that the updates won't happen while testing with Valgrind tools.
- if (!RunningOnValgrind())
- child_path = base::FilePath(base::kProcSelfExe);
-#endif
-
- if (child_path.empty())
- base::PathService::Get(base::FILE_EXE, &child_path);
- browser_argv.push_back(child_path.value()); // Program name.
-
- // Remove all memlog flags.
- for (size_t i = 1; i < our_argv.size(); i++) {
- if (!base::StartsWith(our_argv[i], FILE_PATH_LITERAL("--memlog"),
- base::CompareCase::SENSITIVE))
- browser_argv.push_back(our_argv[i]);
- }
-
- // Append the pipe ID.
- std::string pipe_switch("--");
- pipe_switch.append(switches::kMemlogPipe);
- pipe_switch.push_back('=');
- pipe_switch.append(pipe_id);
-#if defined(OS_WIN)
- browser_argv.push_back(base::ASCIIToUTF16(pipe_switch));
-#else
- browser_argv.push_back(pipe_switch);
-#endif
-
- return base::CommandLine(browser_argv);
-}
-
-bool LaunchBrowser(const base::CommandLine& our_cmdline,
- const std::string& pipe_id) {
- base::CommandLine browser_cmdline =
- MakeBrowserCommandLine(our_cmdline, pipe_id);
-
- base::LaunchOptions options;
- base::Process process = base::LaunchProcess(browser_cmdline, options);
-
- return true;
-}
-
-} // namespace
-
int ProfilingMain(const base::CommandLine& cmdline) {
ProfilingGlobals* globals = ProfilingGlobals::Get();
@@ -94,14 +25,9 @@ int ProfilingMain(const base::CommandLine& cmdline) {
globals->GetIORunner(),
mojo::edk::ScopedIPCSupport::ShutdownPolicy::CLEAN);
- base::Process process = base::Process::Current();
- std::string pipe_id = base::IntToString(static_cast<int>(process.Pid()));
-
+ std::string pipe_id = cmdline.GetSwitchValueASCII(switches::kMemlogPipe);
globals->GetMemlogConnectionManager()->StartConnections(pipe_id);
- if (!LaunchBrowser(cmdline, pipe_id))
- return 1;
-
ProfilingGlobals::Get()->RunMainMessageLoop();
#if defined(OS_WIN)
« no previous file with comments | « chrome/profiling/profiling_main.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698