summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-13 16:58:09 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-13 16:58:09 +0000
commit8c04e38177a50ed7f14163bc301dc9dc836abb35 (patch)
tree2f88e7e501f06bc64a081c3e97da87d1dd315eb3
parent1e24b0b12740ea9d708a832976568c8219839331 (diff)
downloadchromium_src-8c04e38177a50ed7f14163bc301dc9dc836abb35.zip
chromium_src-8c04e38177a50ed7f14163bc301dc9dc836abb35.tar.gz
chromium_src-8c04e38177a50ed7f14163bc301dc9dc836abb35.tar.bz2
1;2cMerge 122183 - Don't call finish if there is nothing to do
TEST=none BUG=25971 Review URL: http://codereview.chromium.org/9392025 TBR=gman@chromium.org Review URL: https://chromiumcodereview.appspot.com/9692050 git-svn-id: svn://svn.chromium.org/chrome/branches/1025/src@126407 0039d316-1c4b-4281-b951-d872f2087c98
-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 26b2057..8008f7a 100644
--- a/gpu/command_buffer/client/transfer_buffer_unittest.cc
+++ b/gpu/command_buffer/client/transfer_buffer_unittest.cc
@@ -66,9 +66,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();
@@ -98,9 +95,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();
@@ -112,9 +106,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();
@@ -126,9 +117,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();
@@ -143,9 +131,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();
@@ -161,9 +146,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();
@@ -260,9 +242,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();
@@ -287,9 +266,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();
@@ -309,9 +285,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();
@@ -346,9 +319,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();
@@ -378,9 +348,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();
@@ -405,9 +372,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();