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" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 BrowserChildProcessHostDelegate* delegate); | 47 BrowserChildProcessHostDelegate* delegate); |
48 ~BrowserChildProcessHostImpl() override; | 48 ~BrowserChildProcessHostImpl() override; |
49 | 49 |
50 // Terminates all child processes and deletes each BrowserChildProcessHost | 50 // Terminates all child processes and deletes each BrowserChildProcessHost |
51 // instance. | 51 // instance. |
52 static void TerminateAll(); | 52 static void TerminateAll(); |
53 | 53 |
54 // BrowserChildProcessHost implementation: | 54 // BrowserChildProcessHost implementation: |
55 bool Send(IPC::Message* message) override; | 55 bool Send(IPC::Message* message) override; |
56 void Launch(SandboxedProcessLauncherDelegate* delegate, | 56 void Launch(SandboxedProcessLauncherDelegate* delegate, |
57 base::CommandLine* cmd_line) override; | 57 base::CommandLine* cmd_line, |
| 58 bool terminate_on_shutdown) override; |
58 const ChildProcessData& GetData() const override; | 59 const ChildProcessData& GetData() const override; |
59 ChildProcessHost* GetHost() const override; | 60 ChildProcessHost* GetHost() const override; |
60 base::TerminationStatus GetTerminationStatus(bool known_dead, | 61 base::TerminationStatus GetTerminationStatus(bool known_dead, |
61 int* exit_code) override; | 62 int* exit_code) override; |
62 void SetName(const base::string16& name) override; | 63 void SetName(const base::string16& name) override; |
63 void SetHandle(base::ProcessHandle handle) override; | 64 void SetHandle(base::ProcessHandle handle) override; |
64 | 65 |
65 // ChildProcessHostDelegate implementation: | 66 // ChildProcessHostDelegate implementation: |
66 bool CanShutdown() override; | 67 bool CanShutdown() override; |
67 void OnChildDisconnected() override; | 68 void OnChildDisconnected() override; |
68 const base::Process& GetProcess() const override; | 69 const base::Process& GetProcess() const override; |
69 bool OnMessageReceived(const IPC::Message& message) override; | 70 bool OnMessageReceived(const IPC::Message& message) override; |
70 void OnChannelConnected(int32 peer_pid) override; | 71 void OnChannelConnected(int32 peer_pid) override; |
71 void OnChannelError() override; | 72 void OnChannelError() override; |
72 void OnBadMessageReceived(const IPC::Message& message) override; | 73 void OnBadMessageReceived(const IPC::Message& message) override; |
73 | 74 |
74 // Removes this host from the host list. Calls ChildProcessHost::ForceShutdown | 75 // Removes this host from the host list. Calls ChildProcessHost::ForceShutdown |
75 void ForceShutdown(); | 76 void ForceShutdown(); |
76 | 77 |
77 // Callers can reduce the BrowserChildProcess' priority. | 78 // Callers can reduce the BrowserChildProcess' priority. |
78 void SetBackgrounded(bool backgrounded); | 79 void SetBackgrounded(bool backgrounded); |
79 | 80 |
80 // Controls whether the child process should be terminated on browser | |
81 // shutdown. Default is to always terminate. | |
82 void SetTerminateChildOnShutdown(bool terminate_on_shutdown); | |
83 | |
84 // Adds an IPC message filter. | 81 // Adds an IPC message filter. |
85 void AddFilter(BrowserMessageFilter* filter); | 82 void AddFilter(BrowserMessageFilter* filter); |
86 | 83 |
87 // Called when an instance of a particular child is created in a page. | 84 // Called when an instance of a particular child is created in a page. |
88 static void NotifyProcessInstanceCreated(const ChildProcessData& data); | 85 static void NotifyProcessInstanceCreated(const ChildProcessData& data); |
89 | 86 |
90 static void HistogramBadMessageTerminated(int process_type); | 87 static void HistogramBadMessageTerminated(int process_type); |
91 | 88 |
92 BrowserChildProcessHostDelegate* delegate() const { return delegate_; } | 89 BrowserChildProcessHostDelegate* delegate() const { return delegate_; } |
93 | 90 |
(...skipping 28 matching lines...) Expand all Loading... |
122 // Watches to see if the child process exits before the IPC channel has | 119 // Watches to see if the child process exits before the IPC channel has |
123 // been connected. Thereafter, its exit is determined by an error on the | 120 // been connected. Thereafter, its exit is determined by an error on the |
124 // IPC channel. | 121 // IPC channel. |
125 base::win::ObjectWatcher early_exit_watcher_; | 122 base::win::ObjectWatcher early_exit_watcher_; |
126 #endif | 123 #endif |
127 }; | 124 }; |
128 | 125 |
129 } // namespace content | 126 } // namespace content |
130 | 127 |
131 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ | 128 #endif // CONTENT_BROWSER_BROWSER_CHILD_PROCESS_HOST_IMPL_H_ |
OLD | NEW |