summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 00:28:13 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-04 00:28:13 +0000
commitef92852d257ab2c77bdbea215268aade5a3a9442 (patch)
treed1c065649290a2179e74c9bb49bfbe2411902176 /gpu
parent3b1ccf61e2e0b94ed0f9846b1b4e993a927cd553 (diff)
downloadchromium_src-ef92852d257ab2c77bdbea215268aade5a3a9442.zip
chromium_src-ef92852d257ab2c77bdbea215268aade5a3a9442.tar.gz
chromium_src-ef92852d257ab2c77bdbea215268aade5a3a9442.tar.bz2
Fix some memory leaks in GPU tests.
BUG=42904 TEST=run the tests Review URL: http://codereview.chromium.org/1796010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46303 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper_test.cc1
-rw-r--r--gpu/command_buffer/client/fenced_allocator.h6
-rw-r--r--gpu/command_buffer/client/fenced_allocator_test.cc7
-rw-r--r--gpu/command_buffer/client/ring_buffer_test.cc29
4 files changed, 13 insertions, 30 deletions
diff --git a/gpu/command_buffer/client/cmd_buffer_helper_test.cc b/gpu/command_buffer/client/cmd_buffer_helper_test.cc
index d754f5b..2f1d4af 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper_test.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper_test.cc
@@ -65,7 +65,6 @@ class CommandBufferHelperTest : public testing::Test {
virtual void TearDown() {
// If the GPUProcessor posts any tasks, this forces them to run.
MessageLoop::current()->RunAllPending();
- helper_.release();
}
// Adds a command to the buffer through the helper, while adding it as an
diff --git a/gpu/command_buffer/client/fenced_allocator.h b/gpu/command_buffer/client/fenced_allocator.h
index 59919f3..56eb974 100644
--- a/gpu/command_buffer/client/fenced_allocator.h
+++ b/gpu/command_buffer/client/fenced_allocator.h
@@ -139,8 +139,8 @@ class FencedAllocator {
class FencedAllocatorWrapper {
public:
FencedAllocatorWrapper(unsigned int size,
- CommandBufferHelper *helper,
- void *base)
+ CommandBufferHelper* helper,
+ void* base)
: allocator_(size, helper),
base_(base) { }
@@ -229,7 +229,7 @@ class FencedAllocatorWrapper {
private:
FencedAllocator allocator_;
- void *base_;
+ void* base_;
DISALLOW_IMPLICIT_CONSTRUCTORS(FencedAllocatorWrapper);
};
diff --git a/gpu/command_buffer/client/fenced_allocator_test.cc b/gpu/command_buffer/client/fenced_allocator_test.cc
index 8dc1b780..1d5c970 100644
--- a/gpu/command_buffer/client/fenced_allocator_test.cc
+++ b/gpu/command_buffer/client/fenced_allocator_test.cc
@@ -67,10 +67,6 @@ class BaseFencedAllocatorTest : public testing::Test {
return command_buffer_->GetState().token;
}
- virtual void TearDown() {
- helper_.release();
- }
-
base::ScopedNSAutoreleasePool autorelease_pool_;
base::AtExitManager at_exit_manager_;
MessageLoop message_loop_;
@@ -101,7 +97,6 @@ class FencedAllocatorTest : public BaseFencedAllocatorTest {
MessageLoop::current()->RunAllPending();
EXPECT_TRUE(allocator_->CheckConsistency());
- allocator_.release();
BaseFencedAllocatorTest::TearDown();
}
@@ -338,8 +333,6 @@ class FencedAllocatorWrapperTest : public BaseFencedAllocatorTest {
MessageLoop::current()->RunAllPending();
EXPECT_TRUE(allocator_->CheckConsistency());
- allocator_.release();
- buffer_.release();
BaseFencedAllocatorTest::TearDown();
}
diff --git a/gpu/command_buffer/client/ring_buffer_test.cc b/gpu/command_buffer/client/ring_buffer_test.cc
index 4ba74ac..8af4eb5 100644
--- a/gpu/command_buffer/client/ring_buffer_test.cc
+++ b/gpu/command_buffer/client/ring_buffer_test.cc
@@ -68,10 +68,6 @@ class BaseRingBufferTest : public testing::Test {
return command_buffer_->GetState().token;
}
- virtual void TearDown() {
- helper_.release();
- }
-
base::ScopedNSAutoreleasePool autorelease_pool_;
base::AtExitManager at_exit_manager_;
MessageLoop message_loop_;
@@ -102,8 +98,6 @@ class RingBufferTest : public BaseRingBufferTest {
// If the GPUProcessor posts any tasks, this forces them to run.
MessageLoop::current()->RunAllPending();
- allocator_.release();
-
BaseRingBufferTest::TearDown();
}
@@ -119,7 +113,7 @@ TEST_F(RingBufferTest, TestBasic) {
EXPECT_GE(kBufferSize, offset - kBaseOffset + kSize);
EXPECT_EQ(kBufferSize, allocator_->GetLargestFreeOrPendingSize());
EXPECT_EQ(kBufferSize - kSize, allocator_->GetLargestFreeSizeNoWaiting());
- int32 token = helper_.get()->InsertToken();
+ int32 token = helper_->InsertToken();
allocator_->FreePendingToken(offset, token);
}
@@ -134,7 +128,7 @@ TEST_F(RingBufferTest, TestFreePendingToken) {
for (unsigned int ii = 0; ii < kAllocCount; ++ii) {
RingBuffer::Offset offset = allocator_->Alloc(kSize);
EXPECT_GE(kBufferSize, offset - kBaseOffset + kSize);
- tokens[ii] = helper_.get()->InsertToken();
+ tokens[ii] = helper_->InsertToken();
allocator_->FreePendingToken(offset, tokens[ii]);
}
@@ -149,7 +143,7 @@ TEST_F(RingBufferTest, TestFreePendingToken) {
// Check that the token has indeed passed.
EXPECT_LE(tokens[0], GetToken());
- allocator_->FreePendingToken(offset1, helper_.get()->InsertToken());
+ allocator_->FreePendingToken(offset1, helper_->InsertToken());
}
// Tests GetLargestFreeSizeNoWaiting
@@ -158,7 +152,7 @@ TEST_F(RingBufferTest, TestGetLargestFreeSizeNoWaiting) {
RingBuffer::Offset offset = allocator_->Alloc(kBufferSize);
EXPECT_EQ(0u, allocator_->GetLargestFreeSizeNoWaiting());
- allocator_->FreePendingToken(offset, helper_.get()->InsertToken());
+ allocator_->FreePendingToken(offset, helper_->InsertToken());
}
TEST_F(RingBufferTest, TestFreeBug) {
@@ -200,9 +194,6 @@ class RingBufferWrapperTest : public BaseRingBufferTest {
// If the GPUProcessor posts any tasks, this forces them to run.
MessageLoop::current()->RunAllPending();
- allocator_.release();
- buffer_.release();
-
BaseRingBufferTest::TearDown();
}
@@ -219,13 +210,13 @@ TEST_F(RingBufferWrapperTest, TestBasic) {
EXPECT_LE(buffer_start_, static_cast<int8*>(pointer));
EXPECT_GE(kBufferSize, static_cast<int8*>(pointer) - buffer_start_ + kSize);
- allocator_->FreePendingToken(pointer, helper_.get()->InsertToken());
+ allocator_->FreePendingToken(pointer, helper_->InsertToken());
int8* pointer_int8 = allocator_->AllocTyped<int8>(kSize);
ASSERT_TRUE(pointer_int8);
EXPECT_LE(buffer_start_, pointer_int8);
EXPECT_GE(buffer_start_ + kBufferSize, pointer_int8 + kSize);
- allocator_->FreePendingToken(pointer_int8, helper_.get()->InsertToken());
+ allocator_->FreePendingToken(pointer_int8, helper_->InsertToken());
unsigned int* pointer_uint = allocator_->AllocTyped<unsigned int>(kSize);
ASSERT_TRUE(pointer_uint);
@@ -237,7 +228,7 @@ TEST_F(RingBufferWrapperTest, TestBasic) {
// directly, except from the remaining size.
EXPECT_EQ(kBufferSize - kSize - kSize - kSize * sizeof(*pointer_uint),
allocator_->GetLargestFreeSizeNoWaiting());
- allocator_->FreePendingToken(pointer_uint, helper_.get()->InsertToken());
+ allocator_->FreePendingToken(pointer_uint, helper_->InsertToken());
}
// Checks the free-pending-token mechanism.
@@ -251,8 +242,8 @@ TEST_F(RingBufferWrapperTest, TestFreePendingToken) {
for (unsigned int ii = 0; ii < kAllocCount; ++ii) {
void* pointer = allocator_->Alloc(kSize);
EXPECT_TRUE(pointer != NULL);
- tokens[ii] = helper_.get()->InsertToken();
- allocator_->FreePendingToken(pointer, helper_.get()->InsertToken());
+ tokens[ii] = helper_->InsertToken();
+ allocator_->FreePendingToken(pointer, helper_->InsertToken());
}
EXPECT_EQ(kBufferSize - (kSize * kAllocCount),
@@ -266,7 +257,7 @@ TEST_F(RingBufferWrapperTest, TestFreePendingToken) {
// Check that the token has indeed passed.
EXPECT_LE(tokens[0], GetToken());
- allocator_->FreePendingToken(pointer1, helper_.get()->InsertToken());
+ allocator_->FreePendingToken(pointer1, helper_->InsertToken());
}
} // namespace gpu