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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/hash.h" | 9 #include "base/hash.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 // is done synchronously so we can set delay to 0 and instead poll | 304 // is done synchronously so we can set delay to 0 and instead poll |
305 // for more work at the rate idle work is performed. This also ensures | 305 // for more work at the rate idle work is performed. This also ensures |
306 // that idle work is done as efficiently as possible without any | 306 // that idle work is done as efficiently as possible without any |
307 // unnecessary delays. | 307 // unnecessary delays. |
308 if (scheduler_.get() && | 308 if (scheduler_.get() && |
309 scheduler_->IsScheduled() && | 309 scheduler_->IsScheduled() && |
310 scheduler_->HasMoreIdleWork()) { | 310 scheduler_->HasMoreIdleWork()) { |
311 delay = 0; | 311 delay = 0; |
312 } | 312 } |
313 | 313 |
314 MessageLoop::current()->PostDelayedTask( | 314 base::MessageLoop::current()->PostDelayedTask( |
315 FROM_HERE, | 315 FROM_HERE, |
316 base::Bind(&GpuCommandBufferStub::PollWork, | 316 base::Bind(&GpuCommandBufferStub::PollWork, AsWeakPtr()), |
317 AsWeakPtr()), | |
318 base::TimeDelta::FromMilliseconds(delay)); | 317 base::TimeDelta::FromMilliseconds(delay)); |
319 } | 318 } |
320 | 319 |
321 void GpuCommandBufferStub::OnEcho(const IPC::Message& message) { | 320 void GpuCommandBufferStub::OnEcho(const IPC::Message& message) { |
322 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho"); | 321 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho"); |
323 Send(new IPC::Message(message)); | 322 Send(new IPC::Message(message)); |
324 } | 323 } |
325 | 324 |
326 bool GpuCommandBufferStub::MakeCurrent() { | 325 bool GpuCommandBufferStub::MakeCurrent() { |
327 if (decoder_->MakeCurrent()) | 326 if (decoder_->MakeCurrent()) |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 if (surface_ && MakeCurrent()) | 933 if (surface_ && MakeCurrent()) |
935 surface_->SetFrontbufferAllocation( | 934 surface_->SetFrontbufferAllocation( |
936 allocation.browser_allocation.suggest_have_frontbuffer); | 935 allocation.browser_allocation.suggest_have_frontbuffer); |
937 } | 936 } |
938 | 937 |
939 last_memory_allocation_valid_ = true; | 938 last_memory_allocation_valid_ = true; |
940 last_memory_allocation_ = allocation; | 939 last_memory_allocation_ = allocation; |
941 } | 940 } |
942 | 941 |
943 } // namespace content | 942 } // namespace content |
OLD | NEW |