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

Unified Diff: gpu/command_buffer/service/cmd_parser.cc

Issue 8919014: Revert "Revert 113479 - Revert "Revert 113250 - Add CommandBuffer::SetGetBuffer"" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/cmd_parser.h ('k') | gpu/command_buffer/service/cmd_parser_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/cmd_parser.cc
diff --git a/gpu/command_buffer/service/cmd_parser.cc b/gpu/command_buffer/service/cmd_parser.cc
index fba06e6a20b1d4b2f17a1ca432aad18cf74bbed2..b5383afdf8693c112a1a1a35fad8656db0e2a3b0 100644
--- a/gpu/command_buffer/service/cmd_parser.cc
+++ b/gpu/command_buffer/service/cmd_parser.cc
@@ -10,23 +10,29 @@
namespace gpu {
-CommandParser::CommandParser(void *shm_address,
- size_t shm_size,
- ptrdiff_t offset,
- size_t size,
- CommandBufferOffset start_get,
- AsyncAPIInterface *handler)
- : get_(start_get),
- put_(start_get),
+CommandParser::CommandParser(AsyncAPIInterface* handler)
+ : get_(0),
+ put_(0),
+ buffer_(NULL),
+ entry_count_(0),
handler_(handler) {
+}
+
+void CommandParser::SetBuffer(
+ void* shm_address,
+ size_t shm_size,
+ ptrdiff_t offset,
+ size_t size) {
// check proper alignments.
DCHECK_EQ(0, (reinterpret_cast<intptr_t>(shm_address)) % 4);
DCHECK_EQ(0, offset % 4);
DCHECK_EQ(0u, size % 4);
// check that the command buffer fits into the memory buffer.
DCHECK_GE(shm_size, offset + size);
- char * buffer_begin = static_cast<char *>(shm_address) + offset;
- buffer_ = reinterpret_cast<CommandBufferEntry *>(buffer_begin);
+ get_ = 0;
+ put_ = 0;
+ char* buffer_begin = static_cast<char*>(shm_address) + offset;
+ buffer_ = reinterpret_cast<CommandBufferEntry*>(buffer_begin);
entry_count_ = size / 4;
}
« no previous file with comments | « gpu/command_buffer/service/cmd_parser.h ('k') | gpu/command_buffer/service/cmd_parser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698