| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/gpu/gpu_channel.h" | |
| 6 #include "chrome/gpu/gpu_video_decoder.h" | |
| 7 #include "chrome/gpu/gpu_video_service.h" | |
| 8 #include "content/common/gpu_messages.h" | |
| 9 | |
| 10 struct GpuVideoService::GpuVideoDecoderInfo { | |
| 11 scoped_refptr<GpuVideoDecoder> decoder; | |
| 12 GpuChannel* channel; | |
| 13 }; | |
| 14 | |
| 15 | |
| 16 GpuVideoService::GpuVideoService() { | |
| 17 // TODO(jiesun): move this time consuming stuff out of here. | |
| 18 IntializeGpuVideoService(); | |
| 19 } | |
| 20 | |
| 21 GpuVideoService::~GpuVideoService() { | |
| 22 // TODO(jiesun): move this time consuming stuff out of here. | |
| 23 UnintializeGpuVideoService(); | |
| 24 } | |
| 25 | |
| 26 // static | |
| 27 GpuVideoService* GpuVideoService::GetInstance() { | |
| 28 return Singleton<GpuVideoService>::get(); | |
| 29 } | |
| 30 | |
| 31 void GpuVideoService::OnChannelConnected(int32 peer_pid) { | |
| 32 LOG(ERROR) << "GpuVideoService::OnChannelConnected"; | |
| 33 } | |
| 34 | |
| 35 void GpuVideoService::OnChannelError() { | |
| 36 LOG(ERROR) << "GpuVideoService::OnChannelError"; | |
| 37 } | |
| 38 | |
| 39 bool GpuVideoService::OnMessageReceived(const IPC::Message& msg) { | |
| 40 #if 0 | |
| 41 IPC_BEGIN_MESSAGE_MAP(GpuVideoService, msg) | |
| 42 IPC_MESSAGE_UNHANDLED_ERROR() | |
| 43 IPC_END_MESSAGE_MAP() | |
| 44 #endif | |
| 45 return false; | |
| 46 } | |
| 47 | |
| 48 bool GpuVideoService::IntializeGpuVideoService() { | |
| 49 return true; | |
| 50 } | |
| 51 | |
| 52 bool GpuVideoService::UnintializeGpuVideoService() { | |
| 53 return true; | |
| 54 } | |
| 55 | |
| 56 bool GpuVideoService::CreateVideoDecoder( | |
| 57 GpuChannel* channel, | |
| 58 MessageRouter* router, | |
| 59 int32 decoder_host_id, | |
| 60 int32 decoder_id, | |
| 61 gpu::gles2::GLES2Decoder* gles2_decoder) { | |
| 62 GpuVideoDecoderInfo decoder_info; | |
| 63 decoder_info.decoder = new GpuVideoDecoder(MessageLoop::current(), | |
| 64 decoder_host_id, | |
| 65 channel, | |
| 66 channel->renderer_process(), | |
| 67 gles2_decoder); | |
| 68 decoder_info.channel = channel; | |
| 69 decoder_map_[decoder_id] = decoder_info; | |
| 70 router->AddRoute(decoder_id, decoder_info.decoder); | |
| 71 | |
| 72 channel->Send(new GpuVideoDecoderHostMsg_CreateVideoDecoderDone( | |
| 73 decoder_host_id, decoder_id)); | |
| 74 return true; | |
| 75 } | |
| 76 | |
| 77 void GpuVideoService::DestroyVideoDecoder( | |
| 78 MessageRouter* router, | |
| 79 int32 decoder_id) { | |
| 80 router->RemoveRoute(decoder_id); | |
| 81 decoder_map_.erase(decoder_id); | |
| 82 } | |
| OLD | NEW |