| 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" |
| 11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 13 #include "content/common/child_process.h" | 13 #include "content/common/child_process.h" |
| 14 #include "content/common/content_switches.h" | 14 #include "content/common/content_switches.h" |
| 15 #include "content/common/sandbox_init_wrapper.h" | 15 #include "content/common/sandbox_init_wrapper.h" |
| 16 #include "content/ppapi_plugin/broker_process_dispatcher.h" | 16 #include "content/ppapi_plugin/broker_process_dispatcher.h" |
| 17 #include "content/ppapi_plugin/plugin_process_dispatcher.h" | 17 #include "content/ppapi_plugin/plugin_process_dispatcher.h" |
| 18 #include "content/ppapi_plugin/ppapi_webkit_thread.h" | 18 #include "content/ppapi_plugin/ppapi_webkit_thread.h" |
| 19 #include "ipc/ipc_channel_handle.h" | 19 #include "ipc/ipc_channel_handle.h" |
| 20 #include "ipc/ipc_sync_channel.h" | 20 #include "ipc/ipc_sync_channel.h" |
| 21 #include "ppapi/c/dev/ppp_network_state_dev.h" | 21 #include "ppapi/c/dev/ppp_network_state_dev.h" |
| 22 #include "ppapi/c/pp_errors.h" | 22 #include "ppapi/c/pp_errors.h" |
| 23 #include "ppapi/c/ppp.h" | 23 #include "ppapi/c/ppp.h" |
| 24 #include "ppapi/proxy/ppapi_messages.h" | 24 #include "ppapi/proxy/ppapi_messages.h" |
| 25 #include "ppapi/proxy/interface_list.h" |
| 25 #include "webkit/plugins/ppapi/webkit_forwarding_impl.h" | 26 #include "webkit/plugins/ppapi/webkit_forwarding_impl.h" |
| 26 | 27 |
| 27 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 28 #include "sandbox/src/sandbox.h" | 29 #include "sandbox/src/sandbox.h" |
| 29 #endif | 30 #endif |
| 30 | 31 |
| 31 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
| 32 extern sandbox::TargetServices* g_target_services; | 33 extern sandbox::TargetServices* g_target_services; |
| 33 #else | 34 #else |
| 34 extern void* g_target_services; | 35 extern void* g_target_services; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // Get the InitializeModule function (required). | 203 // Get the InitializeModule function (required). |
| 203 ppapi::proxy::Dispatcher::InitModuleFunc init_module = | 204 ppapi::proxy::Dispatcher::InitModuleFunc init_module = |
| 204 reinterpret_cast<ppapi::proxy::Dispatcher::InitModuleFunc>( | 205 reinterpret_cast<ppapi::proxy::Dispatcher::InitModuleFunc>( |
| 205 library.GetFunctionPointer("PPP_InitializeModule")); | 206 library.GetFunctionPointer("PPP_InitializeModule")); |
| 206 if (!init_module) { | 207 if (!init_module) { |
| 207 LOG(WARNING) << "No PPP_InitializeModule in plugin library"; | 208 LOG(WARNING) << "No PPP_InitializeModule in plugin library"; |
| 208 return; | 209 return; |
| 209 } | 210 } |
| 210 int32_t init_error = init_module( | 211 int32_t init_error = init_module( |
| 211 local_pp_module_, | 212 local_pp_module_, |
| 212 &ppapi::proxy::PluginDispatcher::GetInterfaceFromDispatcher); | 213 &ppapi::proxy::PluginDispatcher::GetBrowserInterface); |
| 213 if (init_error != PP_OK) { | 214 if (init_error != PP_OK) { |
| 214 LOG(WARNING) << "InitModule failed with error " << init_error; | 215 LOG(WARNING) << "InitModule failed with error " << init_error; |
| 215 return; | 216 return; |
| 216 } | 217 } |
| 217 } | 218 } |
| 218 | 219 |
| 219 library_.Reset(library.Release()); | 220 library_.Reset(library.Release()); |
| 220 } | 221 } |
| 221 | 222 |
| 222 void PpapiThread::OnMsgCreateChannel(base::ProcessHandle host_process_handle, | 223 void PpapiThread::OnMsgCreateChannel(base::ProcessHandle host_process_handle, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 #if defined(OS_POSIX) | 293 #if defined(OS_POSIX) |
| 293 // On POSIX, pass the renderer-side FD. | 294 // On POSIX, pass the renderer-side FD. |
| 294 handle->socket = base::FileDescriptor(::dup(dispatcher->GetRendererFD()), | 295 handle->socket = base::FileDescriptor(::dup(dispatcher->GetRendererFD()), |
| 295 true); | 296 true); |
| 296 #endif | 297 #endif |
| 297 | 298 |
| 298 // From here, the dispatcher will manage its own lifetime according to the | 299 // From here, the dispatcher will manage its own lifetime according to the |
| 299 // lifetime of the attached channel. | 300 // lifetime of the attached channel. |
| 300 return true; | 301 return true; |
| 301 } | 302 } |
| OLD | NEW |