OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 PluginThread::PluginThread() | 28 PluginThread::PluginThread() |
29 : preloaded_plugin_module_(NULL) { | 29 : preloaded_plugin_module_(NULL) { |
30 plugin_path_ = FilePath::FromWStringHack( | 30 plugin_path_ = FilePath::FromWStringHack( |
31 CommandLine::ForCurrentProcess()->GetSwitchValue(switches::kPluginPath)); | 31 CommandLine::ForCurrentProcess()->GetSwitchValue(switches::kPluginPath)); |
32 | 32 |
33 lazy_tls.Pointer()->Set(this); | 33 lazy_tls.Pointer()->Set(this); |
34 #if defined(OS_LINUX) | 34 #if defined(OS_LINUX) |
35 { | 35 { |
36 // XEmbed plugins assume they are hosted in a Gtk application, so we need | 36 // XEmbed plugins assume they are hosted in a Gtk application, so we need |
37 // to initialize Gtk in the plugin process. | 37 // to initialize Gtk in the plugin process. |
| 38 g_thread_init(NULL); |
38 const std::vector<std::string>& args = | 39 const std::vector<std::string>& args = |
39 CommandLine::ForCurrentProcess()->argv(); | 40 CommandLine::ForCurrentProcess()->argv(); |
40 int argc = args.size(); | 41 int argc = args.size(); |
41 scoped_array<char *> argv(new char *[argc + 1]); | 42 scoped_array<char *> argv(new char *[argc + 1]); |
42 for (size_t i = 0; i < args.size(); ++i) { | 43 for (size_t i = 0; i < args.size(); ++i) { |
43 // TODO(piman@google.com): can gtk_init modify argv? Just being safe | 44 // TODO(piman@google.com): can gtk_init modify argv? Just being safe |
44 // here. | 45 // here. |
45 argv[i] = strdup(args[i].c_str()); | 46 argv[i] = strdup(args[i].c_str()); |
46 } | 47 } |
47 argv[argc] = NULL; | 48 argv[argc] = NULL; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 193 } |
193 | 194 |
194 if (!result || net_error != net::OK) | 195 if (!result || net_error != net::OK) |
195 return false; | 196 return false; |
196 | 197 |
197 *proxy_list = proxy_result; | 198 *proxy_list = proxy_result; |
198 return true; | 199 return true; |
199 } | 200 } |
200 | 201 |
201 } // namespace webkit_glue | 202 } // namespace webkit_glue |
OLD | NEW |