| 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 // This file contains the implementation of the command parser. | 5 // This file contains the implementation of the command parser. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/service/cmd_parser.h" | 7 #include "gpu/command_buffer/service/cmd_parser.h" |
| 8 | 8 |
| 9 namespace gpu { | 9 namespace gpu { |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 error::Error result = handler_->DoCommand( | 53 error::Error result = handler_->DoCommand( |
| 54 header.command, header.size - 1, buffer_ + get); | 54 header.command, header.size - 1, buffer_ + get); |
| 55 // TODO(gman): If you want to log errors this is the best place to catch them. | 55 // TODO(gman): If you want to log errors this is the best place to catch them. |
| 56 // It seems like we need an official way to turn on a debug mode and | 56 // It seems like we need an official way to turn on a debug mode and |
| 57 // get these errors. | 57 // get these errors. |
| 58 if (result != error::kNoError) { | 58 if (result != error::kNoError) { |
| 59 ReportError(header.command, result); | 59 ReportError(header.command, result); |
| 60 } | 60 } |
| 61 get_ = (get + header.size) % entry_count_; | 61 |
| 62 // If get was not set somewhere else advance it. |
| 63 if (get == get_) { |
| 64 get_ = (get + header.size) % entry_count_; |
| 65 } |
| 62 return result; | 66 return result; |
| 63 } | 67 } |
| 64 | 68 |
| 65 void CommandParser::ReportError(unsigned int command_id, | 69 void CommandParser::ReportError(unsigned int command_id, |
| 66 error::Error result) { | 70 error::Error result) { |
| 67 DLOG(INFO) << "Error: " << result << " for Command " | 71 DLOG(INFO) << "Error: " << result << " for Command " |
| 68 << handler_->GetCommandName(command_id); | 72 << handler_->GetCommandName(command_id); |
| 69 } | 73 } |
| 70 | 74 |
| 71 // Processes all the commands, while the buffer is not empty. Stop if an error | 75 // Processes all the commands, while the buffer is not empty. Stop if an error |
| 72 // is encountered. | 76 // is encountered. |
| 73 error::Error CommandParser::ProcessAllCommands() { | 77 error::Error CommandParser::ProcessAllCommands() { |
| 74 while (!IsEmpty()) { | 78 while (!IsEmpty()) { |
| 75 error::Error error = ProcessCommand(); | 79 error::Error error = ProcessCommand(); |
| 76 if (error) return error; | 80 if (error) return error; |
| 77 } | 81 } |
| 78 return error::kNoError; | 82 return error::kNoError; |
| 79 } | 83 } |
| 80 | 84 |
| 81 } // namespace gpu | 85 } // namespace gpu |
| OLD | NEW |