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