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/hash.h" | 8 #include "base/hash.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 // is done synchronously so we can set delay to 0 and instead poll | 378 // is done synchronously so we can set delay to 0 and instead poll |
379 // for more work at the rate idle work is performed. This also ensures | 379 // for more work at the rate idle work is performed. This also ensures |
380 // that idle work is done as efficiently as possible without any | 380 // that idle work is done as efficiently as possible without any |
381 // unnecessary delays. | 381 // unnecessary delays. |
382 if (scheduler_.get() && | 382 if (scheduler_.get() && |
383 scheduler_->IsScheduled() && | 383 scheduler_->IsScheduled() && |
384 scheduler_->HasMoreIdleWork()) { | 384 scheduler_->HasMoreIdleWork()) { |
385 delay = 0; | 385 delay = 0; |
386 } | 386 } |
387 | 387 |
388 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 388 base::MessageLoop::current()->PostDelayedTask( |
389 FROM_HERE, base::Bind(&GpuCommandBufferStub::PollWork, AsWeakPtr()), | 389 FROM_HERE, |
| 390 base::Bind(&GpuCommandBufferStub::PollWork, AsWeakPtr()), |
390 base::TimeDelta::FromMilliseconds(delay)); | 391 base::TimeDelta::FromMilliseconds(delay)); |
391 } | 392 } |
392 | 393 |
393 bool GpuCommandBufferStub::MakeCurrent() { | 394 bool GpuCommandBufferStub::MakeCurrent() { |
394 if (decoder_->MakeCurrent()) | 395 if (decoder_->MakeCurrent()) |
395 return true; | 396 return true; |
396 DLOG(ERROR) << "Context lost because MakeCurrent failed."; | 397 DLOG(ERROR) << "Context lost because MakeCurrent failed."; |
397 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); | 398 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); |
398 command_buffer_->SetParseError(gpu::error::kLostContext); | 399 command_buffer_->SetParseError(gpu::error::kLostContext); |
399 CheckContextLost(); | 400 CheckContextLost(); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 FastSetActiveURL(active_url_, active_url_hash_); | 824 FastSetActiveURL(active_url_, active_url_hash_); |
824 scheduler_->PutChanged(); | 825 scheduler_->PutChanged(); |
825 } | 826 } |
826 | 827 |
827 void GpuCommandBufferStub::OnCreateVideoDecoder( | 828 void GpuCommandBufferStub::OnCreateVideoDecoder( |
828 media::VideoCodecProfile profile, | 829 media::VideoCodecProfile profile, |
829 int32 decoder_route_id, | 830 int32 decoder_route_id, |
830 IPC::Message* reply_message) { | 831 IPC::Message* reply_message) { |
831 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); | 832 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); |
832 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( | 833 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( |
833 decoder_route_id, this, channel_->io_task_runner()); | 834 decoder_route_id, this, channel_->io_message_loop()); |
834 decoder->Initialize(profile, reply_message); | 835 decoder->Initialize(profile, reply_message); |
835 // decoder is registered as a DestructionObserver of this stub and will | 836 // decoder is registered as a DestructionObserver of this stub and will |
836 // self-delete during destruction of this stub. | 837 // self-delete during destruction of this stub. |
837 } | 838 } |
838 | 839 |
839 void GpuCommandBufferStub::OnCreateVideoEncoder( | 840 void GpuCommandBufferStub::OnCreateVideoEncoder( |
840 media::VideoFrame::Format input_format, | 841 media::VideoFrame::Format input_format, |
841 const gfx::Size& input_visible_size, | 842 const gfx::Size& input_visible_size, |
842 media::VideoCodecProfile output_profile, | 843 media::VideoCodecProfile output_profile, |
843 uint32 initial_bitrate, | 844 uint32 initial_bitrate, |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); | 1112 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); |
1112 } | 1113 } |
1113 | 1114 |
1114 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1115 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
1115 base::TimeDelta interval) { | 1116 base::TimeDelta interval) { |
1116 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1117 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
1117 interval)); | 1118 interval)); |
1118 } | 1119 } |
1119 | 1120 |
1120 } // namespace content | 1121 } // namespace content |
OLD | NEW |