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

Unified Diff: gpu/command_buffer/client/ring_buffer_test.cc

Issue 1796010: Fix some memory leaks in GPU tests. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 8 months 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/client/fenced_allocator_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/ring_buffer_test.cc
diff --git a/gpu/command_buffer/client/ring_buffer_test.cc b/gpu/command_buffer/client/ring_buffer_test.cc
index a6ec71a391a36b0dc65eeb196073213acac6f2cc..b9b3dee36c53da7fe4c65fb71516d93c5e24ae70 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 fixture for RingBufferWrapper test - Creates a
@@ -184,9 +178,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();
}
@@ -203,13 +194,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);
@@ -221,7 +212,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.
@@ -235,8 +226,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),
@@ -250,7 +241,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
« no previous file with comments | « gpu/command_buffer/client/fenced_allocator_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698