| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 base::TerminationStatus GetTerminationStatus(bool known_dead, | 77 base::TerminationStatus GetTerminationStatus(bool known_dead, |
| 78 int* exit_code) override; | 78 int* exit_code) override; |
| 79 std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator() | 79 std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator() |
| 80 override; | 80 override; |
| 81 void SetName(const base::string16& name) override; | 81 void SetName(const base::string16& name) override; |
| 82 void SetHandle(base::ProcessHandle handle) override; | 82 void SetHandle(base::ProcessHandle handle) override; |
| 83 std::string GetServiceRequestChannelToken() override; | 83 std::string GetServiceRequestChannelToken() override; |
| 84 | 84 |
| 85 // ChildProcessHostDelegate implementation: | 85 // ChildProcessHostDelegate implementation: |
| 86 bool CanShutdown() override; | 86 bool CanShutdown() override; |
| 87 void OnChannelInitialized(IPC::Channel* channel) override; |
| 87 void OnChildDisconnected() override; | 88 void OnChildDisconnected() override; |
| 88 const base::Process& GetProcess() const override; | 89 const base::Process& GetProcess() const override; |
| 89 service_manager::InterfaceProvider* GetRemoteInterfaces() override; | 90 service_manager::InterfaceProvider* GetRemoteInterfaces() override; |
| 90 bool OnMessageReceived(const IPC::Message& message) override; | 91 bool OnMessageReceived(const IPC::Message& message) override; |
| 91 void OnChannelConnected(int32_t peer_pid) override; | 92 void OnChannelConnected(int32_t peer_pid) override; |
| 92 void OnChannelError() override; | 93 void OnChannelError() override; |
| 93 void OnBadMessageReceived(const IPC::Message& message) override; | 94 void OnBadMessageReceived(const IPC::Message& message) override; |
| 94 | 95 |
| 95 // Terminates the process and logs an error after a bad message was received | 96 // Terminates the process and logs an error after a bad message was received |
| 96 // from the child process. | 97 // from the child process. |
| 97 void TerminateOnBadMessageReceived(uint32_t type); | 98 void TerminateOnBadMessageReceived(uint32_t type); |
| 98 | 99 |
| 99 // Removes this host from the host list. Calls ChildProcessHost::ForceShutdown | 100 // Removes this host from the host list. Calls ChildProcessHost::ForceShutdown |
| 100 void ForceShutdown(); | 101 void ForceShutdown(); |
| 101 | 102 |
| 102 // Callers can reduce the BrowserChildProcess' priority. | 103 // Callers can reduce the BrowserChildProcess' priority. |
| 103 void SetBackgrounded(bool backgrounded); | 104 void SetBackgrounded(bool backgrounded); |
| 104 | 105 |
| 105 // Adds an IPC message filter. | 106 // Adds an IPC message filter. |
| 106 void AddFilter(BrowserMessageFilter* filter); | 107 void AddFilter(BrowserMessageFilter* filter); |
| 107 | 108 |
| 108 static void HistogramBadMessageTerminated(int process_type); | 109 static void HistogramBadMessageTerminated(int process_type); |
| 109 | 110 |
| 110 BrowserChildProcessHostDelegate* delegate() const { return delegate_; } | 111 BrowserChildProcessHostDelegate* delegate() const { return delegate_; } |
| 111 | 112 |
| 112 ChildConnection* child_connection() const { | 113 ChildConnection* child_connection() const { |
| 113 return child_connection_.get(); | 114 return child_connection_.get(); |
| 114 } | 115 } |
| 115 | 116 |
| 117 IPC::Channel* child_channel() const { return channel_; } |
| 118 |
| 116 typedef std::list<BrowserChildProcessHostImpl*> BrowserChildProcessList; | 119 typedef std::list<BrowserChildProcessHostImpl*> BrowserChildProcessList; |
| 117 private: | 120 private: |
| 118 friend class BrowserChildProcessHostIterator; | 121 friend class BrowserChildProcessHostIterator; |
| 119 friend class BrowserChildProcessObserver; | 122 friend class BrowserChildProcessObserver; |
| 120 | 123 |
| 121 static BrowserChildProcessList* GetIterator(); | 124 static BrowserChildProcessList* GetIterator(); |
| 122 | 125 |
| 123 static void AddObserver(BrowserChildProcessObserver* observer); | 126 static void AddObserver(BrowserChildProcessObserver* observer); |
| 124 static void RemoveObserver(BrowserChildProcessObserver* observer); | 127 static void RemoveObserver(BrowserChildProcessObserver* observer); |
| 125 | 128 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 #if defined(OS_WIN) | 164 #if defined(OS_WIN) |
| 162 // Watches to see if the child process exits before the IPC channel has | 165 // Watches to see if the child process exits before the IPC channel has |
| 163 // been connected. Thereafter, its exit is determined by an error on the | 166 // been connected. Thereafter, its exit is determined by an error on the |
| 164 // IPC channel. | 167 // IPC channel. |
| 165 base::win::ObjectWatcher early_exit_watcher_; | 168 base::win::ObjectWatcher early_exit_watcher_; |
| 166 #endif | 169 #endif |
| 167 | 170 |
| 168 // The memory allocator, if any, in which the process will write its metrics. | 171 // The memory allocator, if any, in which the process will write its metrics. |
| 169 std::unique_ptr<base::SharedPersistentMemoryAllocator> metrics_allocator_; | 172 std::unique_ptr<base::SharedPersistentMemoryAllocator> metrics_allocator_; |
| 170 | 173 |
| 174 IPC::Channel* channel_ = nullptr; |
| 171 bool is_channel_connected_; | 175 bool is_channel_connected_; |
| 172 bool notify_child_disconnected_; | 176 bool notify_child_disconnected_; |
| 173 | 177 |
| 174 base::WeakPtrFactory<BrowserChildProcessHostImpl> weak_factory_; | 178 base::WeakPtrFactory<BrowserChildProcessHostImpl> weak_factory_; |
| 175 }; | 179 }; |
| 176 | 180 |
| 177 } // namespace content | 181 } // namespace content |
| 178 | 182 |
| 179 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ | 183 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ |
| OLD | NEW |