diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-24 21:16:14 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-24 21:16:14 +0000 |
commit | f6422553a95c2548f4eda8eb56cef5c6fa1cb55b (patch) | |
tree | 2197a382a0ff5b10cbba89f0d70725a31d3a713e | |
parent | c42ff0c8d658e10a63fda5c94c733fc7afa83869 (diff) | |
download | chromium_src-f6422553a95c2548f4eda8eb56cef5c6fa1cb55b.zip chromium_src-f6422553a95c2548f4eda8eb56cef5c6fa1cb55b.tar.gz chromium_src-f6422553a95c2548f4eda8eb56cef5c6fa1cb55b.tar.bz2 |
linux: call g_thread_init() at relevant startup points
According to glib docs, we need to do this if it's at all possible
for us to hit glib on multiple threads. This may be happening
when we grab plugin metadata from the file thread.
Rather than explicitly depending on gthread all over the place,
just put it in with the GTK dep (since anywhere we're using GTK
we ought to init gthread).
(Note that this is *not* initializing the GDK locking system.)
BUG=18957
Review URL: http://codereview.chromium.org/174264
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24148 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/test_suite.h | 1 | ||||
-rw-r--r-- | build/linux/system.gyp | 23 | ||||
-rw-r--r-- | chrome/app/chrome_dll_main.cc | 1 | ||||
-rw-r--r-- | chrome/chrome.gyp | 2 | ||||
-rw-r--r-- | chrome/plugin/plugin_thread.cc | 1 |
5 files changed, 6 insertions, 22 deletions
diff --git a/base/test_suite.h b/base/test_suite.h index 352c0b8..236c3ed 100644 --- a/base/test_suite.h +++ b/base/test_suite.h @@ -41,6 +41,7 @@ class TestSuite { CommandLine::Init(argc, argv); testing::InitGoogleTest(&argc, argv); #if defined(OS_LINUX) + g_thread_init(NULL); gtk_init_check(&argc, &argv); #endif // Don't add additional code to this constructor. Instead add it to diff --git a/build/linux/system.gyp b/build/linux/system.gyp index 68b52be..e10c905 100644 --- a/build/linux/system.gyp +++ b/build/linux/system.gyp @@ -9,15 +9,15 @@ 'type': 'settings', 'direct_dependent_settings': { 'cflags': [ - '<!@(pkg-config --cflags gtk+-2.0)', + '<!@(pkg-config --cflags gtk+-2.0 gthread-2.0)', ], }, 'link_settings': { 'ldflags': [ - '<!@(pkg-config --libs-only-L --libs-only-other gtk+-2.0)', + '<!@(pkg-config --libs-only-L --libs-only-other gtk+-2.0 gthread-2.0)', ], 'libraries': [ - '<!@(pkg-config --libs-only-l gtk+-2.0)', + '<!@(pkg-config --libs-only-l gtk+-2.0 gthread-2.0)', ], }, }, @@ -107,23 +107,6 @@ }, }, { - 'target_name': 'gthread', - 'type': 'settings', - 'direct_dependent_settings': { - 'cflags': [ - '<!@(pkg-config --cflags gthread-2.0)', - ], - }, - 'link_settings': { - 'ldflags': [ - '<!@(pkg-config --libs-only-L --libs-only-other gthread-2.0)', - ], - 'libraries': [ - '<!@(pkg-config --libs-only-l gthread-2.0)', - ], - }, - }, - { 'target_name': 'x11', 'type': 'settings', 'direct_dependent_settings': { diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc index 64f5ce53..8bacd59 100644 --- a/chrome/app/chrome_dll_main.cc +++ b/chrome/app/chrome_dll_main.cc @@ -552,6 +552,7 @@ int ChromeMain(int argc, const char** argv) { #endif } else if (process_type.empty()) { #if defined(OS_LINUX) + 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 diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 1b59fd8..39992b4 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -3037,8 +3037,6 @@ '<@(chromium_dependencies)', # Needed for chrome_dll_main.cc #include of gtk/gtk.h '../build/linux/system.gyp:gtk', - # Needed for chrome_dll_main.cc use of g_thread_init - '../build/linux/system.gyp:gthread', ], 'sources': [ 'app/chrome_dll_main.cc', diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc index ae90e1a..307cbaa 100644 --- a/chrome/plugin/plugin_thread.cc +++ b/chrome/plugin/plugin_thread.cc @@ -35,6 +35,7 @@ PluginThread::PluginThread() { // XEmbed plugins assume they are hosted in a Gtk application, so we need // to initialize Gtk in the plugin process. + g_thread_init(NULL); const std::vector<std::string>& args = CommandLine::ForCurrentProcess()->argv(); int argc = args.size(); |