| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/plugin/plugin_channel.h" | 5 #include "chrome/plugin/plugin_channel.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/common/child_process.h" | 11 #include "chrome/common/child_process.h" |
| 12 #include "chrome/common/plugin_messages.h" | 12 #include "chrome/common/plugin_messages.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "chrome/plugin/plugin_thread.h" | 14 #include "chrome/plugin/plugin_thread.h" |
| 15 | 15 |
| 16 #if defined(OS_POSIX) | 16 #if defined(OS_POSIX) |
| 17 #include "chrome/common/ipc_channel_posix.h" | 17 #include "ipc/ipc_channel_posix.h" |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 PluginChannel* PluginChannel::GetPluginChannel( | 20 PluginChannel* PluginChannel::GetPluginChannel( |
| 21 int process_id, MessageLoop* ipc_message_loop) { | 21 int process_id, MessageLoop* ipc_message_loop) { |
| 22 // map renderer's process id to a (single) channel to that process | 22 // map renderer's process id to a (single) channel to that process |
| 23 std::string channel_name = StringPrintf( | 23 std::string channel_name = StringPrintf( |
| 24 "%d.r%d", base::GetCurrentProcId(), process_id); | 24 "%d.r%d", base::GetCurrentProcId(), process_id); |
| 25 | 25 |
| 26 return static_cast<PluginChannel*>(PluginChannelBase::GetChannel( | 26 return static_cast<PluginChannel*>(PluginChannelBase::GetChannel( |
| 27 channel_name, | 27 channel_name, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // This gets called when the PluginChannel is initially created. At this | 155 // This gets called when the PluginChannel is initially created. At this |
| 156 // point, create the socketpair and assign the plugin side FD to the channel | 156 // point, create the socketpair and assign the plugin side FD to the channel |
| 157 // name. Keep the renderer side FD as a member variable in the PluginChannel | 157 // name. Keep the renderer side FD as a member variable in the PluginChannel |
| 158 // to be able to transmit it through IPC. | 158 // to be able to transmit it through IPC. |
| 159 int plugin_fd; | 159 int plugin_fd; |
| 160 IPC::SocketPair(&plugin_fd, &renderer_fd_); | 160 IPC::SocketPair(&plugin_fd, &renderer_fd_); |
| 161 IPC::AddChannelSocket(channel_name(), plugin_fd); | 161 IPC::AddChannelSocket(channel_name(), plugin_fd); |
| 162 #endif | 162 #endif |
| 163 return PluginChannelBase::Init(ipc_message_loop, create_pipe_now); | 163 return PluginChannelBase::Init(ipc_message_loop, create_pipe_now); |
| 164 } | 164 } |
| OLD | NEW |