| 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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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; |
| 670 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) | 672 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) |
| 671 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer, | 673 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer, |
| 672 OnCreateOffscreenCommandBuffer) | 674 OnCreateOffscreenCommandBuffer) |
| 673 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, | 675 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, |
| 674 OnDestroyCommandBuffer) | 676 OnDestroyCommandBuffer) |
| 677 IPC_MESSAGE_HANDLER(GpuMsg_CreateJpegDecoder, OnCreateJpegDecoder) |
| 675 IPC_MESSAGE_UNHANDLED(handled = false) | 678 IPC_MESSAGE_UNHANDLED(handled = false) |
| 676 IPC_END_MESSAGE_MAP() | 679 IPC_END_MESSAGE_MAP() |
| 677 DCHECK(handled) << msg.type(); | 680 DCHECK(handled) << msg.type(); |
| 678 return handled; | 681 return handled; |
| 679 } | 682 } |
| 680 | 683 |
| 681 void GpuChannel::HandleMessage() { | 684 void GpuChannel::HandleMessage() { |
| 682 handle_messages_scheduled_ = false; | 685 handle_messages_scheduled_ = false; |
| 683 if (deferred_messages_.empty()) | 686 if (deferred_messages_.empty()) |
| 684 return; | 687 return; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 router_.RemoveRoute(route_id); | 789 router_.RemoveRoute(route_id); |
| 787 stubs_.Remove(route_id); | 790 stubs_.Remove(route_id); |
| 788 // In case the renderer is currently blocked waiting for a sync reply from the | 791 // 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. | 792 // stub, we need to make sure to reschedule the GpuChannel here. |
| 790 if (need_reschedule) { | 793 if (need_reschedule) { |
| 791 // This stub won't get a chance to reschedule, so update the count now. | 794 // This stub won't get a chance to reschedule, so update the count now. |
| 792 StubSchedulingChanged(true); | 795 StubSchedulingChanged(true); |
| 793 } | 796 } |
| 794 } | 797 } |
| 795 | 798 |
| 799 void GpuChannel::OnCreateJpegDecoder(int32 route_id, bool* succeeded) { |
| 800 jpeg_decoder_.reset( |
| 801 new GpuJpegDecodeAccelerator(this, route_id, io_message_loop_)); |
| 802 |
| 803 *succeeded = jpeg_decoder_->Initialize(); |
| 804 } |
| 805 |
| 806 void GpuChannel::ReleaseJpegDecoder() { |
| 807 ignore_result(jpeg_decoder_.release()); |
| 808 } |
| 809 |
| 796 void GpuChannel::MessageProcessed() { | 810 void GpuChannel::MessageProcessed() { |
| 797 messages_processed_++; | 811 messages_processed_++; |
| 798 if (preempting_flag_.get()) { | 812 if (preempting_flag_.get()) { |
| 799 io_message_loop_->PostTask( | 813 io_message_loop_->PostTask( |
| 800 FROM_HERE, | 814 FROM_HERE, |
| 801 base::Bind(&GpuChannelMessageFilter::MessageProcessed, | 815 base::Bind(&GpuChannelMessageFilter::MessageProcessed, |
| 802 filter_, | 816 filter_, |
| 803 messages_processed_)); | 817 messages_processed_)); |
| 804 } | 818 } |
| 805 } | 819 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 } | 870 } |
| 857 } | 871 } |
| 858 } | 872 } |
| 859 | 873 |
| 860 void GpuChannel::HandleUpdateValueState( | 874 void GpuChannel::HandleUpdateValueState( |
| 861 unsigned int target, const gpu::ValueState& state) { | 875 unsigned int target, const gpu::ValueState& state) { |
| 862 pending_valuebuffer_state_->UpdateState(target, state); | 876 pending_valuebuffer_state_->UpdateState(target, state); |
| 863 } | 877 } |
| 864 | 878 |
| 865 } // namespace content | 879 } // namespace content |
| OLD | NEW |