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/environment.h" | 8 #include "base/environment.h" |
9 #include "base/process/launch.h" | 9 #include "base/process/launch.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // If you need multiple batches of work to be done in the process, use | 27 // If you need multiple batches of work to be done in the process, use |
28 // StartBatchMode(), then multiple calls to StartFooBar(p), then finish with | 28 // StartBatchMode(), then multiple calls to StartFooBar(p), then finish with |
29 // EndBatchMode(). | 29 // EndBatchMode(). |
30 // | 30 // |
31 // Note: If your class keeps a ptr to an object of this type, grab a weak ptr to | 31 // Note: If your class keeps a ptr to an object of this type, grab a weak ptr to |
32 // avoid a use after free since this object is deleted synchronously but the | 32 // avoid a use after free since this object is deleted synchronously but the |
33 // client notification is asynchronous. See http://crbug.com/108871. | 33 // client notification is asynchronous. See http://crbug.com/108871. |
34 class UtilityProcessHost : public IPC::Sender, | 34 class UtilityProcessHost : public IPC::Sender, |
35 public base::SupportsWeakPtr<UtilityProcessHost> { | 35 public base::SupportsWeakPtr<UtilityProcessHost> { |
36 public: | 36 public: |
37 // Used to create a utility process. | 37 // Used to create a utility process. |client| is optional. If supplied it will |
| 38 // be notified of incoming messages from the utility process. |
| 39 // |client_task_runner| is required if |client| is supplied and is the task |
| 40 // runner upon which |client| will be invoked. |
38 CONTENT_EXPORT static UtilityProcessHost* Create( | 41 CONTENT_EXPORT static UtilityProcessHost* Create( |
39 UtilityProcessHostClient* client, | 42 UtilityProcessHostClient* client, |
40 base::SequencedTaskRunner* client_task_runner); | 43 base::SequencedTaskRunner* client_task_runner); |
41 | 44 |
42 virtual ~UtilityProcessHost() {} | 45 virtual ~UtilityProcessHost() {} |
43 | 46 |
44 // Starts utility process in batch mode. Caller must call EndBatchMode() | 47 // Starts utility process in batch mode. Caller must call EndBatchMode() |
45 // to finish the utility process. | 48 // to finish the utility process. |
46 virtual bool StartBatchMode() = 0; | 49 virtual bool StartBatchMode() = 0; |
47 | 50 |
(...skipping 19 matching lines...) Expand all Loading... |
67 virtual const ChildProcessData& GetData() = 0; | 70 virtual const ChildProcessData& GetData() = 0; |
68 | 71 |
69 #if defined(OS_POSIX) | 72 #if defined(OS_POSIX) |
70 virtual void SetEnv(const base::EnvironmentMap& env) = 0; | 73 virtual void SetEnv(const base::EnvironmentMap& env) = 0; |
71 #endif | 74 #endif |
72 }; | 75 }; |
73 | 76 |
74 }; // namespace content | 77 }; // namespace content |
75 | 78 |
76 #endif // CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_HOST_H_ | 79 #endif // CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_HOST_H_ |
OLD | NEW |