| 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(TOOLKIT_GTK) | 9 #if defined(TOOLKIT_GTK) |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 ui::SetDefaultX11ErrorHandlers(); | 110 ui::SetDefaultX11ErrorHandlers(); |
| 111 #endif | 111 #endif |
| 112 | 112 |
| 113 PatchNPNFunctions(); | 113 PatchNPNFunctions(); |
| 114 | 114 |
| 115 // Preload the library to avoid loading, unloading then reloading | 115 // Preload the library to avoid loading, unloading then reloading |
| 116 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path, NULL); | 116 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path, NULL); |
| 117 | 117 |
| 118 scoped_refptr<webkit::npapi::PluginLib> plugin( | 118 scoped_refptr<webkit::npapi::PluginLib> plugin( |
| 119 webkit::npapi::PluginLib::CreatePluginLib(plugin_path)); | 119 webkit::npapi::PluginLib::CreatePluginLib(plugin_path)); |
| 120 if (plugin.get()) { | 120 if (plugin) { |
| 121 plugin->NP_Initialize(); | 121 plugin->NP_Initialize(); |
| 122 // For OOP plugins the plugin dll will be unloaded during process shutdown | 122 // For OOP plugins the plugin dll will be unloaded during process shutdown |
| 123 // time. | 123 // time. |
| 124 plugin->set_defer_unload(true); | 124 plugin->set_defer_unload(true); |
| 125 } | 125 } |
| 126 | 126 |
| 127 GetContentClient()->plugin()->PluginProcessStarted( | 127 GetContentClient()->plugin()->PluginProcessStarted( |
| 128 plugin.get() ? plugin->plugin_info().name : string16()); | 128 plugin.get() ? plugin->plugin_info().name : string16()); |
| 129 | 129 |
| 130 GetContentClient()->AddNPAPIPlugins( | 130 GetContentClient()->AddNPAPIPlugins( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 IPC_MESSAGE_UNHANDLED(handled = false) | 163 IPC_MESSAGE_UNHANDLED(handled = false) |
| 164 IPC_END_MESSAGE_MAP() | 164 IPC_END_MESSAGE_MAP() |
| 165 return handled; | 165 return handled; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void PluginThread::OnCreateChannel(int renderer_id, | 168 void PluginThread::OnCreateChannel(int renderer_id, |
| 169 bool incognito) { | 169 bool incognito) { |
| 170 scoped_refptr<PluginChannel> channel(PluginChannel::GetPluginChannel( | 170 scoped_refptr<PluginChannel> channel(PluginChannel::GetPluginChannel( |
| 171 renderer_id, ChildProcess::current()->io_message_loop_proxy())); | 171 renderer_id, ChildProcess::current()->io_message_loop_proxy())); |
| 172 IPC::ChannelHandle channel_handle; | 172 IPC::ChannelHandle channel_handle; |
| 173 if (channel.get()) { | 173 if (channel) { |
| 174 channel_handle.name = channel->channel_handle().name; | 174 channel_handle.name = channel->channel_handle().name; |
| 175 #if defined(OS_POSIX) | 175 #if defined(OS_POSIX) |
| 176 // On POSIX, pass the renderer-side FD. | 176 // On POSIX, pass the renderer-side FD. |
| 177 channel_handle.socket = | 177 channel_handle.socket = |
| 178 base::FileDescriptor(channel->TakeRendererFileDescriptor(), true); | 178 base::FileDescriptor(channel->TakeRendererFileDescriptor(), true); |
| 179 #endif | 179 #endif |
| 180 channel->set_incognito(incognito); | 180 channel->set_incognito(incognito); |
| 181 } | 181 } |
| 182 | 182 |
| 183 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); | 183 Send(new PluginProcessHostMsg_ChannelCreated(channel_handle)); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void PluginThread::OnNotifyRenderersOfPendingShutdown() { | 186 void PluginThread::OnNotifyRenderersOfPendingShutdown() { |
| 187 PluginChannel::NotifyRenderersOfPendingShutdown(); | 187 PluginChannel::NotifyRenderersOfPendingShutdown(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 } // namespace content | 190 } // namespace content |
| OLD | NEW |