Index: gpu/command_buffer/service/common_decoder.cc |
diff --git a/gpu/command_buffer/service/common_decoder.cc b/gpu/command_buffer/service/common_decoder.cc |
index 7b28603edcdd8ab1e01a85a5746eab0b688d3c7a..c47ac61ce1388ba8f1defbf7b1c0739d6a8f9611 100644 |
--- a/gpu/command_buffer/service/common_decoder.cc |
+++ b/gpu/command_buffer/service/common_decoder.cc |
@@ -286,24 +286,40 @@ error::Error CommonDecoder::HandleSetBucketDataImmediate( |
return error::kNoError; |
} |
-error::Error CommonDecoder::HandleGetBucketSize( |
+error::Error CommonDecoder::HandleGetBucketStart( |
uint32 immediate_data_size, |
- const cmd::GetBucketSize& args) { |
+ const cmd::GetBucketStart& args) { |
uint32 bucket_id = args.bucket_id; |
- uint32* data = GetSharedMemoryAs<uint32*>( |
- args.shared_memory_id, args.shared_memory_offset, sizeof(*data)); |
- if (!data) { |
+ uint32* result = GetSharedMemoryAs<uint32*>( |
+ args.result_memory_id, args.result_memory_offset, sizeof(*result)); |
+ int32 data_memory_id = args.data_memory_id; |
+ uint32 data_memory_offset = args.data_memory_offset; |
+ uint32 data_memory_size = args.data_memory_size; |
+ uint8* data = NULL; |
+ if (data_memory_size != 0 || data_memory_id != 0 || data_memory_offset != 0) { |
+ data = GetSharedMemoryAs<uint8*>( |
+ args.data_memory_id, args.data_memory_offset, args.data_memory_size); |
+ if (!data) { |
+ return error::kInvalidArguments; |
+ } |
+ } |
+ if (!result) { |
return error::kInvalidArguments; |
} |
// Check that the client initialized the result. |
- if (*data != 0) { |
+ if (*result != 0) { |
return error::kInvalidArguments; |
} |
Bucket* bucket = GetBucket(bucket_id); |
if (!bucket) { |
return error::kInvalidArguments; |
} |
- *data = bucket->size(); |
+ uint32 bucket_size = bucket->size(); |
+ *result = bucket_size; |
+ if (data) { |
+ uint32 size = std::min(data_memory_size, bucket_size); |
+ memcpy(data, bucket->GetData(0, size), size); |
+ } |
return error::kNoError; |
} |