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 #include "chrome/common/child_thread.h" | 5 #include "chrome/common/child_thread.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "chrome/common/child_process.h" | 10 #include "chrome/common/child_process.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 } | 132 } |
133 | 133 |
134 IPC::SyncMessageFilter* ChildThread::sync_message_filter() { | 134 IPC::SyncMessageFilter* ChildThread::sync_message_filter() { |
135 return sync_message_filter_; | 135 return sync_message_filter_; |
136 } | 136 } |
137 | 137 |
138 MessageLoop* ChildThread::message_loop() { | 138 MessageLoop* ChildThread::message_loop() { |
139 return message_loop_; | 139 return message_loop_; |
140 } | 140 } |
141 | 141 |
142 void ChildThread::OnMessageReceived(const IPC::Message& msg) { | 142 bool ChildThread::OnMessageReceived(const IPC::Message& msg) { |
143 // Resource responses are sent to the resource dispatcher. | 143 // Resource responses are sent to the resource dispatcher. |
144 if (resource_dispatcher_->OnMessageReceived(msg)) | 144 if (resource_dispatcher_->OnMessageReceived(msg)) |
145 return; | 145 return true; |
146 if (socket_stream_dispatcher_->OnMessageReceived(msg)) | 146 if (socket_stream_dispatcher_->OnMessageReceived(msg)) |
147 return; | 147 return true; |
148 if (file_system_dispatcher_->OnMessageReceived(msg)) | 148 if (file_system_dispatcher_->OnMessageReceived(msg)) |
149 return; | 149 return true; |
150 | 150 |
151 bool handled = true; | 151 bool handled = true; |
152 IPC_BEGIN_MESSAGE_MAP(ChildThread, msg) | 152 IPC_BEGIN_MESSAGE_MAP(ChildThread, msg) |
153 IPC_MESSAGE_HANDLER(PluginProcessMsg_AskBeforeShutdown, OnAskBeforeShutdown) | 153 IPC_MESSAGE_HANDLER(PluginProcessMsg_AskBeforeShutdown, OnAskBeforeShutdown) |
154 IPC_MESSAGE_HANDLER(PluginProcessMsg_Shutdown, OnShutdown) | 154 IPC_MESSAGE_HANDLER(PluginProcessMsg_Shutdown, OnShutdown) |
155 #if defined(IPC_MESSAGE_LOG_ENABLED) | 155 #if defined(IPC_MESSAGE_LOG_ENABLED) |
156 IPC_MESSAGE_HANDLER(PluginProcessMsg_SetIPCLoggingEnabled, | 156 IPC_MESSAGE_HANDLER(PluginProcessMsg_SetIPCLoggingEnabled, |
157 OnSetIPCLoggingEnabled) | 157 OnSetIPCLoggingEnabled) |
158 #endif | 158 #endif |
159 IPC_MESSAGE_UNHANDLED(handled = false) | 159 IPC_MESSAGE_UNHANDLED(handled = false) |
160 IPC_END_MESSAGE_MAP() | 160 IPC_END_MESSAGE_MAP() |
161 | 161 |
162 if (handled) | 162 if (handled) |
163 return; | 163 return true; |
164 | 164 |
165 if (msg.routing_id() == MSG_ROUTING_CONTROL) { | 165 if (msg.routing_id() == MSG_ROUTING_CONTROL) |
166 OnControlMessageReceived(msg); | 166 return OnControlMessageReceived(msg); |
167 } else { | 167 |
168 router_.OnMessageReceived(msg); | 168 return router_.OnMessageReceived(msg); |
169 } | |
170 } | 169 } |
171 | 170 |
172 void ChildThread::OnAskBeforeShutdown() { | 171 void ChildThread::OnAskBeforeShutdown() { |
173 check_with_browser_before_shutdown_ = true; | 172 check_with_browser_before_shutdown_ = true; |
174 } | 173 } |
175 | 174 |
176 void ChildThread::OnShutdown() { | 175 void ChildThread::OnShutdown() { |
177 MessageLoop::current()->Quit(); | 176 MessageLoop::current()->Quit(); |
178 } | 177 } |
179 | 178 |
(...skipping 15 matching lines...) Expand all Loading... |
195 MessageLoop::current()->Quit(); | 194 MessageLoop::current()->Quit(); |
196 return; | 195 return; |
197 } | 196 } |
198 | 197 |
199 // The child process shutdown sequence is a request response based mechanism, | 198 // The child process shutdown sequence is a request response based mechanism, |
200 // where we send out an initial feeler request to the child process host | 199 // where we send out an initial feeler request to the child process host |
201 // instance in the browser to verify if it's ok to shutdown the child process. | 200 // instance in the browser to verify if it's ok to shutdown the child process. |
202 // The browser then sends back a response if it's ok to shutdown. | 201 // The browser then sends back a response if it's ok to shutdown. |
203 Send(new PluginProcessHostMsg_ShutdownRequest); | 202 Send(new PluginProcessHostMsg_ShutdownRequest); |
204 } | 203 } |
OLD | NEW |