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

Side by Side Diff: chrome/browser/profiling_host/profiling_process_host.h

Issue 2948283002: Profiling process topology (Closed)
Patch Set: Review comments Created 3 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PROFILING_HOST_PROFILING_PROCESS_HOST_H_
6 #define CHROME_BROWSER_PROFILING_HOST_PROFILING_PROCESS_HOST_H_
7
8 #include "base/macros.h"
9 #include "base/process/process.h"
10
11 namespace base {
12 class CommandLine;
13 }
14
15 namespace profiling {
16
17 // Represents the browser side of the profiling process (//chrome/profiling).
18 //
19 // The profiling process is a singleton. The profiling process infrastructure
20 // is implemented in the Chrome layer so doesn't depend on the content
21 // infrastructure for managing child processes.
22 //
23 // Not thread safe. Should be used on the browser UI thread only.
24 //
25 // The profing process host can be started normally while Chrome is running,
26 // but can also start in a partial mode where the memory logging connections
27 // are active but the Mojo control channel has not yet been connected. This is
28 // to support starting the profiling process very early in the startup
29 // process (to get most memory events) before other infrastructure like the
30 // I/O thread has been started.
31 class ProfilingProcessHost {
32 public:
33 // Launches the profiling process if necessary and returns a pointer to it.
34 static ProfilingProcessHost* EnsureStarted();
35
36 // Returns a pointer to the current global profiling process host or, if
37 // no profiling process is launched, nullptr.
38 static ProfilingProcessHost* Get();
39
40 // Appends necessary switches to a command line for a child process so it can
41 // be profiled. These switches will cause the child process to start in the
42 // same mode (either profiling or not) as the browser process.
43 static void AddSwitchesToChildCmdLine(base::CommandLine* child_cmd_line);
44
45 private:
46 ProfilingProcessHost();
47 ~ProfilingProcessHost();
48
49 void Launch();
50
51 // Use process_.IsValid() to determine if the child process has been launched.
52 base::Process process_;
53 std::string pipe_id_;
54
55 DISALLOW_COPY_AND_ASSIGN(ProfilingProcessHost);
56 };
57
58 } // namespace profiling
59
60 #endif // CHROME_BROWSER_PROFILING_HOST_PROFILING_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiling_host/README.md ('k') | chrome/browser/profiling_host/profiling_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698