| 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_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ |
| 6 #define CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 public BrowserChildProcessHostDelegate { | 28 public BrowserChildProcessHostDelegate { |
| 29 public: | 29 public: |
| 30 UtilityProcessHostImpl(UtilityProcessHostClient* client, | 30 UtilityProcessHostImpl(UtilityProcessHostClient* client, |
| 31 base::SequencedTaskRunner* client_task_runner); | 31 base::SequencedTaskRunner* client_task_runner); |
| 32 virtual ~UtilityProcessHostImpl(); | 32 virtual ~UtilityProcessHostImpl(); |
| 33 | 33 |
| 34 // UtilityProcessHost implementation: | 34 // UtilityProcessHost implementation: |
| 35 virtual bool Send(IPC::Message* message) OVERRIDE; | 35 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 36 virtual bool StartBatchMode() OVERRIDE; | 36 virtual bool StartBatchMode() OVERRIDE; |
| 37 virtual void EndBatchMode() OVERRIDE; | 37 virtual void EndBatchMode() OVERRIDE; |
| 38 virtual void SetExposedDir(const FilePath& dir) OVERRIDE; | 38 virtual void SetExposedDir(const base::FilePath& dir) OVERRIDE; |
| 39 virtual void DisableSandbox() OVERRIDE; | 39 virtual void DisableSandbox() OVERRIDE; |
| 40 virtual void EnableZygote() OVERRIDE; | 40 virtual void EnableZygote() OVERRIDE; |
| 41 virtual const ChildProcessData& GetData() OVERRIDE; | 41 virtual const ChildProcessData& GetData() OVERRIDE; |
| 42 #if defined(OS_POSIX) | 42 #if defined(OS_POSIX) |
| 43 virtual void SetEnv(const base::EnvironmentVector& env) OVERRIDE; | 43 virtual void SetEnv(const base::EnvironmentVector& env) OVERRIDE; |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 void set_child_flags(int flags) { child_flags_ = flags; } | 46 void set_child_flags(int flags) { child_flags_ = flags; } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 // Starts a process if necessary. Returns true if it succeeded or a process | 49 // Starts a process if necessary. Returns true if it succeeded or a process |
| 50 // has already been started via StartBatchMode(). | 50 // has already been started via StartBatchMode(). |
| 51 bool StartProcess(); | 51 bool StartProcess(); |
| 52 | 52 |
| 53 // BrowserChildProcessHost: | 53 // BrowserChildProcessHost: |
| 54 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 54 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 55 virtual void OnProcessCrashed(int exit_code) OVERRIDE; | 55 virtual void OnProcessCrashed(int exit_code) OVERRIDE; |
| 56 | 56 |
| 57 // A pointer to our client interface, who will be informed of progress. | 57 // A pointer to our client interface, who will be informed of progress. |
| 58 scoped_refptr<UtilityProcessHostClient> client_; | 58 scoped_refptr<UtilityProcessHostClient> client_; |
| 59 scoped_refptr<base::SequencedTaskRunner> client_task_runner_; | 59 scoped_refptr<base::SequencedTaskRunner> client_task_runner_; |
| 60 // True when running in batch mode, i.e., StartBatchMode() has been called | 60 // True when running in batch mode, i.e., StartBatchMode() has been called |
| 61 // and the utility process will run until EndBatchMode(). | 61 // and the utility process will run until EndBatchMode(). |
| 62 bool is_batch_mode_; | 62 bool is_batch_mode_; |
| 63 | 63 |
| 64 FilePath exposed_dir_; | 64 base::FilePath exposed_dir_; |
| 65 | 65 |
| 66 // Whether to pass switches::kNoSandbox to the child. | 66 // Whether to pass switches::kNoSandbox to the child. |
| 67 bool no_sandbox_; | 67 bool no_sandbox_; |
| 68 | 68 |
| 69 // Flags defined in ChildProcessHost with which to start the process. | 69 // Flags defined in ChildProcessHost with which to start the process. |
| 70 int child_flags_; | 70 int child_flags_; |
| 71 | 71 |
| 72 // Launch the utility process from the zygote. Defaults to false. | 72 // Launch the utility process from the zygote. Defaults to false. |
| 73 bool use_linux_zygote_; | 73 bool use_linux_zygote_; |
| 74 | 74 |
| 75 base::EnvironmentVector env_; | 75 base::EnvironmentVector env_; |
| 76 | 76 |
| 77 bool started_; | 77 bool started_; |
| 78 | 78 |
| 79 scoped_ptr<BrowserChildProcessHostImpl> process_; | 79 scoped_ptr<BrowserChildProcessHostImpl> process_; |
| 80 | 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHostImpl); | 81 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHostImpl); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 } // namespace content | 84 } // namespace content |
| 85 | 85 |
| 86 #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ | 86 #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_IMPL_H_ |
| OLD | NEW |