| 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 "content/common/gpu/client/command_buffer_proxy_impl.h" | 5 #include "content/common/gpu/client/command_buffer_proxy_impl.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 } | 522 } |
| 523 | 523 |
| 524 bool CommandBufferProxyImpl::ProduceFrontBuffer(const gpu::Mailbox& mailbox) { | 524 bool CommandBufferProxyImpl::ProduceFrontBuffer(const gpu::Mailbox& mailbox) { |
| 525 if (last_state_.error != gpu::error::kNoError) | 525 if (last_state_.error != gpu::error::kNoError) |
| 526 return false; | 526 return false; |
| 527 | 527 |
| 528 return Send(new GpuCommandBufferMsg_ProduceFrontBuffer(route_id_, mailbox)); | 528 return Send(new GpuCommandBufferMsg_ProduceFrontBuffer(route_id_, mailbox)); |
| 529 } | 529 } |
| 530 | 530 |
| 531 scoped_ptr<media::VideoDecodeAccelerator> | 531 scoped_ptr<media::VideoDecodeAccelerator> |
| 532 CommandBufferProxyImpl::CreateVideoDecoder( | 532 CommandBufferProxyImpl::CreateVideoDecoder(media::VideoCodecProfile profile) { |
| 533 media::VideoCodecProfile profile, | |
| 534 media::VideoDecodeAccelerator::Client* client) { | |
| 535 int decoder_route_id; | 533 int decoder_route_id; |
| 536 scoped_ptr<media::VideoDecodeAccelerator> vda; | 534 scoped_ptr<media::VideoDecodeAccelerator> vda; |
| 537 if (!Send(new GpuCommandBufferMsg_CreateVideoDecoder(route_id_, profile, | 535 if (!Send(new GpuCommandBufferMsg_CreateVideoDecoder(route_id_, profile, |
| 538 &decoder_route_id))) { | 536 &decoder_route_id))) { |
| 539 LOG(ERROR) << "Send(GpuCommandBufferMsg_CreateVideoDecoder) failed"; | 537 LOG(ERROR) << "Send(GpuCommandBufferMsg_CreateVideoDecoder) failed"; |
| 540 return vda.Pass(); | 538 return vda.Pass(); |
| 541 } | 539 } |
| 542 | 540 |
| 543 if (decoder_route_id < 0) { | 541 if (decoder_route_id < 0) { |
| 544 DLOG(ERROR) << "Failed to Initialize GPU decoder on profile: " << profile; | 542 DLOG(ERROR) << "Failed to Initialize GPU decoder on profile: " << profile; |
| 545 return vda.Pass(); | 543 return vda.Pass(); |
| 546 } | 544 } |
| 547 | 545 |
| 548 GpuVideoDecodeAcceleratorHost* decoder_host = | 546 GpuVideoDecodeAcceleratorHost* decoder_host = |
| 549 new GpuVideoDecodeAcceleratorHost(channel_, decoder_route_id, client, | 547 new GpuVideoDecodeAcceleratorHost(channel_, decoder_route_id, this); |
| 550 this); | |
| 551 vda.reset(decoder_host); | 548 vda.reset(decoder_host); |
| 552 return vda.Pass(); | 549 return vda.Pass(); |
| 553 } | 550 } |
| 554 | 551 |
| 555 gpu::error::Error CommandBufferProxyImpl::GetLastError() { | 552 gpu::error::Error CommandBufferProxyImpl::GetLastError() { |
| 556 return last_state_.error; | 553 return last_state_.error; |
| 557 } | 554 } |
| 558 | 555 |
| 559 bool CommandBufferProxyImpl::Send(IPC::Message* msg) { | 556 bool CommandBufferProxyImpl::Send(IPC::Message* msg) { |
| 560 // Caller should not intentionally send a message if the context is lost. | 557 // Caller should not intentionally send a message if the context is lost. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 590 const GpuConsoleMessageCallback& callback) { | 587 const GpuConsoleMessageCallback& callback) { |
| 591 console_message_callback_ = callback; | 588 console_message_callback_ = callback; |
| 592 } | 589 } |
| 593 | 590 |
| 594 void CommandBufferProxyImpl::TryUpdateState() { | 591 void CommandBufferProxyImpl::TryUpdateState() { |
| 595 if (last_state_.error == gpu::error::kNoError) | 592 if (last_state_.error == gpu::error::kNoError) |
| 596 shared_state()->Read(&last_state_); | 593 shared_state()->Read(&last_state_); |
| 597 } | 594 } |
| 598 | 595 |
| 599 } // namespace content | 596 } // namespace content |
| OLD | NEW |