| OLD | NEW |
| 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 GPUProcessor::GPUProcessor(CommandBuffer* command_buffer) | |
| 14 : command_buffer_(command_buffer), | |
| 15 commands_per_update_(100) { | |
| 16 DCHECK(command_buffer); | |
| 17 decoder_.reset(gles2::GLES2Decoder::Create()); | |
| 18 decoder_->set_engine(this); | |
| 19 } | |
| 20 | |
| 21 GPUProcessor::GPUProcessor(CommandBuffer* command_buffer, | |
| 22 gles2::GLES2Decoder* decoder, | |
| 23 CommandParser* parser, | |
| 24 int commands_per_update) | |
| 25 : command_buffer_(command_buffer), | |
| 26 commands_per_update_(commands_per_update) { | |
| 27 DCHECK(command_buffer); | |
| 28 decoder_.reset(decoder); | |
| 29 parser_.reset(parser); | |
| 30 } | |
| 31 | |
| 32 bool GPUProcessor::Initialize(gfx::PluginWindowHandle handle) { | 13 bool GPUProcessor::Initialize(gfx::PluginWindowHandle handle) { |
| 33 DCHECK(handle); | 14 DCHECK(handle); |
| 34 | 15 |
| 35 // Cannot reinitialize. | 16 // Cannot reinitialize. |
| 36 if (decoder_->hwnd() != NULL) | 17 if (decoder_->hwnd() != NULL) |
| 37 return false; | 18 return false; |
| 38 | 19 |
| 39 // Map the ring buffer and create the parser. | 20 // Map the ring buffer and create the parser. |
| 40 Buffer ring_buffer = command_buffer_->GetRingBuffer(); | 21 Buffer ring_buffer = command_buffer_->GetRingBuffer(); |
| 41 if (ring_buffer.ptr) { | 22 if (ring_buffer.ptr) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 56 } | 37 } |
| 57 | 38 |
| 58 void GPUProcessor::Destroy() { | 39 void GPUProcessor::Destroy() { |
| 59 // Destroy GAPI if window handle has not already become invalid. | 40 // Destroy GAPI if window handle has not already become invalid. |
| 60 if (decoder_->hwnd()) { | 41 if (decoder_->hwnd()) { |
| 61 decoder_->Destroy(); | 42 decoder_->Destroy(); |
| 62 decoder_->set_hwnd(NULL); | 43 decoder_->set_hwnd(NULL); |
| 63 } | 44 } |
| 64 } | 45 } |
| 65 } // namespace gpu | 46 } // namespace gpu |
| OLD | NEW |