OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/process_util.h" |
| 10 #include "base/string16.h" |
| 11 #include "build/build_config.h" |
| 12 #include "content/common/content_export.h" |
| 13 #include "content/public/common/process_type.h" |
| 14 #include "ipc/ipc_message.h" |
| 15 |
| 16 class CommandLine; |
| 17 class FilePath; |
| 18 |
| 19 namespace content { |
| 20 |
| 21 class BrowserChildProcessHostDelegate; |
| 22 class ChildProcessHost; |
| 23 struct ChildProcessData; |
| 24 |
| 25 // This represents child processes of the browser process, i.e. plugins. They |
| 26 // will get terminated at browser shutdown. |
| 27 class CONTENT_EXPORT BrowserChildProcessHost : public IPC::Message::Sender { |
| 28 public: |
| 29 // Used to create a child process host. The delegate must outlive this object. |
| 30 static BrowserChildProcessHost* Create( |
| 31 ProcessType type, |
| 32 BrowserChildProcessHostDelegate* delegate); |
| 33 |
| 34 virtual ~BrowserChildProcessHost() {} |
| 35 |
| 36 // Derived classes call this to launch the child process asynchronously. |
| 37 virtual void Launch( |
| 38 #if defined(OS_WIN) |
| 39 const FilePath& exposed_dir, |
| 40 #elif defined(OS_POSIX) |
| 41 bool use_zygote, |
| 42 const base::environment_vector& environ, |
| 43 #endif |
| 44 CommandLine* cmd_line) = 0; |
| 45 |
| 46 virtual const ChildProcessData& GetData() const = 0; |
| 47 |
| 48 // Returns the ChildProcessHost object used by this object. |
| 49 virtual ChildProcessHost* GetHost() const = 0; |
| 50 |
| 51 // Returns the termination status of a child. |exit_code| is the |
| 52 // status returned when the process exited (for posix, as returned |
| 53 // from waitpid(), for Windows, as returned from |
| 54 // GetExitCodeProcess()). |exit_code| may be NULL. |
| 55 virtual base::TerminationStatus GetTerminationStatus(int* exit_code) = 0; |
| 56 |
| 57 // Sets the user-visible name of the process. |
| 58 virtual void SetName(const string16& name) = 0; |
| 59 |
| 60 // Set the handle of the process. BrowserChildProcessHost will do this when |
| 61 // the Launch method is used to start the process. However if the owner |
| 62 // of this object doesn't call Launch and starts the process in another way, |
| 63 // they need to call this method so that the process handle is associated with |
| 64 // this object. |
| 65 virtual void SetHandle(base::ProcessHandle handle) = 0; |
| 66 }; |
| 67 |
| 68 }; // namespace content |
| 69 |
| 70 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
OLD | NEW |