summaryrefslogtreecommitdiffstats
path: root/o3d
diff options
context:
space:
mode:
authorbradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 18:13:03 +0000
committerbradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-30 18:13:03 +0000
commitadeedaff76d28c2dd2c75bd399dbae21c415d037 (patch)
treef9d4666fc0b9a38ffc280e3dad387f4f42ab2ba7 /o3d
parentee7c5cea02327013f7d00cb022788b9e8c14419b (diff)
downloadchromium_src-adeedaff76d28c2dd2c75bd399dbae21c415d037.zip
chromium_src-adeedaff76d28c2dd2c75bd399dbae21c415d037.tar.gz
chromium_src-adeedaff76d28c2dd2c75bd399dbae21c415d037.tar.bz2
This fixes the Linux GYP build, fixing a number of (ahem!) problems
in command buffer code. Watch those signed/unsigned comparisons! Also, introduced an "invalid" value for CommandBufferOffset (INVALID_COMMAND_BUFFER_OFFSET) instead of using -1, since it's an unsigned value. Review URL: http://codereview.chromium.org/246038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27635 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r--o3d/DEPS_gyp9
-rw-r--r--o3d/command_buffer/client/cross/buffer_sync_proxy_test.cc8
-rw-r--r--o3d/command_buffer/client/cross/cmd_buffer_helper.cc4
-rw-r--r--o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc2
-rw-r--r--o3d/command_buffer/client/cross/effect_helper.cc1
-rw-r--r--o3d/command_buffer/client/cross/fenced_allocator.cc2
-rw-r--r--o3d/command_buffer/client/cross/fenced_allocator_test.cc6
-rw-r--r--o3d/command_buffer/client/cross/id_allocator_test.cc6
-rw-r--r--o3d/command_buffer/common/cross/bitfield_helpers_test.cc22
-rw-r--r--o3d/command_buffer/common/cross/buffer_sync_api.h1
-rw-r--r--o3d/command_buffer/common/cross/resource.h2
-rw-r--r--o3d/command_buffer/common/cross/rpc_imc.cc2
-rw-r--r--o3d/command_buffer/service/cross/buffer_rpc.cc36
-rw-r--r--o3d/command_buffer/service/cross/buffer_rpc_test.cc14
-rw-r--r--o3d/command_buffer/service/cross/cmd_buffer_engine.cc19
-rw-r--r--o3d/command_buffer/service/cross/cmd_buffer_engine_test.cc21
-rw-r--r--o3d/command_buffer/service/cross/cmd_parser.cc2
-rw-r--r--o3d/command_buffer/service/cross/cmd_parser_test.cc6
-rw-r--r--o3d/command_buffer/service/cross/mocks.h5
19 files changed, 88 insertions, 80 deletions
diff --git a/o3d/DEPS_gyp b/o3d/DEPS_gyp
index 19e974b..3fccefa 100644
--- a/o3d/DEPS_gyp
+++ b/o3d/DEPS_gyp
@@ -1,16 +1,16 @@
vars = {
"chromium_trunk": "http://src.chromium.org/svn/trunk",
"nixysa_rev": "54",
- "chromium_rev": "26475",
+ "chromium_rev": "27534",
"o3d_code_rev": "149",
"skia_rev": "341",
- "gyp_rev": "651",
+ "gyp_rev": "671",
"gtest_rev": "267",
"gflags_rev": "30",
"breakpad_rev": "391",
"v8_rev": "2901",
"icu_rev": "25717",
- "nacl_rev": "730",
+ "nacl_rev": "797",
}
deps = {
@@ -145,6 +145,9 @@ deps_os = {
Var("chromium_trunk") + "/src/tools/grit@" + Var("chromium_rev"),
"tools/data_pack":
Var("chromium_trunk") + "/src/tools/data_pack@" + Var("chromium_rev"),
+ "tools/xdisplaycheck":
+ Var("chromium_trunk") + "/src/tools/xdisplaycheck@" + Var("chromium_rev"),
+
},
}
diff --git a/o3d/command_buffer/client/cross/buffer_sync_proxy_test.cc b/o3d/command_buffer/client/cross/buffer_sync_proxy_test.cc
index f19c6bf..c5d473f 100644
--- a/o3d/command_buffer/client/cross/buffer_sync_proxy_test.cc
+++ b/o3d/command_buffer/client/cross/buffer_sync_proxy_test.cc
@@ -105,7 +105,7 @@ TEST_F(BufferSyncProxyTest, TestRegisterSharedMemory) {
expect.handle_count = 1;
server_mock()->AddSendCallExpect(expect);
- EXPECT_EQ(123, proxy()->RegisterSharedMemory(shm, size));
+ EXPECT_EQ(123u, proxy()->RegisterSharedMemory(shm, size));
}
// Tests the implementation of UnregisterSharedMemory, checking that it sends
@@ -172,7 +172,7 @@ TEST_F(BufferSyncProxyTest, TestGet) {
expect.handle_count = 0;
server_mock()->AddSendCallExpect(expect);
- EXPECT_EQ(72, proxy()->Get());
+ EXPECT_EQ(72u, proxy()->Get());
}
// Tests the implementation of GetToken, checking that it sends the correct
@@ -187,7 +187,7 @@ TEST_F(BufferSyncProxyTest, TestGetToken) {
expect.handle_count = 0;
server_mock()->AddSendCallExpect(expect);
- EXPECT_EQ(38, proxy()->GetToken());
+ EXPECT_EQ(38u, proxy()->GetToken());
}
// Tests the implementation of WaitGetChanges, checking that it sends the
@@ -203,7 +203,7 @@ TEST_F(BufferSyncProxyTest, TestWaitGetChanges) {
expect.handle_count = 0;
server_mock()->AddSendCallExpect(expect);
- EXPECT_EQ(53, proxy()->WaitGetChanges(101));
+ EXPECT_EQ(53u, proxy()->WaitGetChanges(101));
}
// Tests the implementation of SignalGetChanges, checking that it sends the
diff --git a/o3d/command_buffer/client/cross/cmd_buffer_helper.cc b/o3d/command_buffer/client/cross/cmd_buffer_helper.cc
index 209f297..10faddc 100644
--- a/o3d/command_buffer/client/cross/cmd_buffer_helper.cc
+++ b/o3d/command_buffer/client/cross/cmd_buffer_helper.cc
@@ -125,8 +125,8 @@ void CommandBufferHelper::WaitForToken(unsigned int token) {
// check for an error.
void CommandBufferHelper::WaitForGetChange() {
CommandBufferOffset new_get = interface_->WaitGetChanges(get_);
- if (new_get == get_ || new_get == -1) {
- // If get_ didn't change or is invalid (-1), it means an error may have
+ if (new_get == get_ || new_get == kInvalidCommandBufferOffset) {
+ // If get_ didn't change or is invalid, it means an error may have
// occured. Check that.
BufferSyncInterface::ParserStatus status = interface_->GetStatus();
if (status != BufferSyncInterface::kParsing) {
diff --git a/o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc b/o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc
index ab7a6a8..d72d920 100644
--- a/o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc
+++ b/o3d/command_buffer/client/cross/cmd_buffer_helper_test.cc
@@ -128,7 +128,7 @@ TEST_F(CommandBufferHelperTest, TestCommandProcessing) {
EXPECT_TRUE(engine()->parser() != NULL);
EXPECT_EQ(BufferSyncInterface::kParsing, engine()->GetStatus());
EXPECT_EQ(BufferSyncInterface::kParseNoError, engine()->GetParseError());
- EXPECT_EQ(0, engine()->Get());
+ EXPECT_EQ(0u, engine()->Get());
// Add 3 commands through the helper
AddCommandWithExpect(BufferSyncInterface::kParseNoError, 1, 0, NULL);
diff --git a/o3d/command_buffer/client/cross/effect_helper.cc b/o3d/command_buffer/client/cross/effect_helper.cc
index 6cfbf66..3f2430b 100644
--- a/o3d/command_buffer/client/cross/effect_helper.cc
+++ b/o3d/command_buffer/client/cross/effect_helper.cc
@@ -235,7 +235,6 @@ bool EffectHelper::GetEffectStreams(ResourceId effect_id,
for (unsigned int i = 0; i < stream_count; i += max_stream_per_batch) {
unsigned int count = std::min(stream_count - i, max_stream_per_batch);
for (unsigned int j = 0 ; j < count; ++j) {
- EffectStreamDesc *desc = &((*descs)[i + j]);
Desc *raw_desc = raw_descs + j;
helper_->GetStreamDesc(effect_id, i + j, sizeof(*raw_desc),
shm_id_,
diff --git a/o3d/command_buffer/client/cross/fenced_allocator.cc b/o3d/command_buffer/client/cross/fenced_allocator.cc
index 3c66f5d..08c0c15 100644
--- a/o3d/command_buffer/client/cross/fenced_allocator.cc
+++ b/o3d/command_buffer/client/cross/fenced_allocator.cc
@@ -50,7 +50,7 @@ FencedAllocator::~FencedAllocator() {
i = WaitForTokenAndFreeBlock(i);
}
}
- DCHECK_EQ(blocks_.size(), 1);
+ DCHECK_EQ(blocks_.size(), 1u);
DCHECK_EQ(blocks_[0].state, FREE);
}
diff --git a/o3d/command_buffer/client/cross/fenced_allocator_test.cc b/o3d/command_buffer/client/cross/fenced_allocator_test.cc
index 9d63cc0..362254a 100644
--- a/o3d/command_buffer/client/cross/fenced_allocator_test.cc
+++ b/o3d/command_buffer/client/cross/fenced_allocator_test.cc
@@ -214,7 +214,7 @@ TEST_F(FencedAllocatorTest, TestGetLargestFreeSize) {
FencedAllocator::Offset offset = allocator()->Alloc(kBufferSize);
ASSERT_NE(FencedAllocator::kInvalidOffset, offset);
- EXPECT_EQ(0, allocator()->GetLargestFreeSize());
+ EXPECT_EQ(0u, allocator()->GetLargestFreeSize());
allocator()->Free(offset);
EXPECT_EQ(kBufferSize, allocator()->GetLargestFreeSize());
@@ -243,7 +243,7 @@ TEST_F(FencedAllocatorTest, TestGetLargestFreeSize) {
offset1 = allocator()->Alloc(2 * kSize);
ASSERT_NE(FencedAllocator::kInvalidOffset, offset1);
- EXPECT_EQ(0, allocator()->GetLargestFreeSize());
+ EXPECT_EQ(0u, allocator()->GetLargestFreeSize());
allocator()->Free(offset);
allocator()->Free(offset1);
@@ -257,7 +257,7 @@ TEST_F(FencedAllocatorTest, TestGetLargestFreeOrPendingSize) {
FencedAllocator::Offset offset = allocator()->Alloc(kBufferSize);
ASSERT_NE(FencedAllocator::kInvalidOffset, offset);
- EXPECT_EQ(0, allocator()->GetLargestFreeOrPendingSize());
+ EXPECT_EQ(0u, allocator()->GetLargestFreeOrPendingSize());
allocator()->Free(offset);
EXPECT_EQ(kBufferSize, allocator()->GetLargestFreeOrPendingSize());
diff --git a/o3d/command_buffer/client/cross/id_allocator_test.cc b/o3d/command_buffer/client/cross/id_allocator_test.cc
index dacc9ef..f099a2b 100644
--- a/o3d/command_buffer/client/cross/id_allocator_test.cc
+++ b/o3d/command_buffer/client/cross/id_allocator_test.cc
@@ -84,7 +84,7 @@ TEST_F(IdAllocatorTest, TestAdvanced) {
// Allocate a significant number of resources.
const unsigned int kNumResources = 100;
ResourceId ids[kNumResources];
- for (int i = 0; i < kNumResources; ++i) {
+ for (unsigned int i = 0; i < kNumResources; ++i) {
ids[i] = allocator->AllocateID();
EXPECT_TRUE(allocator->InUse(ids[i]));
}
@@ -92,12 +92,12 @@ TEST_F(IdAllocatorTest, TestAdvanced) {
// Check that the allocation is conservative with resource IDs, that is that
// the resource IDs don't go over kNumResources - so that the service doesn't
// have to allocate too many internal structures when the resources are used.
- for (int i = 0; i < kNumResources; ++i) {
+ for (unsigned int i = 0; i < kNumResources; ++i) {
EXPECT_GT(kNumResources, ids[i]);
}
// Check that the next resources are still free.
- for (int i = 0; i < kNumResources; ++i) {
+ for (unsigned int i = 0; i < kNumResources; ++i) {
EXPECT_FALSE(allocator->InUse(kNumResources + i));
}
diff --git a/o3d/command_buffer/common/cross/bitfield_helpers_test.cc b/o3d/command_buffer/common/cross/bitfield_helpers_test.cc
index ab88de42..4f42fcf 100644
--- a/o3d/command_buffer/common/cross/bitfield_helpers_test.cc
+++ b/o3d/command_buffer/common/cross/bitfield_helpers_test.cc
@@ -40,28 +40,28 @@ namespace command_buffer {
// Tests that BitField<>::Get returns the right bits.
TEST(BitFieldTest, TestGet) {
- unsigned int value = 0x12345678;
- EXPECT_EQ(0x8, (BitField<0, 4>::Get(value)));
- EXPECT_EQ(0x45, (BitField<12, 8>::Get(value)));
- EXPECT_EQ(0x12345678, (BitField<0, 32>::Get(value)));
+ unsigned int value = 0x12345678u;
+ EXPECT_EQ(0x8u, (BitField<0, 4>::Get(value)));
+ EXPECT_EQ(0x45u, (BitField<12, 8>::Get(value)));
+ EXPECT_EQ(0x12345678u, (BitField<0, 32>::Get(value)));
}
// Tests that BitField<>::MakeValue generates the right bits.
TEST(BitFieldTest, TestMakeValue) {
- EXPECT_EQ(0x00000003, (BitField<0, 4>::MakeValue(0x3)));
- EXPECT_EQ(0x00023000, (BitField<12, 8>::MakeValue(0x123)));
- EXPECT_EQ(0x87654321, (BitField<0, 32>::MakeValue(0x87654321)));
+ EXPECT_EQ(0x00000003u, (BitField<0, 4>::MakeValue(0x3)));
+ EXPECT_EQ(0x00023000u, (BitField<12, 8>::MakeValue(0x123)));
+ EXPECT_EQ(0x87654321u, (BitField<0, 32>::MakeValue(0x87654321)));
}
// Tests that BitField<>::Set modifies the right bits.
TEST(BitFieldTest, TestSet) {
- unsigned int value = 0x12345678;
+ unsigned int value = 0x12345678u;
BitField<0, 4>::Set(&value, 0x9);
- EXPECT_EQ(0x12345679, value);
+ EXPECT_EQ(0x12345679u, value);
BitField<12, 8>::Set(&value, 0x123);
- EXPECT_EQ(0x12323679, value);
+ EXPECT_EQ(0x12323679u, value);
BitField<0, 32>::Set(&value, 0x87654321);
- EXPECT_EQ(0x87654321, value);
+ EXPECT_EQ(0x87654321u, value);
}
} // namespace command_buffer
diff --git a/o3d/command_buffer/common/cross/buffer_sync_api.h b/o3d/command_buffer/common/cross/buffer_sync_api.h
index e216e7a..bd61b5e 100644
--- a/o3d/command_buffer/common/cross/buffer_sync_api.h
+++ b/o3d/command_buffer/common/cross/buffer_sync_api.h
@@ -42,6 +42,7 @@ namespace command_buffer {
// Command buffer type.
typedef size_t CommandBufferOffset;
+const CommandBufferOffset kInvalidCommandBufferOffset = ~0u;
// Interface class for the Command Buffer Synchronous API.
// This is the part of the command buffer API that is accessible through the
diff --git a/o3d/command_buffer/common/cross/resource.h b/o3d/command_buffer/common/cross/resource.h
index a556c19..3cd4d3b 100644
--- a/o3d/command_buffer/common/cross/resource.h
+++ b/o3d/command_buffer/common/cross/resource.h
@@ -199,7 +199,7 @@ unsigned int GetBlockSizeY(Format format);
// Gets the dimension of a mipmap level given the dimension of the base
// level. Every mipmap level is half the size of the previous level, rounding
// down.
-static unsigned int GetMipMapDimension(unsigned int base,
+inline unsigned int GetMipMapDimension(unsigned int base,
unsigned int level) {
DCHECK_GT(base, 0U);
return std::max(1U, base >> level);
diff --git a/o3d/command_buffer/common/cross/rpc_imc.cc b/o3d/command_buffer/common/cross/rpc_imc.cc
index f5c3c9e..391f139 100644
--- a/o3d/command_buffer/common/cross/rpc_imc.cc
+++ b/o3d/command_buffer/common/cross/rpc_imc.cc
@@ -127,7 +127,7 @@ RPCImplInterface::ReturnValue IMCSender::SendCall(
RPCImplInterface::ReturnValue ret;
result = NaclReceiveData(handle_, &ret, sizeof(ret), 0);
- DCHECK_EQ(sizeof(ret), result);
+ DCHECK_EQ(sizeof(ret), static_cast<size_t>(result));
return ret;
}
diff --git a/o3d/command_buffer/service/cross/buffer_rpc.cc b/o3d/command_buffer/service/cross/buffer_rpc.cc
index c09f526..668cc32 100644
--- a/o3d/command_buffer/service/cross/buffer_rpc.cc
+++ b/o3d/command_buffer/service/cross/buffer_rpc.cc
@@ -49,33 +49,33 @@ BufferRPCImpl::ReturnValue BufferRPCImpl::DoCall(int message_id,
size_t handle_count) {
switch (message_id) {
case INIT_CONNECTION: {
- DCHECK_EQ(0, size);
- DCHECK_EQ(0, handle_count);
+ DCHECK_EQ(0u, size);
+ DCHECK_EQ(0u, handle_count);
handler_->InitConnection();
return 0;
}
case CLOSE_CONNECTION:
- DCHECK_EQ(0, size);
- DCHECK_EQ(0, handle_count);
+ DCHECK_EQ(0u, size);
+ DCHECK_EQ(0u, handle_count);
handler_->CloseConnection();
return 0;
case REGISTER_SHARED_MEMORY: {
DCHECK_EQ(sizeof(size_t), size); // NOLINT
- DCHECK_EQ(1, handle_count);
+ DCHECK_EQ(1u, handle_count);
RPCShmHandle buffer = static_cast<RPCShmHandle>(handles[0]);
return handler_->RegisterSharedMemory(buffer,
*static_cast<const size_t *>(data));
}
case UNREGISTER_SHARED_MEMORY: {
DCHECK_EQ(sizeof(unsigned int), size); // NOLINT
- DCHECK_EQ(0, handle_count);
+ DCHECK_EQ(0u, handle_count);
unsigned int shm_id = *(static_cast<const unsigned int *>(data));
handler_->UnregisterSharedMemory(shm_id);
return 0;
}
case SET_COMMAND_BUFFER: {
DCHECK_EQ(sizeof(SetCommandBufferStruct), size);
- DCHECK_EQ(0, handle_count);
+ DCHECK_EQ(0u, handle_count);
const SetCommandBufferStruct *params =
static_cast<const SetCommandBufferStruct *>(data);
handler_->SetCommandBuffer(params->shm_id,
@@ -86,30 +86,30 @@ BufferRPCImpl::ReturnValue BufferRPCImpl::DoCall(int message_id,
}
case PUT: {
DCHECK_EQ(sizeof(CommandBufferOffset), size);
- DCHECK_EQ(0, handle_count);
+ DCHECK_EQ(0u, handle_count);
CommandBufferOffset offset =
*(static_cast<const CommandBufferOffset *>(data));
handler_->Put(offset);
return 0;
}
case GET:
- DCHECK_EQ(0, size);
- DCHECK_EQ(0, handle_count);
+ DCHECK_EQ(0u, size);
+ DCHECK_EQ(0u, handle_count);
return handler_->Get();
case GET_TOKEN:
- DCHECK_EQ(0, size);
- DCHECK_EQ(0, handle_count);
+ DCHECK_EQ(0u, size);
+ DCHECK_EQ(0u, handle_count);
return handler_->GetToken();
case WAIT_GET_CHANGES: {
DCHECK_EQ(sizeof(CommandBufferOffset), size);
- DCHECK_EQ(0, handle_count);
+ DCHECK_EQ(0u, handle_count);
CommandBufferOffset current_value =
*(static_cast<const CommandBufferOffset *>(data));
return handler_->WaitGetChanges(current_value);
}
case SIGNAL_GET_CHANGES: {
DCHECK_EQ(sizeof(SignalGetChangesStruct), size);
- DCHECK_EQ(0, handle_count);
+ DCHECK_EQ(0u, handle_count);
const SignalGetChangesStruct *params =
static_cast<const SignalGetChangesStruct *>(data);
handler_->SignalGetChanges(params->current_value,
@@ -117,13 +117,13 @@ BufferRPCImpl::ReturnValue BufferRPCImpl::DoCall(int message_id,
return 0;
}
case GET_STATUS: {
- DCHECK_EQ(0, size);
- DCHECK_EQ(0, handle_count);
+ DCHECK_EQ(0u, size);
+ DCHECK_EQ(0u, handle_count);
return handler_->GetStatus();
}
case GET_PARSE_ERROR: {
- DCHECK_EQ(0, size);
- DCHECK_EQ(0, handle_count);
+ DCHECK_EQ(0u, size);
+ DCHECK_EQ(0u, handle_count);
return handler_->GetParseError();
}
default:
diff --git a/o3d/command_buffer/service/cross/buffer_rpc_test.cc b/o3d/command_buffer/service/cross/buffer_rpc_test.cc
index a0afd7b..721b20b 100644
--- a/o3d/command_buffer/service/cross/buffer_rpc_test.cc
+++ b/o3d/command_buffer/service/cross/buffer_rpc_test.cc
@@ -79,7 +79,7 @@ TEST_F(BufferRPCImplTest, TestRegisterSharedMemory) {
EXPECT_CALL(buffer_sync_mock(), RegisterSharedMemory(shm, size))
.WillOnce(Return(1234));
RPCHandle handles[1] = {shm};
- EXPECT_EQ(1234, buffer_rpc_impl()->DoCall(
+ EXPECT_EQ(1234u, buffer_rpc_impl()->DoCall(
BufferRPCImpl::REGISTER_SHARED_MEMORY, &size, sizeof(size), handles, 1));
}
@@ -115,7 +115,7 @@ TEST_F(BufferRPCImplTest, TestPut) {
// properly forwarded.
TEST_F(BufferRPCImplTest, TestGet) {
EXPECT_CALL(buffer_sync_mock(), Get()).WillOnce(Return(9375));
- EXPECT_EQ(9375, buffer_rpc_impl()->DoCall(BufferRPCImpl::GET, NULL, 0, NULL,
+ EXPECT_EQ(9375u, buffer_rpc_impl()->DoCall(BufferRPCImpl::GET, NULL, 0, NULL,
0));
}
@@ -123,7 +123,7 @@ TEST_F(BufferRPCImplTest, TestGet) {
// properly forwarded.
TEST_F(BufferRPCImplTest, TestGetToken) {
EXPECT_CALL(buffer_sync_mock(), GetToken()).WillOnce(Return(1618));
- EXPECT_EQ(1618, buffer_rpc_impl()->DoCall(BufferRPCImpl::GET_TOKEN, NULL, 0,
+ EXPECT_EQ(1618u, buffer_rpc_impl()->DoCall(BufferRPCImpl::GET_TOKEN, NULL, 0,
NULL, 0));
}
@@ -133,7 +133,7 @@ TEST_F(BufferRPCImplTest, TestWaitGetChanges) {
CommandBufferOffset value = 339;
EXPECT_CALL(buffer_sync_mock(), WaitGetChanges(value))
.WillOnce(Return(16180));
- EXPECT_EQ(16180, buffer_rpc_impl()->DoCall(BufferRPCImpl::WAIT_GET_CHANGES,
+ EXPECT_EQ(16180u, buffer_rpc_impl()->DoCall(BufferRPCImpl::WAIT_GET_CHANGES,
&value, sizeof(value), NULL, 0));
}
@@ -152,7 +152,8 @@ TEST_F(BufferRPCImplTest, TestSignalGetChanges) {
TEST_F(BufferRPCImplTest, TestGetStatus) {
EXPECT_CALL(buffer_sync_mock(), GetStatus())
.WillOnce(Return(BufferSyncInterface::kParseError));
- EXPECT_EQ(BufferSyncInterface::kParseError,
+ EXPECT_EQ(static_cast<BufferRPCImpl::ReturnValue>(
+ BufferSyncInterface::kParseError),
buffer_rpc_impl()->DoCall(BufferRPCImpl::GET_STATUS, NULL, 0, NULL,
0));
}
@@ -162,7 +163,8 @@ TEST_F(BufferRPCImplTest, TestGetStatus) {
TEST_F(BufferRPCImplTest, TestGetParseError) {
EXPECT_CALL(buffer_sync_mock(), GetParseError())
.WillOnce(Return(BufferSyncInterface::kParseOutOfBounds));
- EXPECT_EQ(BufferSyncInterface::kParseOutOfBounds,
+ EXPECT_EQ(static_cast<BufferRPCImpl::ReturnValue>(
+ BufferSyncInterface::kParseOutOfBounds),
buffer_rpc_impl()->DoCall(BufferRPCImpl::GET_PARSE_ERROR, NULL, 0,
NULL, 0));
}
diff --git a/o3d/command_buffer/service/cross/cmd_buffer_engine.cc b/o3d/command_buffer/service/cross/cmd_buffer_engine.cc
index b39f993..9637206 100644
--- a/o3d/command_buffer/service/cross/cmd_buffer_engine.cc
+++ b/o3d/command_buffer/service/cross/cmd_buffer_engine.cc
@@ -129,12 +129,13 @@ void CommandBufferEngine::Put(CommandBufferOffset offset) {
}
}
-// Retrieves the get value. This returns -1 if there is no current parser.
+// Retrieves the get value. This returns kInvalidCommandBufferOffset
+// if there is no current parser.
CommandBufferOffset CommandBufferEngine::Get() {
if (parser_.get()) {
return parser_->get();
} else {
- return -1;
+ return kInvalidCommandBufferOffset;
}
}
@@ -143,9 +144,10 @@ unsigned int CommandBufferEngine::GetToken() {
return token_;
}
-// Executes commands until get is different from the value passed in. It will
-// return immediately if the get value is already different, or if the engine
-// is not in the kParsing status, or if the buffer is empty. It will return -1
+// Executes commands until get is different from the value passed
+// in. It will return immediately if the get value is already
+// different, or if the engine is not in the kParsing status, or if
+// the buffer is empty. It will return kInvalidCommandBufferOffset
// if there is no current buffer.
CommandBufferOffset CommandBufferEngine::WaitGetChanges(
CommandBufferOffset current_value) {
@@ -157,7 +159,7 @@ CommandBufferOffset CommandBufferEngine::WaitGetChanges(
}
return parser_->get();
} else {
- return -1;
+ return kInvalidCommandBufferOffset;
}
}
@@ -279,10 +281,11 @@ bool CommandBufferEngine::DoWork() {
}
// Signals that get has changed, sending a RPC message back to the client. It
-// will send -1 if there is no current buffer.
+// will send kInvalidCommandBufferOffset if there is no current buffer.
void CommandBufferEngine::DoSignalChangedGet(int rpc_message_id) {
DCHECK(client_rpc_);
- CommandBufferOffset get = parser_.get() ? parser_->get() : -1;
+ CommandBufferOffset get = parser_.get() ? parser_->get() :
+ kInvalidCommandBufferOffset;
client_rpc_->SendCall(rpc_message_id, &get, sizeof(get), NULL, 0);
}
diff --git a/o3d/command_buffer/service/cross/cmd_buffer_engine_test.cc b/o3d/command_buffer/service/cross/cmd_buffer_engine_test.cc
index 5e06153..7f32b3a 100644
--- a/o3d/command_buffer/service/cross/cmd_buffer_engine_test.cc
+++ b/o3d/command_buffer/service/cross/cmd_buffer_engine_test.cc
@@ -135,31 +135,31 @@ TEST_F(CommandBufferEngineTest, TestInitialization) {
EXPECT_TRUE(engine()->parser() == NULL);
EXPECT_EQ(BufferSyncInterface::kNotConnected, engine()->GetStatus());
EXPECT_EQ(BufferSyncInterface::kParseNoError, engine()->GetParseError());
- EXPECT_EQ(-1, engine()->Get());
- EXPECT_EQ(0, engine()->GetToken());
+ EXPECT_EQ(kInvalidCommandBufferOffset, engine()->Get());
+ EXPECT_EQ(0u, engine()->GetToken());
engine()->InitConnection();
EXPECT_EQ(BufferSyncInterface::kNoBuffer, engine()->GetStatus());
EXPECT_EQ(BufferSyncInterface::kParseNoError, engine()->GetParseError());
- EXPECT_EQ(-1, engine()->Get());
+ EXPECT_EQ(kInvalidCommandBufferOffset, engine()->Get());
CommandBufferEntry *entries = InitCommandBuffer(25, 5);
ASSERT_TRUE(entries != NULL);
EXPECT_EQ(BufferSyncInterface::kParsing, engine()->GetStatus());
EXPECT_EQ(BufferSyncInterface::kParseNoError, engine()->GetParseError());
- EXPECT_EQ(5, engine()->Get());
+ EXPECT_EQ(5u, engine()->Get());
EXPECT_TRUE(engine()->parser() != NULL);
engine()->set_token(5678);
- EXPECT_EQ(5678, engine()->GetToken());
+ EXPECT_EQ(5678u, engine()->GetToken());
engine()->CloseConnection();
DestroyCommandBuffer();
EXPECT_EQ(BufferSyncInterface::kNotConnected, engine()->GetStatus());
EXPECT_EQ(BufferSyncInterface::kParseNoError, engine()->GetParseError());
- EXPECT_EQ(-1, engine()->Get());
+ EXPECT_EQ(kInvalidCommandBufferOffset, engine()->Get());
EXPECT_TRUE(engine()->parser() == NULL);
}
@@ -296,7 +296,7 @@ TEST_F(CommandBufferEngineTest, TestCommandWrapping) {
1,
2,
args1);
- DCHECK_EQ(10, put);
+ DCHECK_EQ(10u, put);
put = 0;
CommandBufferEntry args2[2];
@@ -373,7 +373,7 @@ TEST_F(CommandBufferEngineTest, TestSetBufferAndClose) {
engine()->SetCommandBuffer(shm_id, 0, kShmSize, 0);
EXPECT_EQ(BufferSyncInterface::kParsing, engine()->GetStatus());
EXPECT_EQ(BufferSyncInterface::kParseNoError, engine()->GetParseError());
- EXPECT_EQ(0, engine()->Get());
+ EXPECT_EQ(0u, engine()->Get());
// Destroy the old command buffer.
DestroyCommandBuffer();
@@ -491,7 +491,6 @@ TEST_F(CommandBufferEngineTest, TestNonRecoverableError) {
2,
args1);
- CommandBufferOffset fail_get = put;
CommandHeader header;
header.size = 3;
header.command = 4;
@@ -559,7 +558,7 @@ TEST_F(CommandBufferEngineTest, TestDoWork) {
while (engine()->HasWork()) {
EXPECT_TRUE(engine()->DoWork());
}
- EXPECT_EQ(0, process_mock()->message_count());
+ EXPECT_EQ(0u, process_mock()->message_count());
EXPECT_FALSE(process_mock()->would_have_blocked());
Mock::VerifyAndClearExpectations(process_mock());
@@ -583,7 +582,7 @@ TEST_F(CommandBufferEngineTest, TestDoWork) {
args1);
CommandBufferEntry args2[2];
- args2[0].value_uint32 = 5;
+ args2[0].value_uint32 = 5u;
args2[1].value_float = 6.f;
put += AddCommandWithExpect(entries + put,
BufferSyncInterface::kParseNoError,
diff --git a/o3d/command_buffer/service/cross/cmd_parser.cc b/o3d/command_buffer/service/cross/cmd_parser.cc
index 843d0b8..ffe1d09 100644
--- a/o3d/command_buffer/service/cross/cmd_parser.cc
+++ b/o3d/command_buffer/service/cross/cmd_parser.cc
@@ -49,7 +49,7 @@ CommandParser::CommandParser(void *shm_address,
// check proper alignments.
DCHECK_EQ(0, (reinterpret_cast<intptr_t>(shm_address)) % 4);
DCHECK_EQ(0, offset % 4);
- DCHECK_EQ(0, size % 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;
diff --git a/o3d/command_buffer/service/cross/cmd_parser_test.cc b/o3d/command_buffer/service/cross/cmd_parser_test.cc
index 3d50d8a..ae48a9b 100644
--- a/o3d/command_buffer/service/cross/cmd_parser_test.cc
+++ b/o3d/command_buffer/service/cross/cmd_parser_test.cc
@@ -96,8 +96,8 @@ class CommandParserTest : public testing::Test {
// Tests initialization conditions.
TEST_F(CommandParserTest, TestInit) {
scoped_ptr<CommandParser> parser(MakeParser(10));
- EXPECT_EQ(0, parser->get());
- EXPECT_EQ(0, parser->put());
+ EXPECT_EQ(0u, parser->get());
+ EXPECT_EQ(0u, parser->put());
EXPECT_TRUE(parser->IsEmpty());
}
@@ -227,7 +227,7 @@ TEST_F(CommandParserTest, TestWrap) {
param.value_int32 = 5;
AddDoCommandExpect(BufferSyncInterface::kParseNoError, 3, 1, &param);
- DCHECK_EQ(5, put);
+ DCHECK_EQ(5u, put);
put = 0;
parser->set_put(put);
EXPECT_EQ(put, parser->put());
diff --git a/o3d/command_buffer/service/cross/mocks.h b/o3d/command_buffer/service/cross/mocks.h
index dbd4c62..3135249 100644
--- a/o3d/command_buffer/service/cross/mocks.h
+++ b/o3d/command_buffer/service/cross/mocks.h
@@ -90,8 +90,8 @@ class AsyncAPIMock : public AsyncAPIInterface {
unsigned int arg_count,
const void* _args) {
DCHECK(engine_);
- DCHECK_EQ(1, command);
- DCHECK_EQ(1, arg_count);
+ DCHECK_EQ(1u, command);
+ DCHECK_EQ(1u, arg_count);
const CommandBufferEntry* args =
static_cast<const CommandBufferEntry*>(_args);
engine_->set_token(args[0].value_uint32);
@@ -133,6 +133,7 @@ class RPCProcessMock : public RPCProcessInterface {
bool AddMessage() {
++message_count_;
+ return true;
}
bool would_have_blocked() { return would_have_blocked_; }