summaryrefslogtreecommitdiffstats
path: root/o3d/command_buffer/client
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/command_buffer/client
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/command_buffer/client')
-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
7 files changed, 14 insertions, 15 deletions
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));
}