Ensure that GpuScheduler invokes fence tasks even if client is not flushing.

Review URL: http://codereview.chromium.org/8495038

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113535 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index af478e0..ff2ab82 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -123,6 +123,10 @@
   return !scheduler_.get() || scheduler_->IsScheduled();
 }
 
+bool GpuCommandBufferStub::HasMoreWork() {
+  return scheduler_.get() && scheduler_->HasMoreWork();
+}
+
 void GpuCommandBufferStub::SetSwapInterval() {
 #if !defined(OS_MACOSX) && !defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
   // Set up swap interval for onscreen contexts.
@@ -360,10 +364,12 @@
 }
 
 void GpuCommandBufferStub::OnRescheduled() {
-  gpu::CommandBuffer::State state = command_buffer_->GetLastState();
-  command_buffer_->Flush(state.put_offset);
+  gpu::CommandBuffer::State pre_state = command_buffer_->GetLastState();
+  command_buffer_->Flush(pre_state.put_offset);
+  gpu::CommandBuffer::State post_state = command_buffer_->GetLastState();
 
-  ReportState();
+  if (pre_state.get_offset != post_state.get_offset)
+    ReportState();
 }
 
 void GpuCommandBufferStub::OnCreateTransferBuffer(int32 size,