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

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

Issue 11840002: Explicitly free shared memory buffers on GL client destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add null-check Created 7 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/gles2_implementation.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/gles2_implementation_unittest.cc
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index edc7c6a08b920d1aabd338fef8b678c58bcdd6b9..b711c4a82e71c608a59e2489fe96fb32293e68d7 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -249,7 +249,6 @@ int MockTransferBuffer::GetResultOffset() {
}
void MockTransferBuffer::Free() {
- GPU_NOTREACHED();
}
bool MockTransferBuffer::HaveBuffer() const {
@@ -1457,9 +1456,8 @@ TEST_F(GLES2ImplementationTest, MapUnmapBufferSubDataCHROMIUM) {
uint32 offset = 0;
Cmds expected;
- expected.buf.Init(
- kTarget, kOffset, kSize,
- command_buffer()->GetNextFreeTransferBufferId(), offset);
+ int32 shm_id = command_buffer()->GetNextFreeTransferBufferId();
+ expected.buf.Init(kTarget, kOffset, kSize, shm_id, offset);
expected.set_token.Init(GetNextToken());
void* mem = gl_->MapBufferSubDataCHROMIUM(
@@ -1467,6 +1465,11 @@ TEST_F(GLES2ImplementationTest, MapUnmapBufferSubDataCHROMIUM) {
ASSERT_TRUE(mem != NULL);
gl_->UnmapBufferSubDataCHROMIUM(mem);
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
+
+ EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(shm_id))
+ .Times(1)
+ .RetiresOnSaturation();
+ gl_->FreeUnusedSharedMemory();
}
TEST_F(GLES2ImplementationTest, MapUnmapBufferSubDataCHROMIUMBadArgs) {
@@ -1521,10 +1524,10 @@ TEST_F(GLES2ImplementationTest, MapUnmapTexSubImage2DCHROMIUM) {
uint32 offset = 0;
Cmds expected;
+ int32 shm_id = command_buffer()->GetNextFreeTransferBufferId();
expected.tex.Init(
GL_TEXTURE_2D, kLevel, kXOffset, kYOffset, kWidth, kHeight, kFormat,
- kType,
- command_buffer()->GetNextFreeTransferBufferId(), offset, GL_FALSE);
+ kType, shm_id, offset, GL_FALSE);
expected.set_token.Init(GetNextToken());
void* mem = gl_->MapTexSubImage2DCHROMIUM(
@@ -1540,6 +1543,11 @@ TEST_F(GLES2ImplementationTest, MapUnmapTexSubImage2DCHROMIUM) {
ASSERT_TRUE(mem != NULL);
gl_->UnmapTexSubImage2DCHROMIUM(mem);
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
+
+ EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(shm_id))
+ .Times(1)
+ .RetiresOnSaturation();
+ gl_->FreeUnusedSharedMemory();
}
TEST_F(GLES2ImplementationTest, MapUnmapTexSubImage2DCHROMIUMBadArgs) {
@@ -2691,6 +2699,10 @@ TEST_F(GLES2ImplementationTest, BeginEndQueryEXT) {
gl_->GetQueryObjectuivEXT(id1, GL_QUERY_RESULT_AVAILABLE_EXT, &available);
EXPECT_TRUE(NoCommandsWritten());
EXPECT_EQ(0u, available);
+
+ EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
+ .Times(1)
+ .RetiresOnSaturation();
}
TEST_F(GLES2ImplementationTest, ErrorQuery) {
@@ -2745,6 +2757,10 @@ TEST_F(GLES2ImplementationTest, ErrorQuery) {
gl_->GetQueryObjectuivEXT(id, GL_QUERY_RESULT_EXT, &result);
EXPECT_TRUE(NoCommandsWritten());
EXPECT_EQ(static_cast<GLuint>(GL_INVALID_ENUM), result);
+
+ EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
+ .Times(1)
+ .RetiresOnSaturation();
}
#if !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS)
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698