OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
7 | 7 |
8 #include "base/environment.h" | 8 #include "base/environment.h" |
9 #include "base/process/kill.h" | 9 #include "base/process/kill.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
11 #include "base/process/process_metrics.h" | 11 #include "base/process/process_metrics.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/public/common/process_type.h" | 15 #include "content/public/common/process_type.h" |
16 #include "ipc/ipc_sender.h" | 16 #include "ipc/ipc_sender.h" |
17 | 17 |
| 18 namespace base { |
18 class CommandLine; | 19 class CommandLine; |
19 | |
20 namespace base { | |
21 class FilePath; | 20 class FilePath; |
22 } | 21 } |
23 | 22 |
24 namespace content { | 23 namespace content { |
25 | 24 |
26 class BrowserChildProcessHostDelegate; | 25 class BrowserChildProcessHostDelegate; |
27 class ChildProcessHost; | 26 class ChildProcessHost; |
28 class SandboxedProcessLauncherDelegate; | 27 class SandboxedProcessLauncherDelegate; |
29 struct ChildProcessData; | 28 struct ChildProcessData; |
30 | 29 |
31 // This represents child processes of the browser process, i.e. plugins. They | 30 // This represents child processes of the browser process, i.e. plugins. They |
32 // will get terminated at browser shutdown. | 31 // will get terminated at browser shutdown. |
33 class CONTENT_EXPORT BrowserChildProcessHost : public IPC::Sender { | 32 class CONTENT_EXPORT BrowserChildProcessHost : public IPC::Sender { |
34 public: | 33 public: |
35 // Used to create a child process host. The delegate must outlive this object. | 34 // Used to create a child process host. The delegate must outlive this object. |
36 // |process_type| needs to be either an enum value from ProcessType or an | 35 // |process_type| needs to be either an enum value from ProcessType or an |
37 // embedder-defined value. | 36 // embedder-defined value. |
38 static BrowserChildProcessHost* Create( | 37 static BrowserChildProcessHost* Create( |
39 int process_type, | 38 int process_type, |
40 BrowserChildProcessHostDelegate* delegate); | 39 BrowserChildProcessHostDelegate* delegate); |
41 | 40 |
42 virtual ~BrowserChildProcessHost() {} | 41 virtual ~BrowserChildProcessHost() {} |
43 | 42 |
44 // Derived classes call this to launch the child process asynchronously. | 43 // Derived classes call this to launch the child process asynchronously. |
45 // Takes ownership of |cmd_line| and |delegate|. | 44 // Takes ownership of |cmd_line| and |delegate|. |
46 virtual void Launch( | 45 virtual void Launch( |
47 SandboxedProcessLauncherDelegate* delegate, | 46 SandboxedProcessLauncherDelegate* delegate, |
48 CommandLine* cmd_line) = 0; | 47 base::CommandLine* cmd_line) = 0; |
49 | 48 |
50 virtual const ChildProcessData& GetData() const = 0; | 49 virtual const ChildProcessData& GetData() const = 0; |
51 | 50 |
52 // Returns the ChildProcessHost object used by this object. | 51 // Returns the ChildProcessHost object used by this object. |
53 virtual ChildProcessHost* GetHost() const = 0; | 52 virtual ChildProcessHost* GetHost() const = 0; |
54 | 53 |
55 // Returns the termination status of a child. |exit_code| is the | 54 // Returns the termination status of a child. |exit_code| is the |
56 // status returned when the process exited (for posix, as returned | 55 // status returned when the process exited (for posix, as returned |
57 // from waitpid(), for Windows, as returned from | 56 // from waitpid(), for Windows, as returned from |
58 // GetExitCodeProcess()). |exit_code| may be NULL. | 57 // GetExitCodeProcess()). |exit_code| may be NULL. |
(...skipping 18 matching lines...) Expand all Loading... |
77 | 76 |
78 #if defined(OS_MACOSX) && !defined(OS_IOS) | 77 #if defined(OS_MACOSX) && !defined(OS_IOS) |
79 // Returns a PortProvider used to get process metrics for child processes. | 78 // Returns a PortProvider used to get process metrics for child processes. |
80 static base::ProcessMetrics::PortProvider* GetPortProvider(); | 79 static base::ProcessMetrics::PortProvider* GetPortProvider(); |
81 #endif | 80 #endif |
82 }; | 81 }; |
83 | 82 |
84 }; // namespace content | 83 }; // namespace content |
85 | 84 |
86 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 85 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
OLD | NEW |