| 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_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ |
| 6 #define CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/process/process.h" | 12 #include "base/process/process.h" |
| 13 #include "base/synchronization/waitable_event_watcher.h" | 13 #include "base/synchronization/waitable_event_watcher.h" |
| 14 #include "content/browser/child_process_launcher.h" | 14 #include "content/browser/child_process_launcher.h" |
| 15 #include "content/browser/power_monitor_message_broadcaster.h" | 15 #include "content/browser/power_monitor_message_broadcaster.h" |
| 16 #include "content/public/browser/browser_child_process_host.h" | 16 #include "content/public/browser/browser_child_process_host.h" |
| 17 #include "content/public/browser/child_process_data.h" | 17 #include "content/public/browser/child_process_data.h" |
| 18 #include "content/public/common/child_process_host_delegate.h" | 18 #include "content/public/common/child_process_host_delegate.h" |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 class BrowserChildProcessHostIterator; | 22 class BrowserChildProcessHostIterator; |
| 23 class BrowserChildProcessObserver; | 23 class BrowserChildProcessObserver; |
| 24 class BrowserMessageFilter; |
| 24 | 25 |
| 25 // Plugins/workers and other child processes that live on the IO thread use this | 26 // Plugins/workers and other child processes that live on the IO thread use this |
| 26 // class. RenderProcessHostImpl is the main exception that doesn't use this | 27 // class. RenderProcessHostImpl is the main exception that doesn't use this |
| 27 /// class because it lives on the UI thread. | 28 /// class because it lives on the UI thread. |
| 28 class CONTENT_EXPORT BrowserChildProcessHostImpl | 29 class CONTENT_EXPORT BrowserChildProcessHostImpl |
| 29 : public BrowserChildProcessHost, | 30 : public BrowserChildProcessHost, |
| 30 public NON_EXPORTED_BASE(ChildProcessHostDelegate), | 31 public NON_EXPORTED_BASE(ChildProcessHostDelegate), |
| 31 public ChildProcessLauncher::Client { | 32 public ChildProcessLauncher::Client { |
| 32 public: | 33 public: |
| 33 BrowserChildProcessHostImpl( | 34 BrowserChildProcessHostImpl( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 63 // Removes this host from the host list. Calls ChildProcessHost::ForceShutdown | 64 // Removes this host from the host list. Calls ChildProcessHost::ForceShutdown |
| 64 void ForceShutdown(); | 65 void ForceShutdown(); |
| 65 | 66 |
| 66 // Callers can reduce the BrowserChildProcess' priority. | 67 // Callers can reduce the BrowserChildProcess' priority. |
| 67 void SetBackgrounded(bool backgrounded); | 68 void SetBackgrounded(bool backgrounded); |
| 68 | 69 |
| 69 // Controls whether the child process should be terminated on browser | 70 // Controls whether the child process should be terminated on browser |
| 70 // shutdown. Default is to always terminate. | 71 // shutdown. Default is to always terminate. |
| 71 void SetTerminateChildOnShutdown(bool terminate_on_shutdown); | 72 void SetTerminateChildOnShutdown(bool terminate_on_shutdown); |
| 72 | 73 |
| 74 // Adds an IPC message filter. |
| 75 void AddFilter(BrowserMessageFilter* filter); |
| 76 |
| 73 // Called when an instance of a particular child is created in a page. | 77 // Called when an instance of a particular child is created in a page. |
| 74 static void NotifyProcessInstanceCreated(const ChildProcessData& data); | 78 static void NotifyProcessInstanceCreated(const ChildProcessData& data); |
| 75 | 79 |
| 76 BrowserChildProcessHostDelegate* delegate() const { return delegate_; } | 80 BrowserChildProcessHostDelegate* delegate() const { return delegate_; } |
| 77 | 81 |
| 78 typedef std::list<BrowserChildProcessHostImpl*> BrowserChildProcessList; | 82 typedef std::list<BrowserChildProcessHostImpl*> BrowserChildProcessList; |
| 79 private: | 83 private: |
| 80 friend class BrowserChildProcessHostIterator; | 84 friend class BrowserChildProcessHostIterator; |
| 81 friend class BrowserChildProcessObserver; | 85 friend class BrowserChildProcessObserver; |
| 82 | 86 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 112 // Watches to see if the child process exits before the IPC channel has | 116 // Watches to see if the child process exits before the IPC channel has |
| 113 // been connected. Thereafter, its exit is determined by an error on the | 117 // been connected. Thereafter, its exit is determined by an error on the |
| 114 // IPC channel. | 118 // IPC channel. |
| 115 base::WaitableEventWatcher early_exit_watcher_; | 119 base::WaitableEventWatcher early_exit_watcher_; |
| 116 #endif | 120 #endif |
| 117 }; | 121 }; |
| 118 | 122 |
| 119 } // namespace content | 123 } // namespace content |
| 120 | 124 |
| 121 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ | 125 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ |
| OLD | NEW |