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_UTILITY_PROCESS_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_HOST_H_ |
6 #define CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_HOST_H_ |
7 | 7 |
8 #include "base/process/launch.h" | 8 #include "base/process/launch.h" |
| 9 #include "base/threading/thread.h" |
9 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
10 #include "ipc/ipc_sender.h" | 11 #include "ipc/ipc_sender.h" |
11 | 12 |
12 namespace base { | 13 namespace base { |
13 class FilePath; | 14 class FilePath; |
14 class SequencedTaskRunner; | 15 class SequencedTaskRunner; |
15 } | 16 } |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 class UtilityProcessHostClient; | 19 class UtilityProcessHostClient; |
19 struct ChildProcessData; | 20 struct ChildProcessData; |
20 | 21 |
| 22 typedef base::Thread* (*UtilityMainThreadFactoryFunction)( |
| 23 const std::string& id); |
| 24 |
21 // This class acts as the browser-side host to a utility child process. A | 25 // This class acts as the browser-side host to a utility child process. A |
22 // utility process is a short-lived process that is created to run a specific | 26 // utility process is a short-lived process that is created to run a specific |
23 // task. This class lives solely on the IO thread. | 27 // task. This class lives solely on the IO thread. |
24 // If you need a single method call in the process, use StartFooBar(p). | 28 // If you need a single method call in the process, use StartFooBar(p). |
25 // If you need multiple batches of work to be done in the process, use | 29 // If you need multiple batches of work to be done in the process, use |
26 // StartBatchMode(), then multiple calls to StartFooBar(p), then finish with | 30 // StartBatchMode(), then multiple calls to StartFooBar(p), then finish with |
27 // EndBatchMode(). | 31 // EndBatchMode(). |
28 // | 32 // |
29 // Note: If your class keeps a ptr to an object of this type, grab a weak ptr to | 33 // Note: If your class keeps a ptr to an object of this type, grab a weak ptr to |
30 // avoid a use after free since this object is deleted synchronously but the | 34 // avoid a use after free since this object is deleted synchronously but the |
(...skipping 28 matching lines...) Expand all Loading... |
59 // If the sandbox is being used and we are on Linux, launch the process from | 63 // If the sandbox is being used and we are on Linux, launch the process from |
60 // the zygote. Can only be used for tasks that do not require FS access. | 64 // the zygote. Can only be used for tasks that do not require FS access. |
61 virtual void EnableZygote() = 0; | 65 virtual void EnableZygote() = 0; |
62 | 66 |
63 // Returns information about the utility child process. | 67 // Returns information about the utility child process. |
64 virtual const ChildProcessData& GetData() = 0; | 68 virtual const ChildProcessData& GetData() = 0; |
65 | 69 |
66 #if defined(OS_POSIX) | 70 #if defined(OS_POSIX) |
67 virtual void SetEnv(const base::EnvironmentVector& env) = 0; | 71 virtual void SetEnv(const base::EnvironmentVector& env) = 0; |
68 #endif | 72 #endif |
| 73 |
| 74 CONTENT_EXPORT static void RegisterUtilityMainThreadFactory( |
| 75 UtilityMainThreadFactoryFunction create); |
69 }; | 76 }; |
70 | 77 |
71 }; // namespace content | 78 }; // namespace content |
72 | 79 |
73 #endif // CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_HOST_H_ | 80 #endif // CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_HOST_H_ |
OLD | NEW |