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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 delayed_work_scheduled_ = true; | 199 delayed_work_scheduled_ = true; |
200 MessageLoop::current()->PostDelayedTask( | 200 MessageLoop::current()->PostDelayedTask( |
201 FROM_HERE, | 201 FROM_HERE, |
202 base::Bind(&GpuCommandBufferStub::PollWork, | 202 base::Bind(&GpuCommandBufferStub::PollWork, |
203 AsWeakPtr()), | 203 AsWeakPtr()), |
204 base::TimeDelta::FromMilliseconds(delay)); | 204 base::TimeDelta::FromMilliseconds(delay)); |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 void GpuCommandBufferStub::OnEcho(const IPC::Message& message) { | 208 void GpuCommandBufferStub::OnEcho(const IPC::Message& message) { |
209 // For latency_tests.cc: | |
210 UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete"); | |
211 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho"); | 209 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho"); |
212 Send(new IPC::Message(message)); | 210 Send(new IPC::Message(message)); |
213 } | 211 } |
214 | 212 |
215 void GpuCommandBufferStub::DelayEcho(IPC::Message* message) { | 213 void GpuCommandBufferStub::DelayEcho(IPC::Message* message) { |
216 delayed_echos_.push_back(message); | 214 delayed_echos_.push_back(message); |
217 } | 215 } |
218 | 216 |
219 void GpuCommandBufferStub::OnReschedule() { | 217 void GpuCommandBufferStub::OnReschedule() { |
220 if (!IsScheduled()) | 218 if (!IsScheduled()) |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 const GpuMemoryAllocation& allocation) { | 767 const GpuMemoryAllocation& allocation) { |
770 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); | 768 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); |
771 // This can be called outside of OnMessageReceived, so the context needs to be | 769 // This can be called outside of OnMessageReceived, so the context needs to be |
772 // made current before calling methods on the surface. | 770 // made current before calling methods on the surface. |
773 if (!surface_ || !MakeCurrent()) | 771 if (!surface_ || !MakeCurrent()) |
774 return; | 772 return; |
775 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); | 773 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); |
776 } | 774 } |
777 | 775 |
778 #endif // defined(ENABLE_GPU) | 776 #endif // defined(ENABLE_GPU) |
OLD | NEW |