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_COMMON_CHILD_PROCESS_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ |
6 #define CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ | 6 #define CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ |
7 | 7 |
8 #include "base/files/scoped_file.h" | 8 #include "base/files/scoped_file.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "ipc/ipc_channel_proxy.h" | 11 #include "ipc/ipc_channel_proxy.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class FilePath; | 14 class FilePath; |
15 } | 15 } |
16 | 16 |
17 namespace IPC { | 17 namespace IPC { |
| 18 class AttachmentBroker; |
18 class MessageFilter; | 19 class MessageFilter; |
19 } | 20 } |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 | 23 |
23 class ChildProcessHostDelegate; | 24 class ChildProcessHostDelegate; |
24 | 25 |
25 // This represents a non-browser process. This can include traditional child | 26 // This represents a non-browser process. This can include traditional child |
26 // processes like plugins, or an embedder could even use this for long lived | 27 // processes like plugins, or an embedder could even use this for long lived |
27 // processes that run independent of the browser process. | 28 // processes that run independent of the browser process. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // the default child process pathname will be returned. On most platforms, | 77 // the default child process pathname will be returned. On most platforms, |
77 // this will be the same as the currently-executing process. | 78 // this will be the same as the currently-executing process. |
78 // | 79 // |
79 // The |flags| argument accepts one or more flags such as CHILD_ALLOW_SELF | 80 // The |flags| argument accepts one or more flags such as CHILD_ALLOW_SELF |
80 // and CHILD_ALLOW_HEAP_EXECUTION as defined above. Pass only CHILD_NORMAL | 81 // and CHILD_ALLOW_HEAP_EXECUTION as defined above. Pass only CHILD_NORMAL |
81 // if none of these special behaviors are required. | 82 // if none of these special behaviors are required. |
82 // | 83 // |
83 // On failure, returns an empty FilePath. | 84 // On failure, returns an empty FilePath. |
84 static base::FilePath GetChildPath(int flags); | 85 static base::FilePath GetChildPath(int flags); |
85 | 86 |
| 87 // Returns an AttachmentBroker used to broker attachments of IPC messages to |
| 88 // child processes. This method is only useful in the embedder, and only |
| 89 // because a particular embedder (Chrome) is bad at avoiding the use of |
| 90 // singletons. Child processes should find a cleaner way of passing around an |
| 91 // AttachmentBroker. |
| 92 static IPC::AttachmentBroker* GetAttachmentBroker(); |
| 93 |
86 // Send the shutdown message to the child process. | 94 // Send the shutdown message to the child process. |
87 // Does not check with the delegate's CanShutdown. | 95 // Does not check with the delegate's CanShutdown. |
88 virtual void ForceShutdown() = 0; | 96 virtual void ForceShutdown() = 0; |
89 | 97 |
90 // Creates the IPC channel. Returns the channel id if it succeeded, an | 98 // Creates the IPC channel. Returns the channel id if it succeeded, an |
91 // empty string otherwise | 99 // empty string otherwise |
92 virtual std::string CreateChannel() = 0; | 100 virtual std::string CreateChannel() = 0; |
93 | 101 |
94 // Returns true iff the IPC channel is currently being opened; | 102 // Returns true iff the IPC channel is currently being opened; |
95 virtual bool IsChannelOpening() = 0; | 103 virtual bool IsChannelOpening() = 0; |
96 | 104 |
97 // Adds an IPC message filter. A reference will be kept to the filter. | 105 // Adds an IPC message filter. A reference will be kept to the filter. |
98 virtual void AddFilter(IPC::MessageFilter* filter) = 0; | 106 virtual void AddFilter(IPC::MessageFilter* filter) = 0; |
99 | 107 |
100 #if defined(OS_POSIX) | 108 #if defined(OS_POSIX) |
101 // See IPC::Channel::TakeClientFileDescriptor. | 109 // See IPC::Channel::TakeClientFileDescriptor. |
102 virtual base::ScopedFD TakeClientFileDescriptor() = 0; | 110 virtual base::ScopedFD TakeClientFileDescriptor() = 0; |
103 #endif | 111 #endif |
104 }; | 112 }; |
105 | 113 |
106 }; // namespace content | 114 }; // namespace content |
107 | 115 |
108 #endif // CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ | 116 #endif // CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ |
OLD | NEW |