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

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

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Unset texture and texture_ref after deleting Created 6 years, 9 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/buffer_tracker.cc ('k') | gpu/command_buffer/client/cmd_buffer_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/buffer_tracker_unittest.cc
diff --git a/gpu/command_buffer/client/buffer_tracker_unittest.cc b/gpu/command_buffer/client/buffer_tracker_unittest.cc
index a2988443c254d9da4eaa13c214ec422e9b6ee7ff..f6174c0802b3d9681d52a58e929173c33591e8b8 100644
--- a/gpu/command_buffer/client/buffer_tracker_unittest.cc
+++ b/gpu/command_buffer/client/buffer_tracker_unittest.cc
@@ -42,6 +42,11 @@ class MockClientCommandBufferImpl : public MockClientCommandBuffer {
bool context_lost_;
};
+namespace {
+void EmptyPoll() {
+}
+}
+
class BufferTrackerTest : public testing::Test {
protected:
static const int32 kNumCommandEntries = 400;
@@ -53,7 +58,7 @@ class BufferTrackerTest : public testing::Test {
helper_.reset(new GLES2CmdHelper(command_buffer_.get()));
helper_->Initialize(kCommandBufferSizeBytes);
mapped_memory_.reset(new MappedMemoryManager(
- helper_.get(), MappedMemoryManager::kNoLimit));
+ helper_.get(), base::Bind(&EmptyPoll), MappedMemoryManager::kNoLimit));
buffer_tracker_.reset(new BufferTracker(mapped_memory_.get()));
}
@@ -127,5 +132,22 @@ TEST_F(BufferTrackerTest, LostContext) {
buffer_tracker_->RemoveBuffer(kId);
}
+TEST_F(BufferTrackerTest, Unmanage) {
+ const GLuint kId = 123;
+ const GLsizeiptr size = 64;
+
+ BufferTracker::Buffer* buffer = buffer_tracker_->CreateBuffer(kId, size);
+ ASSERT_TRUE(buffer != NULL);
+ EXPECT_EQ(mapped_memory_->bytes_in_use(), static_cast<size_t>(size));
+
+ void* mem = buffer->address();
+ buffer_tracker_->Unmanage(buffer);
+ buffer_tracker_->RemoveBuffer(kId);
+ EXPECT_EQ(mapped_memory_->bytes_in_use(), static_cast<size_t>(size));
+
+ mapped_memory_->Free(mem);
+ EXPECT_EQ(mapped_memory_->bytes_in_use(), static_cast<size_t>(0));
+}
+
} // namespace gles2
} // namespace gpu
« no previous file with comments | « gpu/command_buffer/client/buffer_tracker.cc ('k') | gpu/command_buffer/client/cmd_buffer_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698