| 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/plugin/plugin_thread.h" | 5 #include "content/plugin/plugin_thread.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
| 10 #include <CoreFoundation/CoreFoundation.h> | 10 #include <CoreFoundation/CoreFoundation.h> |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/bind.h" | 16 #include "base/bind.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/lazy_instance.h" | 18 #include "base/lazy_instance.h" |
| 19 #include "base/process/process.h" | 19 #include "base/process/process.h" |
| 20 #include "base/threading/thread_local.h" | 20 #include "base/threading/thread_local.h" |
| 21 #include "content/child/blink_platform_impl.h" | 21 #include "content/child/blink_platform_impl.h" |
| 22 #include "content/child/child_process.h" | 22 #include "content/child/child_process.h" |
| 23 #include "content/child/npapi/npobject_util.h" | |
| 24 #include "content/child/npapi/plugin_lib.h" | 23 #include "content/child/npapi/plugin_lib.h" |
| 25 #include "content/common/plugin_process_messages.h" | 24 #include "content/common/plugin_process_messages.h" |
| 26 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 27 #include "content/public/plugin/content_plugin_client.h" | 26 #include "content/public/plugin/content_plugin_client.h" |
| 28 #include "third_party/WebKit/public/web/WebKit.h" | 27 #include "third_party/WebKit/public/web/WebKit.h" |
| 29 #include "ipc/ipc_channel_handle.h" | 28 #include "ipc/ipc_channel_handle.h" |
| 30 #include "ipc/message_filter.h" | 29 #include "ipc/message_filter.h" |
| 31 | 30 |
| 32 namespace content { | 31 namespace content { |
| 33 | 32 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 66 |
| 68 PluginThread::PluginThread() | 67 PluginThread::PluginThread() |
| 69 : preloaded_plugin_module_(NULL), | 68 : preloaded_plugin_module_(NULL), |
| 70 forcefully_terminate_plugin_process_(false) { | 69 forcefully_terminate_plugin_process_(false) { |
| 71 base::FilePath plugin_path = | 70 base::FilePath plugin_path = |
| 72 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 71 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 73 switches::kPluginPath); | 72 switches::kPluginPath); |
| 74 | 73 |
| 75 lazy_tls.Pointer()->Set(this); | 74 lazy_tls.Pointer()->Set(this); |
| 76 | 75 |
| 77 PatchNPNFunctions(); | |
| 78 | |
| 79 // Preload the library to avoid loading, unloading then reloading | 76 // Preload the library to avoid loading, unloading then reloading |
| 80 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path, NULL); | 77 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path, NULL); |
| 81 | 78 |
| 82 scoped_refptr<PluginLib> plugin(PluginLib::CreatePluginLib(plugin_path)); | 79 scoped_refptr<PluginLib> plugin(PluginLib::CreatePluginLib(plugin_path)); |
| 83 if (plugin.get()) { | 80 if (plugin.get()) { |
| 84 plugin->NP_Initialize(); | 81 plugin->NP_Initialize(); |
| 85 // For OOP plugins the plugin dll will be unloaded during process shutdown | 82 // For OOP plugins the plugin dll will be unloaded during process shutdown |
| 86 // time. | 83 // time. |
| 87 plugin->set_defer_unload(true); | 84 plugin->set_defer_unload(true); |
| 88 } | 85 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 148 } |
| 152 | 149 |
| 153 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); | 150 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); |
| 154 } | 151 } |
| 155 | 152 |
| 156 void PluginThread::OnNotifyRenderersOfPendingShutdown() { | 153 void PluginThread::OnNotifyRenderersOfPendingShutdown() { |
| 157 PluginChannel::NotifyRenderersOfPendingShutdown(); | 154 PluginChannel::NotifyRenderersOfPendingShutdown(); |
| 158 } | 155 } |
| 159 | 156 |
| 160 } // namespace content | 157 } // namespace content |
| OLD | NEW |