| 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "gpu/command_buffer/service/gpu_processor.h" | 6 #include "gpu/command_buffer/service/gpu_processor.h" |
| 7 | 7 |
| 8 using ::base::SharedMemory; | 8 using ::base::SharedMemory; |
| 9 | 9 |
| 10 namespace gpu { | 10 namespace gpu { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 parser_.reset(parser); | 28 parser_.reset(parser); |
| 29 } | 29 } |
| 30 | 30 |
| 31 GPUProcessor::~GPUProcessor() { | 31 GPUProcessor::~GPUProcessor() { |
| 32 } | 32 } |
| 33 | 33 |
| 34 void GPUProcessor::ProcessCommands() { | 34 void GPUProcessor::ProcessCommands() { |
| 35 if (command_buffer_->GetErrorStatus()) | 35 if (command_buffer_->GetErrorStatus()) |
| 36 return; | 36 return; |
| 37 | 37 |
| 38 if (decoder_.get()) { |
| 39 // TODO(apatrick): need to do more than this on failure. |
| 40 if (!decoder_->MakeCurrent()) |
| 41 return; |
| 42 } |
| 43 |
| 38 parser_->set_put(command_buffer_->GetPutOffset()); | 44 parser_->set_put(command_buffer_->GetPutOffset()); |
| 39 | 45 |
| 40 int commands_processed = 0; | 46 int commands_processed = 0; |
| 41 while (commands_processed < commands_per_update_ && !parser_->IsEmpty()) { | 47 while (commands_processed < commands_per_update_ && !parser_->IsEmpty()) { |
| 42 parse_error::ParseError parse_error = parser_->ProcessCommand(); | 48 parse_error::ParseError parse_error = parser_->ProcessCommand(); |
| 43 switch (parse_error) { | 49 switch (parse_error) { |
| 44 case parse_error::kParseUnknownCommand: | 50 case parse_error::kParseUnknownCommand: |
| 45 case parse_error::kParseInvalidArguments: | 51 case parse_error::kParseInvalidArguments: |
| 46 command_buffer_->SetParseError(parse_error); | 52 command_buffer_->SetParseError(parse_error); |
| 47 break; | 53 break; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 68 | 74 |
| 69 Buffer GPUProcessor::GetSharedMemoryBuffer(int32 shm_id) { | 75 Buffer GPUProcessor::GetSharedMemoryBuffer(int32 shm_id) { |
| 70 return command_buffer_->GetTransferBuffer(shm_id); | 76 return command_buffer_->GetTransferBuffer(shm_id); |
| 71 } | 77 } |
| 72 | 78 |
| 73 void GPUProcessor::set_token(int32 token) { | 79 void GPUProcessor::set_token(int32 token) { |
| 74 command_buffer_->SetToken(token); | 80 command_buffer_->SetToken(token); |
| 75 } | 81 } |
| 76 | 82 |
| 77 } // namespace gpu | 83 } // namespace gpu |
| OLD | NEW |