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

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

Issue 367002: Added Pepper 3D render context that instantiates the GPU plugin.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 | « gpu/command_buffer/service/gpu_processor_unittest.cc ('k') | gpu/gpu.gyp » ('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) 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
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 bool GPUProcessor::Initialize(gfx::PluginWindowHandle handle) { 32 bool GPUProcessor::Initialize(gfx::PluginWindowHandle handle) {
33 DCHECK(handle); 33 DCHECK(handle);
34 34
35 // Cannot reinitialize. 35 // Cannot reinitialize.
36 if (decoder_->hwnd() != NULL) 36 if (decoder_->hwnd() != NULL)
37 return false; 37 return false;
38 38
39 // Map the ring buffer and create the parser. 39 // Map the ring buffer and create the parser.
40 ::base::SharedMemory* ring_buffer = command_buffer_->GetRingBuffer(); 40 Buffer ring_buffer = command_buffer_->GetRingBuffer();
41 if (ring_buffer) { 41 if (ring_buffer.ptr) {
42 size_t size = ring_buffer->max_size(); 42 parser_.reset(new CommandParser(ring_buffer.ptr,
43 if (!ring_buffer->Map(size)) { 43 ring_buffer.size,
44 return false; 44 0,
45 } 45 ring_buffer.size,
46 46 0,
47 void* ptr = ring_buffer->memory(); 47 decoder_.get()));
48 parser_.reset(new gpu::CommandParser(ptr, size, 0, size, 0,
49 decoder_.get()));
50 } else { 48 } else {
51 parser_.reset(new gpu::CommandParser(NULL, 0, 0, 0, 0, 49 parser_.reset(new CommandParser(NULL, 0, 0, 0, 0,
52 decoder_.get())); 50 decoder_.get()));
53 } 51 }
54 52
55 // Initialize GAPI immediately if the window handle is valid. 53 // Initialize GAPI immediately if the window handle is valid.
56 decoder_->set_hwnd(handle); 54 decoder_->set_hwnd(handle);
57 return decoder_->Initialize(); 55 return decoder_->Initialize();
58 } 56 }
59 57
60 void GPUProcessor::Destroy() { 58 void GPUProcessor::Destroy() {
61 // Destroy GAPI if window handle has not already become invalid. 59 // Destroy GAPI if window handle has not already become invalid.
62 if (decoder_->hwnd()) { 60 if (decoder_->hwnd()) {
63 decoder_->Destroy(); 61 decoder_->Destroy();
64 decoder_->set_hwnd(NULL); 62 decoder_->set_hwnd(NULL);
65 } 63 }
66 } 64 }
67
68 bool GPUProcessor::SetWindow(gfx::PluginWindowHandle handle,
69 int width,
70 int height) {
71 if (handle == NULL) {
72 // Destroy GAPI when the window handle becomes invalid.
73 Destroy();
74 return true;
75 } else {
76 return Initialize(handle);
77 }
78 }
79
80 } // namespace gpu 65 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_processor_unittest.cc ('k') | gpu/gpu.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698