| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_COMMON_CHILD_PROCESS_HOST_H_ | 5 #ifndef CHROME_COMMON_CHILD_PROCESS_HOST_H_ |
| 6 #define CHROME_COMMON_CHILD_PROCESS_HOST_H_ | 6 #define CHROME_COMMON_CHILD_PROCESS_HOST_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 13 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 14 #include "ipc/ipc_channel.h" | 14 #include "ipc/ipc_channel.h" |
| 15 | 15 |
| 16 class NotificationType; | 16 class NotificationType; |
| 17 | 17 |
| 18 // Plugins/workers and other child processes that live on the IO thread should | 18 // Plugins/workers and other child processes that live on the IO thread should |
| 19 // derive from this class. | 19 // derive from this class. |
| 20 class ChildProcessHost : public ResourceDispatcherHost::Receiver, | 20 class ChildProcessHost : public ResourceDispatcherHost::Receiver, |
| 21 public IPC::Channel::Listener { | 21 public IPC::Channel::Listener { |
| 22 public: | 22 public: |
| 23 virtual ~ChildProcessHost(); | 23 virtual ~ChildProcessHost(); |
| 24 | 24 |
| 25 // Returns the pathname to be used for a child process. If a subprocess |
| 26 // pathname was specified on the command line, that will be used. Otherwise, |
| 27 // the default child process pathname will be returned. On most platforms, |
| 28 // this will be the same as the currently-executing process. On failure, |
| 29 // returns an empty wstring. |
| 30 static std::wstring GetChildPath(); |
| 31 |
| 25 // ResourceDispatcherHost::Receiver implementation: | 32 // ResourceDispatcherHost::Receiver implementation: |
| 26 virtual bool Send(IPC::Message* msg); | 33 virtual bool Send(IPC::Message* msg); |
| 27 | 34 |
| 28 // The Iterator class allows iteration through either all child processes, or | 35 // The Iterator class allows iteration through either all child processes, or |
| 29 // ones of a specific type, depending on which constructor is used. Note that | 36 // ones of a specific type, depending on which constructor is used. Note that |
| 30 // this should be done from the IO thread and that the iterator should not be | 37 // this should be done from the IO thread and that the iterator should not be |
| 31 // kept around as it may be invalidated on subsequent event processing in the | 38 // kept around as it may be invalidated on subsequent event processing in the |
| 32 // event loop. | 39 // event loop. |
| 33 class Iterator { | 40 class Iterator { |
| 34 public: | 41 public: |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 bool opening_channel_; | 107 bool opening_channel_; |
| 101 | 108 |
| 102 // The IPC::Channel. | 109 // The IPC::Channel. |
| 103 scoped_ptr<IPC::Channel> channel_; | 110 scoped_ptr<IPC::Channel> channel_; |
| 104 | 111 |
| 105 // IPC Channel's id. | 112 // IPC Channel's id. |
| 106 std::string channel_id_; | 113 std::string channel_id_; |
| 107 }; | 114 }; |
| 108 | 115 |
| 109 #endif // CHROME_COMMON_CHILD_PROCESS_HOST_H_ | 116 #endif // CHROME_COMMON_CHILD_PROCESS_HOST_H_ |
| OLD | NEW |