| OLD | NEW |
| 1 // Copyright (c) 2006-2008 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 command_buffer { | 10 namespace gpu { |
| 11 | 11 |
| 12 GPUProcessor::~GPUProcessor() { | 12 GPUProcessor::~GPUProcessor() { |
| 13 } | 13 } |
| 14 | 14 |
| 15 void GPUProcessor::ProcessCommands() { | 15 void GPUProcessor::ProcessCommands() { |
| 16 if (command_buffer_->GetErrorStatus()) | 16 if (command_buffer_->GetErrorStatus()) |
| 17 return; | 17 return; |
| 18 | 18 |
| 19 parser_->set_put(command_buffer_->GetPutOffset()); | 19 parser_->set_put(command_buffer_->GetPutOffset()); |
| 20 | 20 |
| 21 int commands_processed = 0; | 21 int commands_processed = 0; |
| 22 while (commands_processed < commands_per_update_ && !parser_->IsEmpty()) { | 22 while (commands_processed < commands_per_update_ && !parser_->IsEmpty()) { |
| 23 command_buffer::parse_error::ParseError parse_error = | 23 gpu::parse_error::ParseError parse_error = |
| 24 parser_->ProcessCommand(); | 24 parser_->ProcessCommand(); |
| 25 switch (parse_error) { | 25 switch (parse_error) { |
| 26 case command_buffer::parse_error::kParseUnknownCommand: | 26 case gpu::parse_error::kParseUnknownCommand: |
| 27 case command_buffer::parse_error::kParseInvalidArguments: | 27 case gpu::parse_error::kParseInvalidArguments: |
| 28 command_buffer_->SetParseError(parse_error); | 28 command_buffer_->SetParseError(parse_error); |
| 29 break; | 29 break; |
| 30 | 30 |
| 31 case command_buffer::parse_error::kParseInvalidSize: | 31 case gpu::parse_error::kParseInvalidSize: |
| 32 case command_buffer::parse_error::kParseOutOfBounds: | 32 case gpu::parse_error::kParseOutOfBounds: |
| 33 command_buffer_->SetParseError(parse_error); | 33 command_buffer_->SetParseError(parse_error); |
| 34 command_buffer_->RaiseErrorStatus(); | 34 command_buffer_->RaiseErrorStatus(); |
| 35 return; | 35 return; |
| 36 } | 36 } |
| 37 | 37 |
| 38 ++commands_processed; | 38 ++commands_processed; |
| 39 } | 39 } |
| 40 | 40 |
| 41 command_buffer_->SetGetOffset(static_cast<int32>(parser_->get())); | 41 command_buffer_->SetGetOffset(static_cast<int32>(parser_->get())); |
| 42 | 42 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 68 if (!shared_memory) | 68 if (!shared_memory) |
| 69 return 0; | 69 return 0; |
| 70 | 70 |
| 71 return shared_memory->max_size(); | 71 return shared_memory->max_size(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void GPUProcessor::set_token(int32 token) { | 74 void GPUProcessor::set_token(int32 token) { |
| 75 command_buffer_->SetToken(token); | 75 command_buffer_->SetToken(token); |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace command_buffer | 78 } // namespace gpu |
| OLD | NEW |