summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-15 23:21:32 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-15 23:21:32 +0000
commita24e75800dba32fbe8a44405dbc36a0e71708e90 (patch)
tree2d89538cde484fd0dea114f0dd26da75740c97a4 /gpu
parent7cb6beb8b3f8632ccdd771bc17d60d8b07dc54ed (diff)
downloadchromium_src-a24e75800dba32fbe8a44405dbc36a0e71708e90.zip
chromium_src-a24e75800dba32fbe8a44405dbc36a0e71708e90.tar.gz
chromium_src-a24e75800dba32fbe8a44405dbc36a0e71708e90.tar.bz2
Don't call finish if there is nothing to do
TEST=none BUG=25971 Review URL: http://codereview.chromium.org/9392025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper.cc4
-rw-r--r--gpu/command_buffer/client/transfer_buffer_unittest.cc36
2 files changed, 4 insertions, 36 deletions
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.cc b/gpu/command_buffer/client/cmd_buffer_helper.cc
index d9a4c55..29770b8 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper.cc
@@ -115,6 +115,10 @@ bool CommandBufferHelper::Finish() {
if (!usable()) {
return false;
}
+ // If there is no work just exit.
+ if (put_ == get_offset()) {
+ return true;
+ }
GPU_DCHECK(HaveRingBuffer());
do {
// Do not loop forever if the flush fails, meaning the command buffer reader
diff --git a/gpu/command_buffer/client/transfer_buffer_unittest.cc b/gpu/command_buffer/client/transfer_buffer_unittest.cc
index 75a1b60..80a1c02 100644
--- a/gpu/command_buffer/client/transfer_buffer_unittest.cc
+++ b/gpu/command_buffer/client/transfer_buffer_unittest.cc
@@ -71,9 +71,6 @@ void TransferBufferTest::SetUp() {
void TransferBufferTest::TearDown() {
if (transfer_buffer_->HaveBuffer()) {
- EXPECT_CALL(*command_buffer(), OnFlush())
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
.Times(1)
.RetiresOnSaturation();
@@ -105,9 +102,6 @@ TEST_F(TransferBufferTest, Free) {
EXPECT_EQ(transfer_buffer_id_, transfer_buffer_->GetShmId());
// Free buffer.
- EXPECT_CALL(*command_buffer(), OnFlush())
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
.Times(1)
.RetiresOnSaturation();
@@ -119,9 +113,6 @@ TEST_F(TransferBufferTest, Free) {
EXPECT_TRUE(transfer_buffer_->HaveBuffer());
// Free buffer.
- EXPECT_CALL(*command_buffer(), OnFlush())
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
.Times(1)
.RetiresOnSaturation();
@@ -133,9 +124,6 @@ TEST_F(TransferBufferTest, Free) {
EXPECT_TRUE(transfer_buffer_->HaveBuffer());
// Free buffer.
- EXPECT_CALL(*command_buffer(), OnFlush())
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
.Times(1)
.RetiresOnSaturation();
@@ -150,9 +138,6 @@ TEST_F(TransferBufferTest, Free) {
transfer_buffer_->FreePendingToken(data, 1);
// Free buffer.
- EXPECT_CALL(*command_buffer(), OnFlush())
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
.Times(1)
.RetiresOnSaturation();
@@ -168,9 +153,6 @@ TEST_F(TransferBufferTest, Free) {
transfer_buffer_->GetCurrentMaxAllocationWithoutRealloc());
// Test freeing twice.
- EXPECT_CALL(*command_buffer(), OnFlush())
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
.Times(1)
.RetiresOnSaturation();
@@ -295,9 +277,6 @@ void TransferBufferExpandContractTest::SetUp() {
void TransferBufferExpandContractTest::TearDown() {
if (transfer_buffer_->HaveBuffer()) {
- EXPECT_CALL(*command_buffer(), OnFlush())
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
.Times(1)
.RetiresOnSaturation();
@@ -322,9 +301,6 @@ TEST_F(TransferBufferExpandContractTest, Expand) {
kStartTransferBufferSize - kStartingOffset,
transfer_buffer_->GetCurrentMaxAllocationWithoutRealloc());
- EXPECT_CALL(*command_buffer(), OnFlush())
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
.Times(1)
.RetiresOnSaturation();
@@ -344,9 +320,6 @@ TEST_F(TransferBufferExpandContractTest, Expand) {
EXPECT_EQ(kSize1, transfer_buffer_->GetCurrentMaxAllocationWithoutRealloc());
transfer_buffer_->FreePendingToken(ptr, 1);
- EXPECT_CALL(*command_buffer(), OnFlush())
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
.Times(1)
.RetiresOnSaturation();
@@ -381,9 +354,6 @@ TEST_F(TransferBufferExpandContractTest, Contract) {
transfer_buffer_->GetCurrentMaxAllocationWithoutRealloc());
// Free buffer.
- EXPECT_CALL(*command_buffer(), OnFlush())
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
.Times(1)
.RetiresOnSaturation();
@@ -413,9 +383,6 @@ TEST_F(TransferBufferExpandContractTest, Contract) {
transfer_buffer_->FreePendingToken(ptr, 1);
// Free buffer.
- EXPECT_CALL(*command_buffer(), OnFlush())
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
.Times(1)
.RetiresOnSaturation();
@@ -440,9 +407,6 @@ TEST_F(TransferBufferExpandContractTest, Contract) {
TEST_F(TransferBufferExpandContractTest, OutOfMemory) {
// Free buffer.
- EXPECT_CALL(*command_buffer(), OnFlush())
- .Times(1)
- .RetiresOnSaturation();
EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
.Times(1)
.RetiresOnSaturation();