| 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 #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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 231 |
| 232 library_.Reset(library.Release()); | 232 library_.Reset(library.Release()); |
| 233 } | 233 } |
| 234 | 234 |
| 235 void PpapiThread::OnMsgCreateChannel(base::ProcessHandle host_process_handle, | 235 void PpapiThread::OnMsgCreateChannel(base::ProcessHandle host_process_handle, |
| 236 int renderer_id) { | 236 int renderer_id) { |
| 237 IPC::ChannelHandle channel_handle; | 237 IPC::ChannelHandle channel_handle; |
| 238 if (!library_.is_valid() || // Plugin couldn't be loaded. | 238 if (!library_.is_valid() || // Plugin couldn't be loaded. |
| 239 !SetupRendererChannel(host_process_handle, renderer_id, | 239 !SetupRendererChannel(host_process_handle, renderer_id, |
| 240 &channel_handle)) { | 240 &channel_handle)) { |
| 241 // TODO(xhwang): Add CHECK to investigate the root cause of | |
| 242 // crbug.com/103957. Will remove after the bug is fixed. | |
| 243 CHECK(!is_broker_ || library_.is_valid()); | |
| 244 Send(new PpapiHostMsg_ChannelCreated(IPC::ChannelHandle())); | 241 Send(new PpapiHostMsg_ChannelCreated(IPC::ChannelHandle())); |
| 245 return; | 242 return; |
| 246 } | 243 } |
| 247 | 244 |
| 248 Send(new PpapiHostMsg_ChannelCreated(channel_handle)); | 245 Send(new PpapiHostMsg_ChannelCreated(channel_handle)); |
| 249 } | 246 } |
| 250 | 247 |
| 251 void PpapiThread::OnMsgSetNetworkState(bool online) { | 248 void PpapiThread::OnMsgSetNetworkState(bool online) { |
| 252 if (!get_plugin_interface_) | 249 if (!get_plugin_interface_) |
| 253 return; | 250 return; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 delete dispatcher; | 300 delete dispatcher; |
| 304 return false; | 301 return false; |
| 305 } | 302 } |
| 306 | 303 |
| 307 handle->name = plugin_handle.name; | 304 handle->name = plugin_handle.name; |
| 308 #if defined(OS_POSIX) | 305 #if defined(OS_POSIX) |
| 309 // On POSIX, transfer ownership of the renderer-side (client) FD. | 306 // On POSIX, transfer ownership of the renderer-side (client) FD. |
| 310 // This ensures this process will be notified when it is closed even if a | 307 // This ensures this process will be notified when it is closed even if a |
| 311 // connection is not established. | 308 // connection is not established. |
| 312 handle->socket = base::FileDescriptor(dispatcher->TakeRendererFD(), true); | 309 handle->socket = base::FileDescriptor(dispatcher->TakeRendererFD(), true); |
| 313 // Check the validity of fd for bug investigation. Remove after fixed. | |
| 314 // See for details: crbug.com/103957. | |
| 315 CHECK_NE(-1, handle->socket.fd); | |
| 316 if (handle->socket.fd == -1) | 310 if (handle->socket.fd == -1) |
| 317 return false; | 311 return false; |
| 318 #endif | 312 #endif |
| 319 | 313 |
| 320 // From here, the dispatcher will manage its own lifetime according to the | 314 // From here, the dispatcher will manage its own lifetime according to the |
| 321 // lifetime of the attached channel. | 315 // lifetime of the attached channel. |
| 322 return true; | 316 return true; |
| 323 } | 317 } |
| 324 | 318 |
| 325 void PpapiThread::SavePluginName(const FilePath& path) { | 319 void PpapiThread::SavePluginName(const FilePath& path) { |
| 326 ppapi::proxy::PluginGlobals::Get()->set_plugin_name( | 320 ppapi::proxy::PluginGlobals::Get()->set_plugin_name( |
| 327 path.BaseName().AsUTF8Unsafe()); | 321 path.BaseName().AsUTF8Unsafe()); |
| 328 } | 322 } |
| OLD | NEW |