Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3120)

Unified Diff: chrome/gpu/gpu_thread.cc

Issue 1540004: Implemented offscreen rendering path for GLES2CmdDecoder on Linux.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/gpu/gpu_thread.cc
===================================================================
--- chrome/gpu/gpu_thread.cc (revision 43138)
+++ chrome/gpu/gpu_thread.cc (working copy)
@@ -5,6 +5,8 @@
#include "chrome/gpu/gpu_thread.h"
#include "build/build_config.h"
+
+#include "base/command_line.h"
#include "chrome/common/child_process.h"
#include "chrome/common/gpu_messages.h"
#include "chrome/gpu/gpu_config.h"
@@ -18,10 +20,40 @@
#include <X11/Xutil.h> // Must be last.
#endif
+#if defined(OS_LINUX)
+#include <gtk/gtk.h>
+#endif
+
GpuThread::GpuThread() {
#if defined(GPU_USE_GLX)
display_ = ::XOpenDisplay(NULL);
#endif
+#if defined(OS_LINUX)
+ {
+ // The X11 port of the command buffer code assumes it can access the X
+ // display via the macro GDK_DISPLAY(), which implies that Gtk has been
+ // initialized. This code was taken from PluginThread. TODO(kbr):
+ // rethink whether initializing Gtk is really necessary or whether we
+ // should just send the display connection down to the GPUProcessor.
+ g_thread_init(NULL);
+ const std::vector<std::string>& args =
+ CommandLine::ForCurrentProcess()->argv();
+ int argc = args.size();
+ scoped_array<char *> argv(new char *[argc + 1]);
+ for (size_t i = 0; i < args.size(); ++i) {
+ // TODO(piman@google.com): can gtk_init modify argv? Just being safe
+ // here.
+ argv[i] = strdup(args[i].c_str());
+ }
+ argv[argc] = NULL;
+ char **argv_pointer = argv.get();
+
+ gtk_init(&argc, &argv_pointer);
+ for (size_t i = 0; i < args.size(); ++i) {
+ free(argv[i]);
+ }
+ }
+#endif
}
GpuThread::~GpuThread() {
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698