Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: gpu/command_buffer/service/cmd_parser.cc

Issue 555129: Add commands Jump, Call and Return... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gpu/command_buffer/service/cmd_parser.h ('k') | gpu/command_buffer/service/common_decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/cmd_parser.h ('k') | gpu/command_buffer/service/common_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698