diff options
author | jorgelo@chromium.org <jorgelo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-10 00:56:07 +0000 |
---|---|---|
committer | jorgelo@chromium.org <jorgelo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-10 00:56:07 +0000 |
commit | ae53fa9b3e5b2b7b64150eeb38a9a36fc27a4c12 (patch) | |
tree | 39b0d7e59e7950d2842fefc8c8c112e82a0eb587 /content/utility | |
parent | 6f3c13c94a60a3064d2c93e939ce1e75461be301 (diff) | |
download | chromium_src-ae53fa9b3e5b2b7b64150eeb38a9a36fc27a4c12.zip chromium_src-ae53fa9b3e5b2b7b64150eeb38a9a36fc27a4c12.tar.gz chromium_src-ae53fa9b3e5b2b7b64150eeb38a9a36fc27a4c12.tar.bz2 |
Utility process: move GTK initialization to the plugin loading code path.
Since GTK initialization loads shared libraries and accesses
the file system, having this code present in every code path
that uses the utility process would prevent us from sandboxing
the uses of the utility process that don't access the filesystem
themselves.
Moreover, since GTK initialization is only used for plugin loading,
which cannot be sandboxed, there is no harm in moving it to the
plugin loading path. We do check that the GTK thread system has not
already been initialized (only needed for glib < 2.24):
http://developer.gnome.org/glib/2.28/glib-Threads.html#g-thread-init
BUG=93109
TEST=Similar to issue 8774048, having libtotem plugins installed,
go to about:plugins and check that they are present.
Review URL: http://codereview.chromium.org/8870005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113904 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/utility')
-rw-r--r-- | content/utility/utility_thread_impl.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/content/utility/utility_thread_impl.cc b/content/utility/utility_thread_impl.cc index c979c91..d43e531 100644 --- a/content/utility/utility_thread_impl.cc +++ b/content/utility/utility_thread_impl.cc @@ -44,13 +44,6 @@ UtilityThreadImpl::UtilityThreadImpl() webkit_platform_support_.reset(new content::WebKitPlatformSupportImpl); WebKit::initialize(webkit_platform_support_.get()); content::GetContentClient()->utility()->UtilityThreadStarted(); - - // On Linux, some plugins expect the browser to have loaded glib/gtk. Do that - // before attempting to call into the plugin. -#if defined(TOOLKIT_USES_GTK) - g_thread_init(NULL); - gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); -#endif } UtilityThreadImpl::~UtilityThreadImpl() { @@ -141,6 +134,14 @@ void UtilityThreadImpl::OnLoadPlugins( webkit::npapi::PluginList* plugin_list = webkit::npapi::PluginList::Singleton(); + // On Linux, some plugins expect the browser to have loaded glib/gtk. Do that + // before attempting to call into the plugin. +#if defined(TOOLKIT_USES_GTK) + CHECK(!g_thread_get_initialized()); + g_thread_init(NULL); + gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); +#endif + for (size_t i = 0; i < plugin_paths.size(); ++i) { ScopedVector<webkit::npapi::PluginGroup> plugin_groups; plugin_list->LoadPlugin(plugin_paths[i], &plugin_groups); |