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