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::MessageLoop::current()->PostDelayedTask( | 388 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
389 FROM_HERE, | 389 FROM_HERE, base::Bind(&GpuCommandBufferStub::PollWork, AsWeakPtr()), |
390 base::Bind(&GpuCommandBufferStub::PollWork, AsWeakPtr()), | |
391 base::TimeDelta::FromMilliseconds(delay)); | 390 base::TimeDelta::FromMilliseconds(delay)); |
392 } | 391 } |
393 | 392 |
394 bool GpuCommandBufferStub::MakeCurrent() { | 393 bool GpuCommandBufferStub::MakeCurrent() { |
395 if (decoder_->MakeCurrent()) | 394 if (decoder_->MakeCurrent()) |
396 return true; | 395 return true; |
397 DLOG(ERROR) << "Context lost because MakeCurrent failed."; | 396 DLOG(ERROR) << "Context lost because MakeCurrent failed."; |
398 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); | 397 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); |
399 command_buffer_->SetParseError(gpu::error::kLostContext); | 398 command_buffer_->SetParseError(gpu::error::kLostContext); |
400 CheckContextLost(); | 399 CheckContextLost(); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 FastSetActiveURL(active_url_, active_url_hash_); | 823 FastSetActiveURL(active_url_, active_url_hash_); |
825 scheduler_->PutChanged(); | 824 scheduler_->PutChanged(); |
826 } | 825 } |
827 | 826 |
828 void GpuCommandBufferStub::OnCreateVideoDecoder( | 827 void GpuCommandBufferStub::OnCreateVideoDecoder( |
829 media::VideoCodecProfile profile, | 828 media::VideoCodecProfile profile, |
830 int32 decoder_route_id, | 829 int32 decoder_route_id, |
831 IPC::Message* reply_message) { | 830 IPC::Message* reply_message) { |
832 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); | 831 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); |
833 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( | 832 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( |
834 decoder_route_id, this, channel_->io_message_loop()); | 833 decoder_route_id, this, channel_->io_task_runner()); |
835 decoder->Initialize(profile, reply_message); | 834 decoder->Initialize(profile, reply_message); |
836 // decoder is registered as a DestructionObserver of this stub and will | 835 // decoder is registered as a DestructionObserver of this stub and will |
837 // self-delete during destruction of this stub. | 836 // self-delete during destruction of this stub. |
838 } | 837 } |
839 | 838 |
840 void GpuCommandBufferStub::OnCreateVideoEncoder( | 839 void GpuCommandBufferStub::OnCreateVideoEncoder( |
841 media::VideoFrame::Format input_format, | 840 media::VideoFrame::Format input_format, |
842 const gfx::Size& input_visible_size, | 841 const gfx::Size& input_visible_size, |
843 media::VideoCodecProfile output_profile, | 842 media::VideoCodecProfile output_profile, |
844 uint32 initial_bitrate, | 843 uint32 initial_bitrate, |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); | 1111 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); |
1113 } | 1112 } |
1114 | 1113 |
1115 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1114 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
1116 base::TimeDelta interval) { | 1115 base::TimeDelta interval) { |
1117 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1116 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
1118 interval)); | 1117 interval)); |
1119 } | 1118 } |
1120 | 1119 |
1121 } // namespace content | 1120 } // namespace content |
OLD | NEW |