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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker) | 54 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker) |
55 : is_broker_(is_broker), | 55 : is_broker_(is_broker), |
56 connect_instance_func_(NULL), | 56 connect_instance_func_(NULL), |
57 local_pp_module_( | 57 local_pp_module_( |
58 base::RandInt(0, std::numeric_limits<PP_Module>::max())), | 58 base::RandInt(0, std::numeric_limits<PP_Module>::max())), |
59 next_plugin_dispatcher_id_(1) { | 59 next_plugin_dispatcher_id_(1) { |
60 ppapi::proxy::PluginGlobals* globals = ppapi::proxy::PluginGlobals::Get(); | 60 ppapi::proxy::PluginGlobals* globals = ppapi::proxy::PluginGlobals::Get(); |
61 globals->set_plugin_proxy_delegate(this); | 61 globals->set_plugin_proxy_delegate(this); |
62 globals->set_command_line( | 62 globals->set_command_line( |
63 command_line.GetSwitchValueASCII(switches::kPpapiFlashArgs)); | 63 command_line.GetSwitchValueASCII(switches::kPpapiFlashArgs)); |
64 globals->set_enable_threading( | 64 if (command_line.HasSwitch(switches::kDisablePepperThreading)) { |
65 command_line.HasSwitch(switches::kEnablePepperThreading)); | 65 globals->set_enable_threading(false); |
| 66 } else if (command_line.HasSwitch(switches::kEnablePepperThreading)) { |
| 67 globals->set_enable_threading(true); |
| 68 } else { |
| 69 globals->set_enable_threading(false); |
| 70 } |
66 | 71 |
67 webkit_platform_support_.reset(new PpapiWebKitPlatformSupportImpl); | 72 webkit_platform_support_.reset(new PpapiWebKitPlatformSupportImpl); |
68 WebKit::initialize(webkit_platform_support_.get()); | 73 WebKit::initialize(webkit_platform_support_.get()); |
69 } | 74 } |
70 | 75 |
71 PpapiThread::~PpapiThread() { | 76 PpapiThread::~PpapiThread() { |
72 ppapi::proxy::PluginGlobals::Get()->set_plugin_proxy_delegate(NULL); | 77 ppapi::proxy::PluginGlobals::Get()->set_plugin_proxy_delegate(NULL); |
73 if (plugin_entry_points_.shutdown_module) | 78 if (plugin_entry_points_.shutdown_module) |
74 plugin_entry_points_.shutdown_module(); | 79 plugin_entry_points_.shutdown_module(); |
75 WebKit::shutdown(); | 80 WebKit::shutdown(); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 425 |
421 // plugin() is NULL when in-process. Which is fine, because this is | 426 // plugin() is NULL when in-process. Which is fine, because this is |
422 // just a hook for setting the process name. | 427 // just a hook for setting the process name. |
423 if (GetContentClient()->plugin()) { | 428 if (GetContentClient()->plugin()) { |
424 GetContentClient()->plugin()->PluginProcessStarted( | 429 GetContentClient()->plugin()->PluginProcessStarted( |
425 path.BaseName().RemoveExtension().LossyDisplayName()); | 430 path.BaseName().RemoveExtension().LossyDisplayName()); |
426 } | 431 } |
427 } | 432 } |
428 | 433 |
429 } // namespace content | 434 } // namespace content |
OLD | NEW |