Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CONTENT_BROWSER_UTILITY_PROCESS_HOST_H_ |
| 6 #define CONTENT_BROWSER_UTILITY_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_UTILITY_PROCESS_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 | 62 |
| 63 // Ends the utility process. Must be called after StartBatchMode(). | 63 // Ends the utility process. Must be called after StartBatchMode(). |
| 64 void EndBatchMode(); | 64 void EndBatchMode(); |
| 65 | 65 |
| 66 void set_exposed_dir(const FilePath& dir) { exposed_dir_ = dir; } | 66 void set_exposed_dir(const FilePath& dir) { exposed_dir_ = dir; } |
| 67 void set_no_sandbox(bool flag) { no_sandbox_ = flag; } | 67 void set_no_sandbox(bool flag) { no_sandbox_ = flag; } |
| 68 void set_child_flags(int flags) { child_flags_ = flags; } | 68 void set_child_flags(int flags) { child_flags_ = flags; } |
| 69 #if defined(OS_POSIX) | 69 #if defined(OS_POSIX) |
| 70 void set_env(const base::environment_vector& env) { env_ = env; } | 70 void set_env(const base::environment_vector& env) { env_ = env; } |
| 71 #endif | 71 #endif |
| 72 #if defined(OS_LINUX) | |
| 73 void set_should_use_zygote(bool flag) { should_use_zygote_ = flag; } | |
| 74 #endif | |
| 72 | 75 |
| 73 protected: | 76 protected: |
| 74 // Allow these methods to be overridden for tests. | 77 // Allow these methods to be overridden for tests. |
| 75 virtual FilePath GetUtilityProcessCmd(); | 78 virtual FilePath GetUtilityProcessCmd(); |
| 76 | 79 |
| 77 private: | 80 private: |
| 78 // Starts a process if necessary. Returns true if it succeeded or a process | 81 // Starts a process if necessary. Returns true if it succeeded or a process |
| 79 // has already been started via StartBatchMode(). | 82 // has already been started via StartBatchMode(). |
| 80 bool StartProcess(); | 83 bool StartProcess(); |
| 81 | 84 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 98 FilePath exposed_dir_; | 101 FilePath exposed_dir_; |
| 99 | 102 |
| 100 // Whether to pass switches::kNoSandbox to the child. | 103 // Whether to pass switches::kNoSandbox to the child. |
| 101 bool no_sandbox_; | 104 bool no_sandbox_; |
| 102 | 105 |
| 103 // Flags defined in ChildProcessHost with which to start the process. | 106 // Flags defined in ChildProcessHost with which to start the process. |
| 104 int child_flags_; | 107 int child_flags_; |
| 105 | 108 |
| 106 base::environment_vector env_; | 109 base::environment_vector env_; |
| 107 | 110 |
| 111 #if defined(OS_LINUX) | |
|
Aaron Boodman
2011/12/02 03:10:04
It's a shame to require #ifdefs at all the call si
Jorge Lucangeli Obes
2011/12/02 18:27:16
SGTM, will do.
| |
| 112 // If the |no_sandbox_| flag is off, launch the utility process from the | |
| 113 // zygote. | |
| 114 // Can only be used for tasks that do not require FS access. | |
| 115 bool should_use_zygote_; | |
| 116 #endif | |
| 117 | |
| 108 bool started_; | 118 bool started_; |
| 109 | 119 |
| 110 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHost); | 120 DISALLOW_COPY_AND_ASSIGN(UtilityProcessHost); |
| 111 }; | 121 }; |
| 112 | 122 |
| 113 #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_H_ | 123 #endif // CONTENT_BROWSER_UTILITY_PROCESS_HOST_H_ |
| OLD | NEW |