Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: content/common/gpu/gpu_channel.cc

Issue 185403020: Make VEA client of command buffer; move sync. IPC to VDA/VEA::Initialize() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 56683e7a Rebase. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/debug/trace_event.h" 16 #include "base/debug/trace_event.h"
17 #include "base/message_loop/message_loop_proxy.h" 17 #include "base/message_loop/message_loop_proxy.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/timer/timer.h" 19 #include "base/timer/timer.h"
20 #include "content/common/gpu/devtools_gpu_agent.h" 20 #include "content/common/gpu/devtools_gpu_agent.h"
21 #include "content/common/gpu/gpu_channel_manager.h" 21 #include "content/common/gpu/gpu_channel_manager.h"
22 #include "content/common/gpu/gpu_messages.h" 22 #include "content/common/gpu/gpu_messages.h"
23 #include "content/common/gpu/media/gpu_video_encode_accelerator.h"
24 #include "content/common/gpu/sync_point_manager.h" 23 #include "content/common/gpu/sync_point_manager.h"
25 #include "content/public/common/content_switches.h" 24 #include "content/public/common/content_switches.h"
26 #include "gpu/command_buffer/common/mailbox.h" 25 #include "gpu/command_buffer/common/mailbox.h"
27 #include "gpu/command_buffer/service/gpu_scheduler.h" 26 #include "gpu/command_buffer/service/gpu_scheduler.h"
28 #include "gpu/command_buffer/service/image_manager.h" 27 #include "gpu/command_buffer/service/image_manager.h"
29 #include "gpu/command_buffer/service/mailbox_manager.h" 28 #include "gpu/command_buffer/service/mailbox_manager.h"
30 #include "ipc/ipc_channel.h" 29 #include "ipc/ipc_channel.h"
31 #include "ipc/ipc_channel_proxy.h" 30 #include "ipc/ipc_channel_proxy.h"
32 #include "ui/gl/gl_context.h" 31 #include "ui/gl/gl_context.h"
33 #include "ui/gl/gl_image.h" 32 #include "ui/gl/gl_image.h"
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 gpu_channel_manager_->RemoveChannel(client_id_); 698 gpu_channel_manager_->RemoveChannel(client_id_);
700 } 699 }
701 700
702 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { 701 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) {
703 bool handled = true; 702 bool handled = true;
704 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) 703 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg)
705 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer, 704 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer,
706 OnCreateOffscreenCommandBuffer) 705 OnCreateOffscreenCommandBuffer)
707 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, 706 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer,
708 OnDestroyCommandBuffer) 707 OnDestroyCommandBuffer)
709 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateVideoEncoder, OnCreateVideoEncoder)
710 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyVideoEncoder,
711 OnDestroyVideoEncoder)
712 IPC_MESSAGE_HANDLER(GpuChannelMsg_DevToolsStartEventsRecording, 708 IPC_MESSAGE_HANDLER(GpuChannelMsg_DevToolsStartEventsRecording,
713 OnDevToolsStartEventsRecording) 709 OnDevToolsStartEventsRecording)
714 IPC_MESSAGE_HANDLER(GpuChannelMsg_DevToolsStopEventsRecording, 710 IPC_MESSAGE_HANDLER(GpuChannelMsg_DevToolsStopEventsRecording,
715 OnDevToolsStopEventsRecording) 711 OnDevToolsStopEventsRecording)
716 IPC_MESSAGE_UNHANDLED(handled = false) 712 IPC_MESSAGE_UNHANDLED(handled = false)
717 IPC_END_MESSAGE_MAP() 713 IPC_END_MESSAGE_MAP()
718 DCHECK(handled) << msg.type(); 714 DCHECK(handled) << msg.type();
719 return handled; 715 return handled;
720 } 716 }
721 717
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 router_.RemoveRoute(route_id); 832 router_.RemoveRoute(route_id);
837 stubs_.Remove(route_id); 833 stubs_.Remove(route_id);
838 // In case the renderer is currently blocked waiting for a sync reply from the 834 // In case the renderer is currently blocked waiting for a sync reply from the
839 // stub, we need to make sure to reschedule the GpuChannel here. 835 // stub, we need to make sure to reschedule the GpuChannel here.
840 if (need_reschedule) { 836 if (need_reschedule) {
841 // This stub won't get a chance to reschedule, so update the count now. 837 // This stub won't get a chance to reschedule, so update the count now.
842 StubSchedulingChanged(true); 838 StubSchedulingChanged(true);
843 } 839 }
844 } 840 }
845 841
846 void GpuChannel::OnCreateVideoEncoder(int32* route_id) {
847 TRACE_EVENT0("gpu", "GpuChannel::OnCreateVideoEncoder");
848
849 *route_id = GenerateRouteID();
850 GpuVideoEncodeAccelerator* encoder =
851 new GpuVideoEncodeAccelerator(this, *route_id);
852 router_.AddRoute(*route_id, encoder);
853 video_encoders_.AddWithID(encoder, *route_id);
854 }
855
856 void GpuChannel::OnDestroyVideoEncoder(int32 route_id) {
857 TRACE_EVENT1(
858 "gpu", "GpuChannel::OnDestroyVideoEncoder", "route_id", route_id);
859 GpuVideoEncodeAccelerator* encoder = video_encoders_.Lookup(route_id);
860 if (!encoder)
861 return;
862 router_.RemoveRoute(route_id);
863 video_encoders_.Remove(route_id);
864 }
865
866 void GpuChannel::OnDevToolsStartEventsRecording(int32* route_id) { 842 void GpuChannel::OnDevToolsStartEventsRecording(int32* route_id) {
867 devtools_gpu_agent_->StartEventsRecording(route_id); 843 devtools_gpu_agent_->StartEventsRecording(route_id);
868 } 844 }
869 845
870 void GpuChannel::OnDevToolsStopEventsRecording() { 846 void GpuChannel::OnDevToolsStopEventsRecording() {
871 devtools_gpu_agent_->StopEventsRecording(); 847 devtools_gpu_agent_->StopEventsRecording();
872 } 848 }
873 849
874 void GpuChannel::MessageProcessed() { 850 void GpuChannel::MessageProcessed() {
875 messages_processed_++; 851 messages_processed_++;
(...skipping 14 matching lines...) Expand all
890 866
891 void GpuChannel::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { 867 void GpuChannel::AddFilter(IPC::ChannelProxy::MessageFilter* filter) {
892 channel_->AddFilter(filter); 868 channel_->AddFilter(filter);
893 } 869 }
894 870
895 void GpuChannel::RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) { 871 void GpuChannel::RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) {
896 channel_->RemoveFilter(filter); 872 channel_->RemoveFilter(filter);
897 } 873 }
898 874
899 } // namespace content 875 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698