| 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/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| 11 #include "content/common/child_process.h" | 11 #include "content/common/child_process.h" |
| 12 #include "content/ppapi_plugin/broker_process_dispatcher.h" | 12 #include "content/ppapi_plugin/broker_process_dispatcher.h" |
| 13 #include "content/ppapi_plugin/plugin_process_dispatcher.h" | 13 #include "content/ppapi_plugin/plugin_process_dispatcher.h" |
| 14 #include "content/ppapi_plugin/ppapi_webkit_thread.h" |
| 14 #include "ipc/ipc_channel_handle.h" | 15 #include "ipc/ipc_channel_handle.h" |
| 15 #include "ipc/ipc_sync_channel.h" | 16 #include "ipc/ipc_sync_channel.h" |
| 16 #include "ppapi/c/pp_errors.h" | 17 #include "ppapi/c/pp_errors.h" |
| 17 #include "ppapi/c/ppp.h" | 18 #include "ppapi/c/ppp.h" |
| 18 #include "ppapi/proxy/ppapi_messages.h" | 19 #include "ppapi/proxy/ppapi_messages.h" |
| 20 #include "webkit/plugins/ppapi/webkit_forwarding_impl.h" |
| 19 | 21 |
| 20 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 21 #include "sandbox/src/sandbox.h" | 23 #include "sandbox/src/sandbox.h" |
| 22 #endif | 24 #endif |
| 23 | 25 |
| 24 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
| 25 extern sandbox::TargetServices* g_target_services; | 27 extern sandbox::TargetServices* g_target_services; |
| 26 #else | 28 #else |
| 27 extern void* g_target_services; | 29 extern void* g_target_services; |
| 28 #endif | 30 #endif |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 75 } |
| 74 | 76 |
| 75 base::WaitableEvent* PpapiThread::GetShutdownEvent() { | 77 base::WaitableEvent* PpapiThread::GetShutdownEvent() { |
| 76 return ChildProcess::current()->GetShutDownEvent(); | 78 return ChildProcess::current()->GetShutDownEvent(); |
| 77 } | 79 } |
| 78 | 80 |
| 79 std::set<PP_Instance>* PpapiThread::GetGloballySeenInstanceIDSet() { | 81 std::set<PP_Instance>* PpapiThread::GetGloballySeenInstanceIDSet() { |
| 80 return &globally_seen_instance_ids_; | 82 return &globally_seen_instance_ids_; |
| 81 } | 83 } |
| 82 | 84 |
| 85 pp::shared_impl::WebKitForwarding* PpapiThread::GetWebKitForwarding() { |
| 86 if (!webkit_forwarding_.get()) |
| 87 webkit_forwarding_.reset(new webkit::ppapi::WebKitForwardingImpl); |
| 88 return webkit_forwarding_.get(); |
| 89 } |
| 90 |
| 91 void PpapiThread::PostToWebKitThread(const tracked_objects::Location& from_here, |
| 92 const base::Closure& task) { |
| 93 if (!webkit_thread_.get()) |
| 94 webkit_thread_.reset(new PpapiWebKitThread); |
| 95 webkit_thread_->PostTask(from_here, task); |
| 96 } |
| 97 |
| 83 void PpapiThread::OnMsgLoadPlugin(const FilePath& path) { | 98 void PpapiThread::OnMsgLoadPlugin(const FilePath& path) { |
| 84 base::ScopedNativeLibrary library(base::LoadNativeLibrary(path, NULL)); | 99 base::ScopedNativeLibrary library(base::LoadNativeLibrary(path, NULL)); |
| 85 | 100 |
| 86 #if defined(OS_WIN) | 101 #if defined(OS_WIN) |
| 87 // Once we lower the token the sandbox is locked down and no new modules | 102 // Once we lower the token the sandbox is locked down and no new modules |
| 88 // can be loaded. TODO(cpu): consider changing to the loading style of | 103 // can be loaded. TODO(cpu): consider changing to the loading style of |
| 89 // regular plugins. | 104 // regular plugins. |
| 90 if (g_target_services) | 105 if (g_target_services) |
| 91 g_target_services->LowerToken(); | 106 g_target_services->LowerToken(); |
| 92 #endif | 107 #endif |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 #if defined(OS_POSIX) | 209 #if defined(OS_POSIX) |
| 195 // On POSIX, pass the renderer-side FD. | 210 // On POSIX, pass the renderer-side FD. |
| 196 handle->socket = base::FileDescriptor(::dup(dispatcher->GetRendererFD()), | 211 handle->socket = base::FileDescriptor(::dup(dispatcher->GetRendererFD()), |
| 197 true); | 212 true); |
| 198 #endif | 213 #endif |
| 199 | 214 |
| 200 // From here, the dispatcher will manage its own lifetime according to the | 215 // From here, the dispatcher will manage its own lifetime according to the |
| 201 // lifetime of the attached channel. | 216 // lifetime of the attached channel. |
| 202 return true; | 217 return true; |
| 203 } | 218 } |
| OLD | NEW |