diff options
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/child_process_host.cc | 19 | ||||
-rw-r--r-- | chrome/common/child_process_host.h | 15 | ||||
-rw-r--r-- | chrome/common/common.scons | 2 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.h | 67 |
4 files changed, 38 insertions, 65 deletions
diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc index ac3c681..66d3ebf 100644 --- a/chrome/common/child_process_host.cc +++ b/chrome/common/child_process_host.cc @@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/singleton.h" +#include "base/waitable_event.h" #include "chrome/browser/chrome_thread.h" #include "chrome/common/ipc_logging.h" #include "chrome/common/notification_service.h" @@ -40,9 +41,10 @@ class ChildNotificationTask : public Task { ChildProcessHost::ChildProcessHost( ProcessType type, MessageLoop* main_message_loop) : ChildProcessInfo(type), + ALLOW_THIS_IN_INITIALIZER_LIST(listener_(this)), main_message_loop_(main_message_loop), opening_channel_(false), - ALLOW_THIS_IN_INITIALIZER_LIST(listener_(this)) { + process_event_(NULL) { Singleton<ChildProcessList>::get()->push_back(this); } @@ -69,9 +71,13 @@ bool ChildProcessHost::CreateChannel() { } void ChildProcessHost::SetHandle(base::ProcessHandle process) { - DCHECK(handle() == NULL); +#if defined(OS_WIN) + process_event_.reset(new base::WaitableEvent(process)); + + DCHECK(!handle()); set_handle(process); - watcher_.StartWatching(process, this); + watcher_.StartWatching(process_event_.get(), this); +#endif } void ChildProcessHost::InstanceCreated() { @@ -91,7 +97,9 @@ void ChildProcessHost::Notify(NotificationType type) { FROM_HERE, new ChildNotificationTask(type, this)); } -void ChildProcessHost::OnObjectSignaled(HANDLE object) { +void ChildProcessHost::OnWaitableEventSignaled(base::WaitableEvent *event) { +#if defined(OS_WIN) + HANDLE object = event->handle(); DCHECK(handle()); DCHECK_EQ(object, handle()); @@ -102,12 +110,11 @@ void ChildProcessHost::OnObjectSignaled(HANDLE object) { } // Notify in the main loop of the disconnection. Notify(NotificationType::CHILD_PROCESS_HOST_DISCONNECTED); +#endif delete this; } - - ChildProcessHost::ListenerHook::ListenerHook(ChildProcessHost* host) : host_(host) { } diff --git a/chrome/common/child_process_host.h b/chrome/common/child_process_host.h index 01db515..4f173fc 100644 --- a/chrome/common/child_process_host.h +++ b/chrome/common/child_process_host.h @@ -5,10 +5,13 @@ #ifndef CHROME_COMMON_CHILD_PROCESS_HOST_H_ #define CHROME_COMMON_CHILD_PROCESS_HOST_H_ +#include "build/build_config.h" + #include <list> #include "base/basictypes.h" -#include "base/object_watcher.h" +#include "base/scoped_ptr.h" +#include "base/waitable_event_watcher.h" #include "chrome/common/child_process_info.h" #include "chrome/common/ipc_channel.h" @@ -18,7 +21,7 @@ class NotificationType; // Plugins/workers and other child processes that live on the IO thread should // derive from this class. class ChildProcessHost : public ChildProcessInfo, - public base::ObjectWatcher::Delegate, + public base::WaitableEventWatcher::Delegate, public IPC::Channel::Listener, public IPC::Message::Sender { public: @@ -72,8 +75,8 @@ class ChildProcessHost : public ChildProcessInfo, // Sends the given notification to the notification service on the UI thread. void Notify(NotificationType type); - // ObjectWatcher::Delegate implementation: - virtual void OnObjectSignaled(HANDLE object); + // WaitableEventWatcher::Delegate implementation: + virtual void OnWaitableEventSignaled(base::WaitableEvent *event); // By using an internal class as the IPC::Channel::Listener, we can intercept // OnMessageReceived/OnChannelConnected and do our own processing before @@ -102,7 +105,9 @@ class ChildProcessHost : public ChildProcessInfo, std::wstring channel_id_; // Used to watch the child process handle. - base::ObjectWatcher watcher_; + base::WaitableEventWatcher watcher_; + + scoped_ptr<base::WaitableEvent> process_event_; }; #endif // CHROME_COMMON_CHILD_PROCESS_HOST_H_ diff --git a/chrome/common/common.scons b/chrome/common/common.scons index cc5e95d..70775cc 100644 --- a/chrome/common/common.scons +++ b/chrome/common/common.scons @@ -238,8 +238,6 @@ if not env.Bit('windows'): 'gfx/path.cc', 'os_exchange_data.cc', 'process_watcher.cc', - 'child_process_host.cc', - 'child_process_host.h', ) if not env.Bit('windows'): diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h index 8e70e60..8f8ec0e 100644 --- a/chrome/common/temp_scaffolding_stubs.h +++ b/chrome/common/temp_scaffolding_stubs.h @@ -256,6 +256,21 @@ class DownloadRequestManager namespace sandbox { +enum ResultCode { + SBOX_ALL_OK = 0, + SBOX_ERROR_GENERIC = 1, + SBOX_ERROR_BAD_PARAMS = 2, + SBOX_ERROR_UNSUPPORTED = 3, + SBOX_ERROR_NO_SPACE = 4, + SBOX_ERROR_INVALID_IPC = 5, + SBOX_ERROR_FAILED_IPC = 6, + SBOX_ERROR_NO_HANDLE = 7, + SBOX_ERROR_UNEXPECTED_CALL = 8, + SBOX_ERROR_WAIT_ALREADY_CALLED = 9, + SBOX_ERROR_CHANNEL_ERROR = 10, + SBOX_ERROR_LAST +}; + class BrokerServices { public: void Init() { NOTIMPLEMENTED(); } @@ -568,58 +583,6 @@ class PluginInstaller { PluginInstaller(WebContents*) { } }; -class ChildProcessHost : public ChildProcessInfo { - public: - class Iterator { - public: - explicit Iterator(ProcessType type) { NOTIMPLEMENTED(); } - ChildProcessInfo* operator->() { return *iterator_; } - ChildProcessInfo* operator*() { return *iterator_; } - ChildProcessInfo* operator++() { return NULL; } - bool Done() { - NOTIMPLEMENTED(); - return true; - } - private: - std::list<ChildProcessInfo*>::iterator iterator_; - }; - protected: - ChildProcessHost(ProcessType type, MessageLoop* main_message_loop) - : ChildProcessInfo(type) { - NOTIMPLEMENTED(); - } -}; - -class PluginProcessHost : public ChildProcessHost { - public: - explicit PluginProcessHost(MessageLoop* main_message_loop) - : ChildProcessHost(PLUGIN_PROCESS, main_message_loop) { - NOTIMPLEMENTED(); - } - bool Init(const WebPluginInfo& info, - const std::string& activex_clsid, - const std::wstring& locale) { - NOTIMPLEMENTED(); - return false; - } - void OpenChannelToPlugin(ResourceMessageFilter* renderer_message_filter, - const std::string& mime_type, - IPC::Message* reply_msg) { - NOTIMPLEMENTED(); - } - static void ReplyToRenderer(ResourceMessageFilter* renderer_message_filter, - const std::wstring& channel, - const FilePath& plugin_path, - IPC::Message* reply_msg) { - NOTIMPLEMENTED(); - } - void Shutdown() { NOTIMPLEMENTED(); } - const WebPluginInfo& info() const { return info_; } - private: - WebPluginInfo info_; - DISALLOW_EVIL_CONSTRUCTORS(PluginProcessHost); -}; - class HungRendererWarning { public: static void HideForWebContents(WebContents*) { NOTIMPLEMENTED(); } |