| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } | 135 } |
| 136 | 136 |
| 137 bool GpuCommandBufferStub::IsScheduled() { | 137 bool GpuCommandBufferStub::IsScheduled() { |
| 138 return !scheduler_.get() || scheduler_->IsScheduled(); | 138 return !scheduler_.get() || scheduler_->IsScheduled(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 bool GpuCommandBufferStub::HasMoreWork() { | 141 bool GpuCommandBufferStub::HasMoreWork() { |
| 142 return scheduler_.get() && scheduler_->HasMoreWork(); | 142 return scheduler_.get() && scheduler_->HasMoreWork(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool GpuCommandBufferStub::HasUnprocessedCommands() { |
| 146 if (command_buffer_.get()) { |
| 147 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); |
| 148 return state.put_offset != state.get_offset; |
| 149 } |
| 150 return false; |
| 151 } |
| 152 |
| 145 void GpuCommandBufferStub::OnEcho(const IPC::Message& message) { | 153 void GpuCommandBufferStub::OnEcho(const IPC::Message& message) { |
| 146 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho"); | 154 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho"); |
| 147 Send(new IPC::Message(message)); | 155 Send(new IPC::Message(message)); |
| 148 } | 156 } |
| 149 | 157 |
| 150 void GpuCommandBufferStub::Destroy() { | 158 void GpuCommandBufferStub::Destroy() { |
| 151 // The scheduler has raw references to the decoder and the command buffer so | 159 // The scheduler has raw references to the decoder and the command buffer so |
| 152 // destroy it before those. | 160 // destroy it before those. |
| 153 scheduler_.reset(); | 161 scheduler_.reset(); |
| 154 | 162 |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 return; | 591 return; |
| 584 if (allocation.has_frontbuffer && allocation.has_backbuffer) | 592 if (allocation.has_frontbuffer && allocation.has_backbuffer) |
| 585 surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_FOREGROUND); | 593 surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_FOREGROUND); |
| 586 else if (allocation.has_frontbuffer) | 594 else if (allocation.has_frontbuffer) |
| 587 surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_BACKGROUND); | 595 surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_BACKGROUND); |
| 588 else | 596 else |
| 589 surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_HIBERNATED); | 597 surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_HIBERNATED); |
| 590 } | 598 } |
| 591 | 599 |
| 592 #endif // defined(ENABLE_GPU) | 600 #endif // defined(ENABLE_GPU) |
| OLD | NEW |