diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-05 02:53:29 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-05 02:53:29 +0000 |
commit | 4bb85b96cb632adf6d609a08e0f07961baab3c54 (patch) | |
tree | 9c08783237263d1fc799030d13d67ea2dfe86783 /content/browser | |
parent | ba81d6c0e8c21af0be2cef1cc0e9965f049c85a3 (diff) | |
download | chromium_src-4bb85b96cb632adf6d609a08e0f07961baab3c54.zip chromium_src-4bb85b96cb632adf6d609a08e0f07961baab3c54.tar.gz chromium_src-4bb85b96cb632adf6d609a08e0f07961baab3c54.tar.bz2 |
Remove calls to g_thread_init().
Linux CPU profiles indicate that at least 2.7% of CPU usage is spent in glib atomic operations. This used to be necessary in the browser process due to loading plugins which may invoke gtk/glib. Plugin loading has been moved out of process now, so this should no longer be necessary. I also removed dbus_g_thread_init() which *should* be safe too, although it's possible that we have unknown dbus-glib use off the UI thread.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/8474012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108767 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r-- | content/browser/browser_main_loop.cc | 15 | ||||
-rw-r--r-- | content/browser/plugin_service.cc | 2 |
2 files changed, 2 insertions, 15 deletions
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 95f3de0..9045416 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -306,15 +306,6 @@ void BrowserMainLoop::InitializeToolkit() { // TODO(stevenjb): Move platform specific code into platform specific Parts // (Need to add InitializeToolkit stage to BrowserParts). #if defined(OS_LINUX) - // We want to call g_thread_init(), but in some codepaths (tests) it - // is possible it has already been called. In older versions of - // GTK, it is an error to call g_thread_init twice; unfortunately, - // the API to tell whether it has been called already was also only - // added in a newer version of GTK! Thankfully, this non-intuitive - // check is actually equivalent and sufficient to work around the - // error. - if (!g_thread_supported()) - g_thread_init(NULL); // Glib type system initialization. Needed at least for gconf, // used in net/proxy/proxy_config_service_linux.cc. Most likely // this is superfluous as gtk_init() ought to do this. It's @@ -322,12 +313,6 @@ void BrowserMainLoop::InitializeToolkit() { // requirement for gconf. g_type_init(); -#if defined(OS_CHROMEOS) - // ChromeOS still uses dbus-glib, so initialize its threading here. - // TODO(satorux, stevenjb): remove this once it is no longer needed. - dbus_g_thread_init(); -#endif - #if !defined(USE_AURA) gfx::GtkInitFromCommandLine(parameters_.command_line); #endif diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service.cc index 7d2c811..b59c64e 100644 --- a/content/browser/plugin_service.cc +++ b/content/browser/plugin_service.cc @@ -511,6 +511,8 @@ void PluginService::GetPlugins(const GetPluginsCallback& callback) { target_loop->PostTask(FROM_HERE, base::Bind(&RunGetPluginsCallback, callback, cached_plugins)); } else { + // If we switch back to loading plugins in process, then we need to make + // sure g_thread_init() gets called since plugins may call glib at load. if (!plugin_loader_.get()) plugin_loader_ = new PluginLoaderPosix; BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |