| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 header.command, header.size - 1, buffer_ + get); | 57 header.command, header.size - 1, buffer_ + get); |
| 58 | 58 |
| 59 // TODO(gman): If you want to log errors this is the best place to catch them. | 59 // TODO(gman): If you want to log errors this is the best place to catch them. |
| 60 // It seems like we need an official way to turn on a debug mode and | 60 // It seems like we need an official way to turn on a debug mode and |
| 61 // get these errors. | 61 // get these errors. |
| 62 if (error::IsError(result)) { | 62 if (error::IsError(result)) { |
| 63 ReportError(header.command, result); | 63 ReportError(header.command, result); |
| 64 } | 64 } |
| 65 | 65 |
| 66 // If get was not set somewhere else advance it. | 66 // If get was not set somewhere else advance it. |
| 67 if (get == get_) | 67 if (result != error::kWaiting && get == get_) |
| 68 get_ = (get + header.size) % entry_count_; | 68 get_ = (get + header.size) % entry_count_; |
| 69 return result; | 69 return result; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void CommandParser::ReportError(unsigned int command_id, | 72 void CommandParser::ReportError(unsigned int command_id, |
| 73 error::Error result) { | 73 error::Error result) { |
| 74 DVLOG(1) << "Error: " << result << " for Command " | 74 DVLOG(1) << "Error: " << result << " for Command " |
| 75 << handler_->GetCommandName(command_id); | 75 << handler_->GetCommandName(command_id); |
| 76 } | 76 } |
| 77 | 77 |
| 78 // Processes all the commands, while the buffer is not empty. Stop if an error | 78 // Processes all the commands, while the buffer is not empty. Stop if an error |
| 79 // is encountered. | 79 // is encountered. |
| 80 error::Error CommandParser::ProcessAllCommands() { | 80 error::Error CommandParser::ProcessAllCommands() { |
| 81 while (!IsEmpty()) { | 81 while (!IsEmpty()) { |
| 82 error::Error error = ProcessCommand(); | 82 error::Error error = ProcessCommand(); |
| 83 if (error) | 83 if (error) |
| 84 return error; | 84 return error; |
| 85 } | 85 } |
| 86 return error::kNoError; | 86 return error::kNoError; |
| 87 } | 87 } |
| 88 | 88 |
| 89 } // namespace gpu | 89 } // namespace gpu |
| OLD | NEW |