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(OS_WIN) | 5 #if defined(OS_WIN) |
6 #include <windows.h> | 6 #include <windows.h> |
7 #endif | 7 #endif |
8 | 8 |
9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 | 10 |
11 #include <queue> | 11 #include <queue> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/macros.h" |
16 #include "base/message_loop/message_loop_proxy.h" | 17 #include "base/message_loop/message_loop_proxy.h" |
17 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
18 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
19 #include "base/timer/timer.h" | 20 #include "base/timer/timer.h" |
20 #include "base/trace_event/trace_event.h" | 21 #include "base/trace_event/trace_event.h" |
21 #include "content/common/gpu/gpu_channel_manager.h" | 22 #include "content/common/gpu/gpu_channel_manager.h" |
22 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 23 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
23 #include "content/common/gpu/gpu_messages.h" | 24 #include "content/common/gpu/gpu_messages.h" |
| 25 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h" |
24 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
25 #include "gpu/command_buffer/common/mailbox.h" | 27 #include "gpu/command_buffer/common/mailbox.h" |
26 #include "gpu/command_buffer/common/value_state.h" | 28 #include "gpu/command_buffer/common/value_state.h" |
27 #include "gpu/command_buffer/service/gpu_scheduler.h" | 29 #include "gpu/command_buffer/service/gpu_scheduler.h" |
28 #include "gpu/command_buffer/service/image_factory.h" | 30 #include "gpu/command_buffer/service/image_factory.h" |
29 #include "gpu/command_buffer/service/mailbox_manager_impl.h" | 31 #include "gpu/command_buffer/service/mailbox_manager_impl.h" |
30 #include "gpu/command_buffer/service/sync_point_manager.h" | 32 #include "gpu/command_buffer/service/sync_point_manager.h" |
31 #include "gpu/command_buffer/service/valuebuffer_manager.h" | 33 #include "gpu/command_buffer/service/valuebuffer_manager.h" |
32 #include "ipc/ipc_channel.h" | 34 #include "ipc/ipc_channel.h" |
33 #include "ipc/message_filter.h" | 35 #include "ipc/message_filter.h" |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 } | 662 } |
661 } | 663 } |
662 | 664 |
663 void GpuChannel::OnDestroy() { | 665 void GpuChannel::OnDestroy() { |
664 TRACE_EVENT0("gpu", "GpuChannel::OnDestroy"); | 666 TRACE_EVENT0("gpu", "GpuChannel::OnDestroy"); |
665 gpu_channel_manager_->RemoveChannel(client_id_); | 667 gpu_channel_manager_->RemoveChannel(client_id_); |
666 } | 668 } |
667 | 669 |
668 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { | 670 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { |
669 bool handled = true; | 671 bool handled = true; |
| 672 LOG(ERROR) << __func__ << ", type=" << msg.type(); |
| 673 |
670 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) | 674 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) |
671 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer, | 675 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer, |
672 OnCreateOffscreenCommandBuffer) | 676 OnCreateOffscreenCommandBuffer) |
673 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, | 677 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, |
674 OnDestroyCommandBuffer) | 678 OnDestroyCommandBuffer) |
| 679 IPC_MESSAGE_HANDLER(GpuMsg_CreateJpegDecoder, OnCreateJpegDecoder) |
675 IPC_MESSAGE_UNHANDLED(handled = false) | 680 IPC_MESSAGE_UNHANDLED(handled = false) |
676 IPC_END_MESSAGE_MAP() | 681 IPC_END_MESSAGE_MAP() |
677 DCHECK(handled) << msg.type(); | 682 DCHECK(handled) << msg.type(); |
678 return handled; | 683 return handled; |
679 } | 684 } |
680 | 685 |
681 void GpuChannel::HandleMessage() { | 686 void GpuChannel::HandleMessage() { |
682 handle_messages_scheduled_ = false; | 687 handle_messages_scheduled_ = false; |
683 if (deferred_messages_.empty()) | 688 if (deferred_messages_.empty()) |
684 return; | 689 return; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 router_.RemoveRoute(route_id); | 791 router_.RemoveRoute(route_id); |
787 stubs_.Remove(route_id); | 792 stubs_.Remove(route_id); |
788 // In case the renderer is currently blocked waiting for a sync reply from the | 793 // In case the renderer is currently blocked waiting for a sync reply from the |
789 // stub, we need to make sure to reschedule the GpuChannel here. | 794 // stub, we need to make sure to reschedule the GpuChannel here. |
790 if (need_reschedule) { | 795 if (need_reschedule) { |
791 // This stub won't get a chance to reschedule, so update the count now. | 796 // This stub won't get a chance to reschedule, so update the count now. |
792 StubSchedulingChanged(true); | 797 StubSchedulingChanged(true); |
793 } | 798 } |
794 } | 799 } |
795 | 800 |
| 801 void GpuChannel::OnCreateJpegDecoder(int32 route_id, bool* succeeded) { |
| 802 LOG(ERROR) << "GpuChannel::OnCreateJpegDecoder"; |
| 803 GpuJpegDecodeAccelerator* decoder = new GpuJpegDecodeAccelerator( |
| 804 this, |
| 805 route_id, io_message_loop_); |
| 806 jpeg_decoder_.reset(decoder); |
| 807 |
| 808 *succeeded = decoder->Initialize(); |
| 809 } |
| 810 |
| 811 void GpuChannel::ReleaseJpegDecoder() { |
| 812 ignore_result(jpeg_decoder_.release()); |
| 813 } |
| 814 |
796 void GpuChannel::MessageProcessed() { | 815 void GpuChannel::MessageProcessed() { |
797 messages_processed_++; | 816 messages_processed_++; |
798 if (preempting_flag_.get()) { | 817 if (preempting_flag_.get()) { |
799 io_message_loop_->PostTask( | 818 io_message_loop_->PostTask( |
800 FROM_HERE, | 819 FROM_HERE, |
801 base::Bind(&GpuChannelMessageFilter::MessageProcessed, | 820 base::Bind(&GpuChannelMessageFilter::MessageProcessed, |
802 filter_, | 821 filter_, |
803 messages_processed_)); | 822 messages_processed_)); |
804 } | 823 } |
805 } | 824 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 } | 875 } |
857 } | 876 } |
858 } | 877 } |
859 | 878 |
860 void GpuChannel::HandleUpdateValueState( | 879 void GpuChannel::HandleUpdateValueState( |
861 unsigned int target, const gpu::ValueState& state) { | 880 unsigned int target, const gpu::ValueState& state) { |
862 pending_valuebuffer_state_->UpdateState(target, state); | 881 pending_valuebuffer_state_->UpdateState(target, state); |
863 } | 882 } |
864 | 883 |
865 } // namespace content | 884 } // namespace content |
OLD | NEW |