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

Side by Side Diff: gpu/command_buffer/service/gpu_processor_linux.cc

Issue 1136006: Calling OpenGL from the renderer process. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <gdk/gdkx.h> 5 #include <gdk/gdkx.h>
6 #include "gpu/command_buffer/service/gpu_processor.h" 6 #include "gpu/command_buffer/service/gpu_processor.h"
7 #include "gpu/command_buffer/service/x_utils.h" 7 #include "gpu/command_buffer/service/x_utils.h"
8 8
9 using ::base::SharedMemory; 9 using ::base::SharedMemory;
10 10
11 namespace gpu { 11 namespace gpu {
12 12
13 bool GPUProcessor::Initialize(gfx::PluginWindowHandle handle) { 13 bool GPUProcessor::Initialize(gfx::PluginWindowHandle handle,
14 GPUProcessor* parent,
15 const gfx::Size& size,
16 uint32 parent_texture_id) {
14 DCHECK(handle); 17 DCHECK(handle);
15 18
16 // Cannot reinitialize. 19 // Cannot reinitialize.
17 if (decoder_->window() != NULL) 20 if (decoder_->window() != NULL)
18 return false; 21 return false;
19 22
20 // Map the ring buffer and create the parser. 23 // Map the ring buffer and create the parser.
21 Buffer ring_buffer = command_buffer_->GetRingBuffer(); 24 Buffer ring_buffer = command_buffer_->GetRingBuffer();
22 if (ring_buffer.ptr) { 25 if (ring_buffer.ptr) {
23 parser_.reset(new CommandParser(ring_buffer.ptr, 26 parser_.reset(new CommandParser(ring_buffer.ptr,
24 ring_buffer.size, 27 ring_buffer.size,
25 0, 28 0,
26 ring_buffer.size, 29 ring_buffer.size,
27 0, 30 0,
28 decoder_.get())); 31 decoder_.get()));
29 } else { 32 } else {
30 parser_.reset(new CommandParser(NULL, 0, 0, 0, 0, 33 parser_.reset(new CommandParser(NULL, 0, 0, 0, 0,
31 decoder_.get())); 34 decoder_.get()));
32 } 35 }
33 36
34 // Initialize GAPI immediately if the window handle is valid. 37 // Initialize GAPI immediately if the window handle is valid.
35 XWindowWrapper *window = new XWindowWrapper(GDK_DISPLAY(), handle); 38 XWindowWrapper *window = new XWindowWrapper(GDK_DISPLAY(), handle);
36 decoder_->set_window_wrapper(window); 39 decoder_->set_window_wrapper(window);
37 return decoder_->Initialize(); 40 gles2::GLES2Decoder* parent_decoder = parent ? parent->decoder_.get() : NULL;
38 } 41 if (!decoder_->Initialize(parent_decoder,
42 size,
43 parent_texture_id)) {
44 Destroy();
45 return false;
46 }
47
48 return true;}
39 49
40 void GPUProcessor::Destroy() { 50 void GPUProcessor::Destroy() {
41 // Destroy GAPI if window handle has not already become invalid. 51 // Destroy decoder if initialized.
42 XWindowWrapper *window = decoder_->window(); 52 if (decoder_.get()) {
43 if (window) { 53 XWindowWrapper *window = decoder_->window();
44 decoder_->Destroy(); 54 decoder_->Destroy();
45 decoder_->set_window_wrapper(NULL); 55 decoder_->set_window_wrapper(NULL);
46 delete window; 56 delete window;
57 decoder_.reset();
47 } 58 }
59
60 parser_.reset();
48 } 61 }
49 62
50 } // namespace gpu 63 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_processor.cc ('k') | gpu/command_buffer/service/gpu_processor_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698