summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/gpu_video_service_host.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-03 18:50:03 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-03 18:50:03 +0000
commit6b723128f5c6b090b87949875dcc4e55304a4461 (patch)
treee842700264053ff9223e448cfee5a2f8d4651721 /chrome/renderer/gpu_video_service_host.cc
parent861100f087f00a810bae058af90bbd31fcc9aa2b (diff)
downloadchromium_src-6b723128f5c6b090b87949875dcc4e55304a4461.zip
chromium_src-6b723128f5c6b090b87949875dcc4e55304a4461.tar.gz
chromium_src-6b723128f5c6b090b87949875dcc4e55304a4461.tar.bz2
Connect GpuVideoDecodeServiceHost with ggl::Context and CommandBufferProxy
BUG=53714 A GpuVideoDecodeServiceHost needs to be connected with a ggl::Contect and its associated comand buffer for the following reasons: 1. The gpu video decoder in gpu process needs to be in the correct GLES2 context. 2. On context lost the gpu video decoder needs to destroy itself. This patch is able to connect the GpuVideoDecoderHost to the context although the context is not passed into the decoder, so the code path is currently broken. In a future patch we need to do the following: 1. Inject a ggl::Context into IpcVideoDecoder. 2. Complete the plumbing so that inside the gpu process we can associate a video decoder with a GLES2 context. Review URL: http://codereview.chromium.org/3215008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58517 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/gpu_video_service_host.cc')
-rw-r--r--chrome/renderer/gpu_video_service_host.cc60
1 files changed, 15 insertions, 45 deletions
diff --git a/chrome/renderer/gpu_video_service_host.cc b/chrome/renderer/gpu_video_service_host.cc
index c80e35d..0c64230 100644
--- a/chrome/renderer/gpu_video_service_host.cc
+++ b/chrome/renderer/gpu_video_service_host.cc
@@ -29,51 +29,6 @@ void GpuVideoServiceHost::OnMessageReceived(const IPC::Message& msg) {
#endif
}
-scoped_refptr<GpuVideoDecoderHost> GpuVideoServiceHost::CreateVideoDecoder(
- GpuVideoDecoderHost::EventHandler* event_handler) {
- DCHECK(RenderThread::current());
-
- if (!channel_host_ || !service_info_.service_available_)
- return NULL;
-
- GpuVideoDecoderInfoParam param;
- if (!channel_host_->Send(new GpuChannelMsg_CreateVideoDecoder(&param))) {
- LOG(ERROR) << "GpuChannelMsg_CreateVideoDecoder failed";
- return NULL;
- }
-
- scoped_refptr<GpuVideoDecoderHost> gpu_video_decoder_host =
- new GpuVideoDecoderHost(this, channel_host_, event_handler, param);
- if (!gpu_video_decoder_host.get()) {
- if (!channel_host_->Send(
- new GpuChannelMsg_DestroyVideoDecoder(param.decoder_id_))) {
- LOG(ERROR) << "GpuChannelMsg_DestroyVideoDecoder failed";
- }
- return NULL;
- }
-
- router_->AddRoute(gpu_video_decoder_host->my_route_id(),
- gpu_video_decoder_host.get());
- return gpu_video_decoder_host;
-}
-
-void GpuVideoServiceHost::DestroyVideoDecoder(
- scoped_refptr<GpuVideoDecoderHost> gpu_video_decoder_host) {
- DCHECK(RenderThread::current());
-
- if (!channel_host_ || !service_info_.service_available_)
- return;
-
- DCHECK(gpu_video_decoder_host.get());
-
- int32 decoder_id = gpu_video_decoder_host->decoder_id();
- if (!channel_host_->Send(new GpuChannelMsg_DestroyVideoDecoder(decoder_id))) {
- LOG(ERROR) << "GpuChannelMsg_DestroyVideoDecoder failed";
- }
-
- router_->RemoveRoute(gpu_video_decoder_host->my_route_id());
-}
-
void GpuVideoServiceHost::OnRendererThreadInit(MessageLoop* message_loop) {
message_loop_ = message_loop;
}
@@ -96,3 +51,18 @@ void GpuVideoServiceHost::OnGpuChannelConnected(
router->AddRoute(service_info_.video_service_host_route_id_, this);
}
+GpuVideoDecoderHost* GpuVideoServiceHost::CreateVideoDecoder(
+ int context_route_id) {
+ DCHECK(RenderThread::current());
+
+ return new GpuVideoDecoderHost(this, channel_host_, context_route_id);
+}
+
+void GpuVideoServiceHost::AddRoute(int route_id,
+ GpuVideoDecoderHost* decoder_host) {
+ router_->AddRoute(route_id, decoder_host);
+}
+
+void GpuVideoServiceHost::RemoveRoute(int route_id) {
+ router_->RemoveRoute(route_id);
+}