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

Side by Side Diff: gpu/command_buffer/service/gpu_processor_win.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 <windows.h> 5 #include <windows.h>
6 6
7 #include "gpu/command_buffer/service/gpu_processor.h" 7 #include "gpu/command_buffer/service/gpu_processor.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 // Cannot reinitialize. 17 // Cannot reinitialize.
15 if (parser_.get()) 18 if (parser_.get())
16 return false; 19 return false;
17 20
18 // Map the ring buffer and create the parser. 21 // Map the ring buffer and create the parser.
19 Buffer ring_buffer = command_buffer_->GetRingBuffer(); 22 Buffer ring_buffer = command_buffer_->GetRingBuffer();
20 if (ring_buffer.ptr) { 23 if (ring_buffer.ptr) {
21 parser_.reset(new CommandParser(ring_buffer.ptr, 24 parser_.reset(new CommandParser(ring_buffer.ptr,
22 ring_buffer.size, 25 ring_buffer.size,
23 0, 26 0,
24 ring_buffer.size, 27 ring_buffer.size,
25 0, 28 0,
26 decoder_.get())); 29 decoder_.get()));
27 } else { 30 } else {
28 parser_.reset(new CommandParser(NULL, 0, 0, 0, 0, 31 parser_.reset(new CommandParser(NULL, 0, 0, 0, 0,
29 decoder_.get())); 32 decoder_.get()));
30 } 33 }
31 34
32 // Initialize GAPI immediately if the window handle is valid. 35 // Initialize GAPI immediately if the window handle is valid.
33 decoder_->set_hwnd(handle); 36 decoder_->set_hwnd(handle);
34 return decoder_->Initialize(); 37 gles2::GLES2Decoder* parent_decoder = parent ? parent->decoder_.get() : NULL;
38 if (!decoder_->Initialize(parent_decoder,
39 size,
40 parent_texture_id)) {
41 Destroy();
42 return false;
43 }
44
45 return true;
35 } 46 }
36 47
37 void GPUProcessor::Destroy() { 48 void GPUProcessor::Destroy() {
38 // Destroy decoder if initialized. 49 // Destroy decoder if initialized.
39 if (parser_.get()) { 50 if (decoder_.get()) {
40 decoder_->Destroy(); 51 decoder_->Destroy();
41 decoder_->set_hwnd(NULL); 52 decoder_->set_hwnd(NULL);
53 decoder_.reset();
42 } 54 }
55
56 parser_.reset();
43 } 57 }
44 } // namespace gpu 58 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_processor_unittest.cc ('k') | gpu/command_buffer/service/texture_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698