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

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

Issue 329046: Splits the command buffers into common commands... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 DLOG(INFO) << "Error: get offset out of bounds"; 80 DLOG(INFO) << "Error: get offset out of bounds";
81 return parse_error::kParseOutOfBounds; 81 return parse_error::kParseOutOfBounds;
82 } 82 }
83 83
84 parse_error::ParseError result = handler_->DoCommand( 84 parse_error::ParseError result = handler_->DoCommand(
85 header.command, header.size - 1, buffer_ + get); 85 header.command, header.size - 1, buffer_ + get);
86 // TODO(gman): If you want to log errors this is the best place to catch them. 86 // TODO(gman): If you want to log errors this is the best place to catch them.
87 // It seems like we need an official way to turn on a debug mode and 87 // It seems like we need an official way to turn on a debug mode and
88 // get these errors. 88 // get these errors.
89 if (result != parse_error::kParseNoError) { 89 if (result != parse_error::kParseNoError) {
90 DLOG(INFO) 90 ReportError(header.command, result);
91 << "Error: " << result << " for Command "
92 << o3d::GetCommandName(static_cast<o3d::CommandId>(header.command));
93 } 91 }
94 get_ = (get + header.size) % entry_count_; 92 get_ = (get + header.size) % entry_count_;
95 return result; 93 return result;
96 } 94 }
97 95
96 void CommandParser::ReportError(unsigned int command_id,
97 parse_error::ParseError result) {
98 DLOG(INFO) << "Error: " << result << " for Command "
99 << handler_->GetCommandName(command_id);
100 }
101
98 // Processes all the commands, while the buffer is not empty. Stop if an error 102 // Processes all the commands, while the buffer is not empty. Stop if an error
99 // is encountered. 103 // is encountered.
100 parse_error::ParseError CommandParser::ProcessAllCommands() { 104 parse_error::ParseError CommandParser::ProcessAllCommands() {
101 while (!IsEmpty()) { 105 while (!IsEmpty()) {
102 parse_error::ParseError error = ProcessCommand(); 106 parse_error::ParseError error = ProcessCommand();
103 if (error) return error; 107 if (error) return error;
104 } 108 }
105 return parse_error::kParseNoError; 109 return parse_error::kParseNoError;
106 } 110 }
107 111
108 } // namespace command_buffer 112 } // namespace command_buffer
109 } // namespace o3d 113 } // namespace o3d
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698