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

Side by Side 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, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/gpu/gpu_thread.h" 5 #include "chrome/gpu/gpu_thread.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8
9 #include "base/command_line.h"
8 #include "chrome/common/child_process.h" 10 #include "chrome/common/child_process.h"
9 #include "chrome/common/gpu_messages.h" 11 #include "chrome/common/gpu_messages.h"
10 #include "chrome/gpu/gpu_config.h" 12 #include "chrome/gpu/gpu_config.h"
11 13
12 #if defined(OS_WIN) 14 #if defined(OS_WIN)
13 #include "chrome/gpu/gpu_view_win.h" 15 #include "chrome/gpu/gpu_view_win.h"
14 #elif defined(GPU_USE_GLX) 16 #elif defined(GPU_USE_GLX)
15 #include "chrome/gpu/gpu_backing_store_glx_context.h" 17 #include "chrome/gpu/gpu_backing_store_glx_context.h"
16 #include "chrome/gpu/gpu_view_x.h" 18 #include "chrome/gpu/gpu_view_x.h"
17 19
18 #include <X11/Xutil.h> // Must be last. 20 #include <X11/Xutil.h> // Must be last.
19 #endif 21 #endif
20 22
23 #if defined(OS_LINUX)
24 #include <gtk/gtk.h>
25 #endif
26
21 GpuThread::GpuThread() { 27 GpuThread::GpuThread() {
22 #if defined(GPU_USE_GLX) 28 #if defined(GPU_USE_GLX)
23 display_ = ::XOpenDisplay(NULL); 29 display_ = ::XOpenDisplay(NULL);
24 #endif 30 #endif
31 #if defined(OS_LINUX)
32 {
33 // The X11 port of the command buffer code assumes it can access the X
34 // display via the macro GDK_DISPLAY(), which implies that Gtk has been
35 // initialized. This code was taken from PluginThread. TODO(kbr):
36 // rethink whether initializing Gtk is really necessary or whether we
37 // should just send the display connection down to the GPUProcessor.
38 g_thread_init(NULL);
39 const std::vector<std::string>& args =
40 CommandLine::ForCurrentProcess()->argv();
41 int argc = args.size();
42 scoped_array<char *> argv(new char *[argc + 1]);
43 for (size_t i = 0; i < args.size(); ++i) {
44 // TODO(piman@google.com): can gtk_init modify argv? Just being safe
45 // here.
46 argv[i] = strdup(args[i].c_str());
47 }
48 argv[argc] = NULL;
49 char **argv_pointer = argv.get();
50
51 gtk_init(&argc, &argv_pointer);
52 for (size_t i = 0; i < args.size(); ++i) {
53 free(argv[i]);
54 }
55 }
56 #endif
25 } 57 }
26 58
27 GpuThread::~GpuThread() { 59 GpuThread::~GpuThread() {
28 } 60 }
29 61
30 #if defined(GPU_USE_GLX) 62 #if defined(GPU_USE_GLX)
31 GpuBackingStoreGLXContext* GpuThread::GetGLXContext() { 63 GpuBackingStoreGLXContext* GpuThread::GetGLXContext() {
32 if (!glx_context_.get()) 64 if (!glx_context_.get())
33 glx_context_.reset(new GpuBackingStoreGLXContext(this)); 65 glx_context_.reset(new GpuBackingStoreGLXContext(this));
34 return glx_context_.get(); 66 return glx_context_.get();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // message to destroy the GpuRWHView when necessary. So we don't manage the 123 // message to destroy the GpuRWHView when necessary. So we don't manage the
92 // lifetime of this object. 124 // lifetime of this object.
93 #if defined(OS_WIN) 125 #if defined(OS_WIN)
94 new GpuViewWin(this, parent_window, routing_id); 126 new GpuViewWin(this, parent_window, routing_id);
95 #elif defined(GPU_USE_GLX) 127 #elif defined(GPU_USE_GLX)
96 new GpuViewX(this, parent_window, routing_id); 128 new GpuViewX(this, parent_window, routing_id);
97 #else 129 #else
98 NOTIMPLEMENTED(); 130 NOTIMPLEMENTED();
99 #endif 131 #endif
100 } 132 }
OLDNEW
« 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