summaryrefslogtreecommitdiffstats
path: root/ui/gfx/gtk_util.cc
diff options
context:
space:
mode:
authorcevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 20:07:28 +0000
committercevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 20:07:28 +0000
commit74ab7dd14936d25806a057a5ce95d65390c1673f (patch)
tree15c6889b35cee2f58a8d37b29d1213c0a97476c7 /ui/gfx/gtk_util.cc
parent216f979ec24d74984b326eae7e9fa55f28515b0f (diff)
downloadchromium_src-74ab7dd14936d25806a057a5ce95d65390c1673f.zip
chromium_src-74ab7dd14936d25806a057a5ce95d65390c1673f.tar.gz
chromium_src-74ab7dd14936d25806a057a5ce95d65390c1673f.tar.bz2
Use gdk_init() instead of gtk_init() to open the display. It's much lighter and
doesn't create wasteful threads (which get in the way of sandboxing). Review URL: https://chromiumcodereview.appspot.com/10051009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131821 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/gtk_util.cc')
-rw-r--r--ui/gfx/gtk_util.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/ui/gfx/gtk_util.cc b/ui/gfx/gtk_util.cc
index a02b043..68a983a 100644
--- a/ui/gfx/gtk_util.cc
+++ b/ui/gfx/gtk_util.cc
@@ -60,7 +60,8 @@ void FreePixels(guchar* pixels, gpointer data) {
namespace gfx {
-void GtkInitFromCommandLine(const CommandLine& command_line) {
+static void CommonInitFromCommandLine(
+ const CommandLine& command_line, void (*init_func)(gint*, gchar***)) {
const std::vector<std::string>& args = command_line.argv();
int argc = args.size();
scoped_array<char *> argv(new char *[argc + 1]);
@@ -72,12 +73,20 @@ void GtkInitFromCommandLine(const CommandLine& command_line) {
argv[argc] = NULL;
char **argv_pointer = argv.get();
- gtk_init(&argc, &argv_pointer);
+ init_func(&argc, &argv_pointer);
for (size_t i = 0; i < args.size(); ++i) {
free(argv[i]);
}
}
+void GtkInitFromCommandLine(const CommandLine& command_line) {
+ CommonInitFromCommandLine(command_line, gtk_init);
+}
+
+void GdkInitFromCommandLine(const CommandLine& command_line) {
+ CommonInitFromCommandLine(command_line, gdk_init);
+}
+
GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap) {
if (bitmap->isNull())
return NULL;