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

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

Issue 1542513002: Switch to standard integer types in gpu/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 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/common_decoder.h ('k') | gpu/command_buffer/service/common_decoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b9452056f60f483a837d2bb613d2ba1593f3a593..a15c496ddbc02aff45d906123df00dc6595d88a7 100644
--- a/gpu/command_buffer/service/common_decoder.cc
+++ b/gpu/command_buffer/service/common_decoder.cc
@@ -4,6 +4,9 @@
#include "gpu/command_buffer/service/common_decoder.h"
+#include <stddef.h>
+#include <stdint.h>
+
#include <algorithm>
#include "base/numerics/safe_math.h"
@@ -37,7 +40,7 @@ void* CommonDecoder::Bucket::GetData(size_t offset, size_t size) const {
void CommonDecoder::Bucket::SetSize(size_t size) {
if (size != size_) {
- data_.reset(size ? new int8[size] : NULL);
+ data_.reset(size ? new int8_t[size] : NULL);
size_ = size;
memset(data_.get(), 0, size);
}
@@ -144,12 +147,12 @@ const char* CommonDecoder::GetCommonCommandName(
return cmd::GetCommandName(command_id);
}
-CommonDecoder::Bucket* CommonDecoder::GetBucket(uint32 bucket_id) const {
+CommonDecoder::Bucket* CommonDecoder::GetBucket(uint32_t bucket_id) const {
BucketMap::const_iterator iter(buckets_.find(bucket_id));
return iter != buckets_.end() ? &(*iter->second) : NULL;
}
-CommonDecoder::Bucket* CommonDecoder::CreateBucket(uint32 bucket_id) {
+CommonDecoder::Bucket* CommonDecoder::CreateBucket(uint32_t bucket_id) {
Bucket* bucket = GetBucket(bucket_id);
if (!bucket) {
bucket = new Bucket();
@@ -163,7 +166,7 @@ namespace {
// Returns the address of the first byte after a struct.
template <typename T>
const void* AddressAfterStruct(const T& pod) {
- return reinterpret_cast<const uint8*>(&pod) + sizeof(pod);
+ return reinterpret_cast<const uint8_t*>(&pod) + sizeof(pod);
}
// Returns the address of the frst byte after the struct.
@@ -187,7 +190,7 @@ error::Error CommonDecoder::DoCommonCommand(
unsigned int info_arg_count = static_cast<unsigned int>(info.arg_count);
if ((info.arg_flags == cmd::kFixed && arg_count == info_arg_count) ||
(info.arg_flags == cmd::kAtLeastN && arg_count >= info_arg_count)) {
- uint32 immediate_data_size =
+ uint32_t immediate_data_size =
(arg_count - info_arg_count) * sizeof(CommandBufferEntry); // NOLINT
return (this->*info.cmd_handler)(immediate_data_size, cmd_data);
} else {
@@ -197,41 +200,37 @@ error::Error CommonDecoder::DoCommonCommand(
return error::kUnknownCommand;
}
-error::Error CommonDecoder::HandleNoop(
- uint32 immediate_data_size,
- const void* cmd_data) {
+error::Error CommonDecoder::HandleNoop(uint32_t immediate_data_size,
+ const void* cmd_data) {
return error::kNoError;
}
-error::Error CommonDecoder::HandleSetToken(
- uint32 immediate_data_size,
- const void* cmd_data) {
+error::Error CommonDecoder::HandleSetToken(uint32_t immediate_data_size,
+ const void* cmd_data) {
const cmd::SetToken& args = *static_cast<const cmd::SetToken*>(cmd_data);
engine_->set_token(args.token);
return error::kNoError;
}
-error::Error CommonDecoder::HandleSetBucketSize(
- uint32 immediate_data_size,
- const void* cmd_data) {
+error::Error CommonDecoder::HandleSetBucketSize(uint32_t immediate_data_size,
+ const void* cmd_data) {
const cmd::SetBucketSize& args =
*static_cast<const cmd::SetBucketSize*>(cmd_data);
- uint32 bucket_id = args.bucket_id;
- uint32 size = args.size;
+ uint32_t bucket_id = args.bucket_id;
+ uint32_t size = args.size;
Bucket* bucket = CreateBucket(bucket_id);
bucket->SetSize(size);
return error::kNoError;
}
-error::Error CommonDecoder::HandleSetBucketData(
- uint32 immediate_data_size,
- const void* cmd_data) {
+error::Error CommonDecoder::HandleSetBucketData(uint32_t immediate_data_size,
+ const void* cmd_data) {
const cmd::SetBucketData& args =
*static_cast<const cmd::SetBucketData*>(cmd_data);
- uint32 bucket_id = args.bucket_id;
- uint32 offset = args.offset;
- uint32 size = args.size;
+ uint32_t bucket_id = args.bucket_id;
+ uint32_t offset = args.offset;
+ uint32_t size = args.size;
const void* data = GetSharedMemoryAs<const void*>(
args.shared_memory_id, args.shared_memory_offset, size);
if (!data) {
@@ -249,14 +248,14 @@ error::Error CommonDecoder::HandleSetBucketData(
}
error::Error CommonDecoder::HandleSetBucketDataImmediate(
- uint32 immediate_data_size,
+ uint32_t immediate_data_size,
const void* cmd_data) {
const cmd::SetBucketDataImmediate& args =
*static_cast<const cmd::SetBucketDataImmediate*>(cmd_data);
const void* data = GetImmediateDataAs<const void*>(args);
- uint32 bucket_id = args.bucket_id;
- uint32 offset = args.offset;
- uint32 size = args.size;
+ uint32_t bucket_id = args.bucket_id;
+ uint32_t offset = args.offset;
+ uint32_t size = args.size;
if (size > immediate_data_size) {
return error::kInvalidArguments;
}
@@ -270,20 +269,19 @@ error::Error CommonDecoder::HandleSetBucketDataImmediate(
return error::kNoError;
}
-error::Error CommonDecoder::HandleGetBucketStart(
- uint32 immediate_data_size,
- const void* cmd_data) {
+error::Error CommonDecoder::HandleGetBucketStart(uint32_t immediate_data_size,
+ const void* cmd_data) {
const cmd::GetBucketStart& args =
*static_cast<const cmd::GetBucketStart*>(cmd_data);
- uint32 bucket_id = args.bucket_id;
- uint32* result = GetSharedMemoryAs<uint32*>(
+ uint32_t bucket_id = args.bucket_id;
+ uint32_t* result = GetSharedMemoryAs<uint32_t*>(
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;
+ int32_t data_memory_id = args.data_memory_id;
+ uint32_t data_memory_offset = args.data_memory_offset;
+ uint32_t data_memory_size = args.data_memory_size;
+ uint8_t* data = NULL;
if (data_memory_size != 0 || data_memory_id != 0 || data_memory_offset != 0) {
- data = GetSharedMemoryAs<uint8*>(
+ data = GetSharedMemoryAs<uint8_t*>(
args.data_memory_id, args.data_memory_offset, args.data_memory_size);
if (!data) {
return error::kInvalidArguments;
@@ -300,23 +298,22 @@ error::Error CommonDecoder::HandleGetBucketStart(
if (!bucket) {
return error::kInvalidArguments;
}
- uint32 bucket_size = bucket->size();
+ uint32_t bucket_size = bucket->size();
*result = bucket_size;
if (data) {
- uint32 size = std::min(data_memory_size, bucket_size);
+ uint32_t size = std::min(data_memory_size, bucket_size);
memcpy(data, bucket->GetData(0, size), size);
}
return error::kNoError;
}
-error::Error CommonDecoder::HandleGetBucketData(
- uint32 immediate_data_size,
- const void* cmd_data) {
+error::Error CommonDecoder::HandleGetBucketData(uint32_t immediate_data_size,
+ const void* cmd_data) {
const cmd::GetBucketData& args =
*static_cast<const cmd::GetBucketData*>(cmd_data);
- uint32 bucket_id = args.bucket_id;
- uint32 offset = args.offset;
- uint32 size = args.size;
+ uint32_t bucket_id = args.bucket_id;
+ uint32_t offset = args.offset;
+ uint32_t size = args.size;
void* data = GetSharedMemoryAs<void*>(
args.shared_memory_id, args.shared_memory_offset, size);
if (!data) {
« no previous file with comments | « gpu/command_buffer/service/common_decoder.h ('k') | gpu/command_buffer/service/common_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698