| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/ppapi_plugin/ppapi_thread.h" | 5 #include "content/ppapi_plugin/ppapi_thread.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // dispatching, then uses the message router. We don't actually need any of | 66 // dispatching, then uses the message router. We don't actually need any of |
| 67 // this so this function just overrides that one. | 67 // this so this function just overrides that one. |
| 68 // | 68 // |
| 69 // Note that this function is called only for messages from the channel to the | 69 // Note that this function is called only for messages from the channel to the |
| 70 // browser process. Messages from the renderer process are sent via a different | 70 // browser process. Messages from the renderer process are sent via a different |
| 71 // channel that ends up at Dispatcher::OnMessageReceived. | 71 // channel that ends up at Dispatcher::OnMessageReceived. |
| 72 bool PpapiThread::OnMessageReceived(const IPC::Message& msg) { | 72 bool PpapiThread::OnMessageReceived(const IPC::Message& msg) { |
| 73 IPC_BEGIN_MESSAGE_MAP(PpapiThread, msg) | 73 IPC_BEGIN_MESSAGE_MAP(PpapiThread, msg) |
| 74 IPC_MESSAGE_HANDLER(PpapiMsg_LoadPlugin, OnMsgLoadPlugin) | 74 IPC_MESSAGE_HANDLER(PpapiMsg_LoadPlugin, OnMsgLoadPlugin) |
| 75 IPC_MESSAGE_HANDLER(PpapiMsg_CreateChannel, OnMsgCreateChannel) | 75 IPC_MESSAGE_HANDLER(PpapiMsg_CreateChannel, OnMsgCreateChannel) |
| 76 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBFlashTCPSocket_ConnectACK, | 76 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_ConnectACK, |
| 77 OnPluginDispatcherMessageReceived(msg)) | 77 OnPluginDispatcherMessageReceived(msg)) |
| 78 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBFlashTCPSocket_SSLHandshakeACK, | 78 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, |
| 79 OnPluginDispatcherMessageReceived(msg)) | 79 OnPluginDispatcherMessageReceived(msg)) |
| 80 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBFlashTCPSocket_ReadACK, | 80 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_ReadACK, |
| 81 OnPluginDispatcherMessageReceived(msg)) | 81 OnPluginDispatcherMessageReceived(msg)) |
| 82 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBFlashTCPSocket_WriteACK, | 82 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_WriteACK, |
| 83 OnPluginDispatcherMessageReceived(msg)) | 83 OnPluginDispatcherMessageReceived(msg)) |
| 84 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBFlashUDPSocket_RecvFromACK, | 84 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBUDPSocket_RecvFromACK, |
| 85 OnPluginDispatcherMessageReceived(msg)) | 85 OnPluginDispatcherMessageReceived(msg)) |
| 86 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBFlashUDPSocket_SendToACK, | 86 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBUDPSocket_SendToACK, |
| 87 OnPluginDispatcherMessageReceived(msg)) | 87 OnPluginDispatcherMessageReceived(msg)) |
| 88 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBFlashUDPSocket_BindACK, | 88 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBUDPSocket_BindACK, |
| 89 OnPluginDispatcherMessageReceived(msg)) | 89 OnPluginDispatcherMessageReceived(msg)) |
| 90 IPC_MESSAGE_HANDLER(PpapiMsg_SetNetworkState, OnMsgSetNetworkState) | 90 IPC_MESSAGE_HANDLER(PpapiMsg_SetNetworkState, OnMsgSetNetworkState) |
| 91 IPC_END_MESSAGE_MAP() | 91 IPC_END_MESSAGE_MAP() |
| 92 return true; | 92 return true; |
| 93 } | 93 } |
| 94 | 94 |
| 95 base::MessageLoopProxy* PpapiThread::GetIPCMessageLoop() { | 95 base::MessageLoopProxy* PpapiThread::GetIPCMessageLoop() { |
| 96 return ChildProcess::current()->io_message_loop_proxy(); | 96 return ChildProcess::current()->io_message_loop_proxy(); |
| 97 } | 97 } |
| 98 | 98 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 // connection is not established. | 302 // connection is not established. |
| 303 handle->socket = base::FileDescriptor(dispatcher->TakeRendererFD(), true); | 303 handle->socket = base::FileDescriptor(dispatcher->TakeRendererFD(), true); |
| 304 if (handle->socket.fd == -1) | 304 if (handle->socket.fd == -1) |
| 305 return false; | 305 return false; |
| 306 #endif | 306 #endif |
| 307 | 307 |
| 308 // From here, the dispatcher will manage its own lifetime according to the | 308 // From here, the dispatcher will manage its own lifetime according to the |
| 309 // lifetime of the attached channel. | 309 // lifetime of the attached channel. |
| 310 return true; | 310 return true; |
| 311 } | 311 } |
| OLD | NEW |