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/precompile.h" | 7 #include "gpu/command_buffer/service/precompile.h" |
8 #include "gpu/command_buffer/service/cmd_parser.h" | 8 #include "gpu/command_buffer/service/cmd_parser.h" |
9 | 9 |
10 namespace gpu { | 10 namespace gpu { |
(...skipping 28 matching lines...) Expand all Loading... |
39 parse_error::ParseError CommandParser::ProcessCommand() { | 39 parse_error::ParseError CommandParser::ProcessCommand() { |
40 CommandBufferOffset get = get_; | 40 CommandBufferOffset get = get_; |
41 if (get == put_) return parse_error::kParseNoError; | 41 if (get == put_) return parse_error::kParseNoError; |
42 | 42 |
43 CommandHeader header = buffer_[get].value_header; | 43 CommandHeader header = buffer_[get].value_header; |
44 if (header.size == 0) { | 44 if (header.size == 0) { |
45 DLOG(INFO) << "Error: zero sized command in command buffer"; | 45 DLOG(INFO) << "Error: zero sized command in command buffer"; |
46 return parse_error::kParseInvalidSize; | 46 return parse_error::kParseInvalidSize; |
47 } | 47 } |
48 | 48 |
49 if (static_cast<size_t>(header.size + get) > entry_count_) { | 49 if (static_cast<int>(header.size) + get > entry_count_) { |
50 DLOG(INFO) << "Error: get offset out of bounds"; | 50 DLOG(INFO) << "Error: get offset out of bounds"; |
51 return parse_error::kParseOutOfBounds; | 51 return parse_error::kParseOutOfBounds; |
52 } | 52 } |
53 | 53 |
54 parse_error::ParseError result = handler_->DoCommand( | 54 parse_error::ParseError result = handler_->DoCommand( |
55 header.command, header.size - 1, buffer_ + get); | 55 header.command, header.size - 1, buffer_ + get); |
56 // TODO(gman): If you want to log errors this is the best place to catch them. | 56 // TODO(gman): If you want to log errors this is the best place to catch them. |
57 // It seems like we need an official way to turn on a debug mode and | 57 // It seems like we need an official way to turn on a debug mode and |
58 // get these errors. | 58 // get these errors. |
59 if (result != parse_error::kParseNoError) { | 59 if (result != parse_error::kParseNoError) { |
(...skipping 13 matching lines...) Expand all Loading... |
73 // is encountered. | 73 // is encountered. |
74 parse_error::ParseError CommandParser::ProcessAllCommands() { | 74 parse_error::ParseError CommandParser::ProcessAllCommands() { |
75 while (!IsEmpty()) { | 75 while (!IsEmpty()) { |
76 parse_error::ParseError error = ProcessCommand(); | 76 parse_error::ParseError error = ProcessCommand(); |
77 if (error) return error; | 77 if (error) return error; |
78 } | 78 } |
79 return parse_error::kParseNoError; | 79 return parse_error::kParseNoError; |
80 } | 80 } |
81 | 81 |
82 } // namespace gpu | 82 } // namespace gpu |
OLD | NEW |