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 17 matching lines...) Expand all Loading... |
28 #include "ppapi/c/pp_errors.h" | 28 #include "ppapi/c/pp_errors.h" |
29 #include "ppapi/c/ppp.h" | 29 #include "ppapi/c/ppp.h" |
30 #include "ppapi/proxy/plugin_globals.h" | 30 #include "ppapi/proxy/plugin_globals.h" |
31 #include "ppapi/proxy/ppapi_messages.h" | 31 #include "ppapi/proxy/ppapi_messages.h" |
32 #include "ppapi/proxy/interface_list.h" | 32 #include "ppapi/proxy/interface_list.h" |
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
34 #include "ui/base/ui_base_switches.h" | 34 #include "ui/base/ui_base_switches.h" |
35 #include "webkit/plugins/plugin_switches.h" | 35 #include "webkit/plugins/plugin_switches.h" |
36 | 36 |
37 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
| 38 #include "base/win/win_util.h" |
38 #include "sandbox/win/src/sandbox.h" | 39 #include "sandbox/win/src/sandbox.h" |
39 #elif defined(OS_MACOSX) | 40 #elif defined(OS_MACOSX) |
40 #include "content/common/sandbox_init_mac.h" | 41 #include "content/common/sandbox_init_mac.h" |
41 #endif | 42 #endif |
42 | 43 |
43 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
44 extern sandbox::TargetServices* g_target_services; | 45 extern sandbox::TargetServices* g_target_services; |
45 #else | 46 #else |
46 extern void* g_target_services; | 47 extern void* g_target_services; |
47 #endif | 48 #endif |
(...skipping 23 matching lines...) Expand all Loading... |
71 | 72 |
72 webkit_platform_support_.reset(new PpapiWebKitPlatformSupportImpl); | 73 webkit_platform_support_.reset(new PpapiWebKitPlatformSupportImpl); |
73 WebKit::initialize(webkit_platform_support_.get()); | 74 WebKit::initialize(webkit_platform_support_.get()); |
74 } | 75 } |
75 | 76 |
76 PpapiThread::~PpapiThread() { | 77 PpapiThread::~PpapiThread() { |
77 ppapi::proxy::PluginGlobals::Get()->set_plugin_proxy_delegate(NULL); | 78 ppapi::proxy::PluginGlobals::Get()->set_plugin_proxy_delegate(NULL); |
78 if (plugin_entry_points_.shutdown_module) | 79 if (plugin_entry_points_.shutdown_module) |
79 plugin_entry_points_.shutdown_module(); | 80 plugin_entry_points_.shutdown_module(); |
80 WebKit::shutdown(); | 81 WebKit::shutdown(); |
| 82 |
| 83 #if defined(OS_WIN) |
| 84 if (permissions_.HasPermission(ppapi::PERMISSION_FLASH)) |
| 85 base::win::SetShouldCrashOnProcessDetach(false); |
| 86 #endif |
81 } | 87 } |
82 | 88 |
83 bool PpapiThread::Send(IPC::Message* msg) { | 89 bool PpapiThread::Send(IPC::Message* msg) { |
84 // Allow access from multiple threads. | 90 // Allow access from multiple threads. |
85 if (MessageLoop::current() == message_loop()) | 91 if (MessageLoop::current() == message_loop()) |
86 return ChildThread::Send(msg); | 92 return ChildThread::Send(msg); |
87 | 93 |
88 return sync_message_filter()->Send(msg); | 94 return sync_message_filter()->Send(msg); |
89 } | 95 } |
90 | 96 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 reinterpret_cast<PP_InitializeModule_Func>( | 270 reinterpret_cast<PP_InitializeModule_Func>( |
265 library.GetFunctionPointer("PPP_InitializeModule")); | 271 library.GetFunctionPointer("PPP_InitializeModule")); |
266 if (!plugin_entry_points_.initialize_module) { | 272 if (!plugin_entry_points_.initialize_module) { |
267 LOG(WARNING) << "No PPP_InitializeModule in plugin library"; | 273 LOG(WARNING) << "No PPP_InitializeModule in plugin library"; |
268 return; | 274 return; |
269 } | 275 } |
270 } | 276 } |
271 } | 277 } |
272 | 278 |
273 #if defined(OS_WIN) | 279 #if defined(OS_WIN) |
| 280 // If code subsequently tries to exit using abort(), force a crash (since |
| 281 // otherwise these would be silent terminations and fly under the radar). |
| 282 base::win::SetAbortBehaviorForCrashReporting(); |
| 283 if (permissions.HasPermission(ppapi::PERMISSION_FLASH)) { |
| 284 // Force a crash for exit(), _exit(), or ExitProcess(), but only do that for |
| 285 // Pepper Flash. |
| 286 base::win::SetShouldCrashOnProcessDetach(true); |
| 287 } |
| 288 |
274 // Once we lower the token the sandbox is locked down and no new modules | 289 // Once we lower the token the sandbox is locked down and no new modules |
275 // can be loaded. TODO(cpu): consider changing to the loading style of | 290 // can be loaded. TODO(cpu): consider changing to the loading style of |
276 // regular plugins. | 291 // regular plugins. |
277 if (g_target_services) { | 292 if (g_target_services) { |
278 // Cause advapi32 to load before the sandbox is turned on. | 293 // Cause advapi32 to load before the sandbox is turned on. |
279 unsigned int dummy_rand; | 294 unsigned int dummy_rand; |
280 rand_s(&dummy_rand); | 295 rand_s(&dummy_rand); |
281 // Warm up language subsystems before the sandbox is turned on. | 296 // Warm up language subsystems before the sandbox is turned on. |
282 ::GetUserDefaultLangID(); | 297 ::GetUserDefaultLangID(); |
283 ::GetUserDefaultLCID(); | 298 ::GetUserDefaultLCID(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 438 |
424 // plugin() is NULL when in-process. Which is fine, because this is | 439 // plugin() is NULL when in-process. Which is fine, because this is |
425 // just a hook for setting the process name. | 440 // just a hook for setting the process name. |
426 if (GetContentClient()->plugin()) { | 441 if (GetContentClient()->plugin()) { |
427 GetContentClient()->plugin()->PluginProcessStarted( | 442 GetContentClient()->plugin()->PluginProcessStarted( |
428 path.BaseName().RemoveExtension().LossyDisplayName()); | 443 path.BaseName().RemoveExtension().LossyDisplayName()); |
429 } | 444 } |
430 } | 445 } |
431 | 446 |
432 } // namespace content | 447 } // namespace content |
OLD | NEW |