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

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

Issue 555020: Redesigned CommandBuffer and NPDevice3D interfaces (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/command_buffer_service.cc
===================================================================
--- gpu/command_buffer/service/command_buffer_service.cc (revision 37414)
+++ gpu/command_buffer/service/command_buffer_service.cc (working copy)
@@ -17,8 +17,7 @@
get_offset_(0),
put_offset_(0),
token_(0),
- parse_error_(0),
- error_status_(false) {
+ error_(parse_error::kParseNoError) {
// Element zero is always NULL.
registered_objects_.push_back(linked_ptr<SharedMemory>());
}
@@ -54,13 +53,22 @@
return buffer;
}
-int32 CommandBufferService::GetSize() {
- return size_;
+CommandBufferService::State CommandBufferService::GetState() {
+ State state;
+ state.size = size_;
+ state.get_offset = get_offset_;
+ state.put_offset = put_offset_;
+ state.token = token_;
+ state.error = error_;
+
+ return state;
}
-int32 CommandBufferService::SyncOffsets(int32 put_offset) {
- if (put_offset < 0 || put_offset >= size_)
- return -1;
+CommandBufferService::State CommandBufferService::Flush(int32 put_offset) {
+ if (put_offset < 0 || put_offset >= size_) {
+ error_ = gpu::parse_error::kParseOutOfBounds;
+ return GetState();
+ }
put_offset_ = put_offset;
@@ -68,22 +76,14 @@
put_offset_change_callback_->Run();
}
- return get_offset_;
+ return GetState();
}
-int32 CommandBufferService::GetGetOffset() {
- return get_offset_;
-}
-
void CommandBufferService::SetGetOffset(int32 get_offset) {
DCHECK(get_offset >= 0 && get_offset < size_);
get_offset_ = get_offset;
}
-int32 CommandBufferService::GetPutOffset() {
- return put_offset_;
-}
-
int32 CommandBufferService::CreateTransferBuffer(size_t size) {
linked_ptr<SharedMemory> buffer(new SharedMemory);
if (!buffer->Create(std::wstring(), false, false, size))
@@ -150,34 +150,16 @@
return buffer;
}
-int32 CommandBufferService::GetToken() {
- return token_;
-}
-
void CommandBufferService::SetToken(int32 token) {
token_ = token;
}
-int32 CommandBufferService::ResetParseError() {
- int32 last_error = parse_error_;
- parse_error_ = 0;
- return last_error;
-}
-
-void CommandBufferService::SetParseError(int32 parse_error) {
- if (parse_error_ == 0) {
- parse_error_ = parse_error;
+void CommandBufferService::SetParseError(parse_error::ParseError error) {
+ if (error_ == parse_error::kParseNoError) {
+ error_ = error;
}
}
-bool CommandBufferService::GetErrorStatus() {
- return error_status_;
-}
-
-void CommandBufferService::RaiseErrorStatus() {
- error_status_ = true;
-}
-
void CommandBufferService::SetPutOffsetChangeCallback(
Callback0::Type* callback) {
put_offset_change_callback_.reset(callback);
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.h ('k') | gpu/command_buffer/service/command_buffer_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698