Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: chrome/plugin/plugin_thread.cc

Issue 5996003: Revert "Revert 69755 - Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/plugin/plugin_thread.h ('k') | chrome/plugin/webplugin_accelerated_surface_proxy_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/plugin/plugin_thread.h" 5 #include "chrome/plugin/plugin_thread.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(USE_X11) 9 #if defined(USE_X11)
10 #include <gtk/gtk.h> 10 #include <gtk/gtk.h>
(...skipping 11 matching lines...) Expand all
22 #include "chrome/common/child_process.h" 22 #include "chrome/common/child_process.h"
23 #include "chrome/common/chrome_plugin_lib.h" 23 #include "chrome/common/chrome_plugin_lib.h"
24 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/plugin_messages.h" 25 #include "chrome/common/plugin_messages.h"
26 #include "chrome/common/render_messages.h" 26 #include "chrome/common/render_messages.h"
27 #include "chrome/plugin/chrome_plugin_host.h" 27 #include "chrome/plugin/chrome_plugin_host.h"
28 #include "chrome/plugin/npobject_util.h" 28 #include "chrome/plugin/npobject_util.h"
29 #include "chrome/renderer/render_thread.h" 29 #include "chrome/renderer/render_thread.h"
30 #include "ipc/ipc_channel_handle.h" 30 #include "ipc/ipc_channel_handle.h"
31 #include "net/base/net_errors.h" 31 #include "net/base/net_errors.h"
32 #include "webkit/glue/plugins/plugin_lib.h"
33 #include "webkit/glue/webkit_glue.h" 32 #include "webkit/glue/webkit_glue.h"
34 #include "webkit/glue/plugins/webplugin_delegate_impl.h" 33 #include "webkit/plugins/npapi/plugin_lib.h"
34 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
35 35
36 #if defined(TOOLKIT_USES_GTK) 36 #if defined(TOOLKIT_USES_GTK)
37 #include "gfx/gtk_util.h" 37 #include "gfx/gtk_util.h"
38 #endif 38 #endif
39 39
40 #if defined(USE_X11) 40 #if defined(USE_X11)
41 #include "app/x11_util.h" 41 #include "app/x11_util.h"
42 #elif defined(OS_MACOSX) 42 #elif defined(OS_MACOSX)
43 #include "app/l10n_util.h" 43 #include "app/l10n_util.h"
44 #include "base/mac_util.h" 44 #include "base/mac_util.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 x11_util::SetDefaultX11ErrorHandlers(); 79 x11_util::SetDefaultX11ErrorHandlers();
80 #endif 80 #endif
81 81
82 PatchNPNFunctions(); 82 PatchNPNFunctions();
83 83
84 // Preload the library to avoid loading, unloading then reloading 84 // Preload the library to avoid loading, unloading then reloading
85 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path_); 85 preloaded_plugin_module_ = base::LoadNativeLibrary(plugin_path_);
86 86
87 ChromePluginLib::Create(plugin_path_, GetCPBrowserFuncsForPlugin()); 87 ChromePluginLib::Create(plugin_path_, GetCPBrowserFuncsForPlugin());
88 88
89 scoped_refptr<NPAPI::PluginLib> plugin( 89 scoped_refptr<webkit::npapi::PluginLib> plugin(
90 NPAPI::PluginLib::CreatePluginLib(plugin_path_)); 90 webkit::npapi::PluginLib::CreatePluginLib(plugin_path_));
91 if (plugin.get()) { 91 if (plugin.get()) {
92 plugin->NP_Initialize(); 92 plugin->NP_Initialize();
93 93
94 #if defined(OS_MACOSX) 94 #if defined(OS_MACOSX)
95 base::mac::ScopedCFTypeRef<CFStringRef> plugin_name( 95 base::mac::ScopedCFTypeRef<CFStringRef> plugin_name(
96 base::SysUTF16ToCFStringRef(plugin->plugin_info().name)); 96 base::SysUTF16ToCFStringRef(plugin->plugin_info().name));
97 base::mac::ScopedCFTypeRef<CFStringRef> app_name( 97 base::mac::ScopedCFTypeRef<CFStringRef> app_name(
98 base::SysUTF16ToCFStringRef( 98 base::SysUTF16ToCFStringRef(
99 l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME))); 99 l10n_util::GetStringUTF16(IDS_SHORT_PLUGIN_APP_NAME)));
100 base::mac::ScopedCFTypeRef<CFStringRef> process_name( 100 base::mac::ScopedCFTypeRef<CFStringRef> process_name(
101 CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ (%@)"), 101 CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%@ (%@)"),
102 plugin_name.get(), app_name.get())); 102 plugin_name.get(), app_name.get()));
103 mac_util::SetProcessName(process_name); 103 mac_util::SetProcessName(process_name);
104 #endif 104 #endif
105 } 105 }
106 106
107 // Certain plugins, such as flash, steal the unhandled exception filter 107 // Certain plugins, such as flash, steal the unhandled exception filter
108 // thus we never get crash reports when they fault. This call fixes it. 108 // thus we never get crash reports when they fault. This call fixes it.
109 message_loop()->set_exception_restoration(true); 109 message_loop()->set_exception_restoration(true);
110 } 110 }
111 111
112 PluginThread::~PluginThread() { 112 PluginThread::~PluginThread() {
113 if (preloaded_plugin_module_) { 113 if (preloaded_plugin_module_) {
114 base::UnloadNativeLibrary(preloaded_plugin_module_); 114 base::UnloadNativeLibrary(preloaded_plugin_module_);
115 preloaded_plugin_module_ = NULL; 115 preloaded_plugin_module_ = NULL;
116 } 116 }
117 PluginChannelBase::CleanupChannels(); 117 PluginChannelBase::CleanupChannels();
118 NPAPI::PluginLib::UnloadAllPlugins(); 118 webkit::npapi::PluginLib::UnloadAllPlugins();
119 ChromePluginLib::UnloadAllPlugins(); 119 ChromePluginLib::UnloadAllPlugins();
120 120
121 if (webkit_glue::ShouldForcefullyTerminatePluginProcess()) 121 if (webkit_glue::ShouldForcefullyTerminatePluginProcess())
122 base::KillProcess(base::GetCurrentProcessHandle(), 0, /* wait= */ false); 122 base::KillProcess(base::GetCurrentProcessHandle(), 0, /* wait= */ false);
123 123
124 lazy_tls.Pointer()->Set(NULL); 124 lazy_tls.Pointer()->Set(NULL);
125 } 125 }
126 126
127 PluginThread* PluginThread::current() { 127 PluginThread* PluginThread::current() {
128 return lazy_tls.Pointer()->Get(); 128 return lazy_tls.Pointer()->Get();
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 225 }
226 226
227 if (!result || net_error != net::OK) 227 if (!result || net_error != net::OK)
228 return false; 228 return false;
229 229
230 *proxy_list = proxy_result; 230 *proxy_list = proxy_result;
231 return true; 231 return true;
232 } 232 }
233 233
234 } // namespace webkit_glue 234 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « chrome/plugin/plugin_thread.h ('k') | chrome/plugin/webplugin_accelerated_surface_proxy_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698