| 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/renderer/gpu_video_service_host.h" | |
| 6 | |
| 7 #include "chrome/renderer/gpu_video_decoder_host.h" | |
| 8 #include "chrome/renderer/render_thread.h" | |
| 9 #include "content/common/gpu_messages.h" | |
| 10 | |
| 11 GpuVideoServiceHost::GpuVideoServiceHost() | |
| 12 : channel_(NULL), | |
| 13 next_decoder_host_id_(0) { | |
| 14 } | |
| 15 | |
| 16 void GpuVideoServiceHost::OnFilterAdded(IPC::Channel* channel) { | |
| 17 channel_ = channel; | |
| 18 } | |
| 19 | |
| 20 void GpuVideoServiceHost::OnFilterRemoved() { | |
| 21 // TODO(hclam): Implement. | |
| 22 } | |
| 23 | |
| 24 void GpuVideoServiceHost::OnChannelClosing() { | |
| 25 // TODO(hclam): Implement. | |
| 26 } | |
| 27 | |
| 28 bool GpuVideoServiceHost::OnMessageReceived(const IPC::Message& msg) { | |
| 29 switch (msg.type()) { | |
| 30 case GpuVideoDecoderHostMsg_CreateVideoDecoderDone::ID: | |
| 31 case GpuVideoDecoderHostMsg_InitializeACK::ID: | |
| 32 case GpuVideoDecoderHostMsg_DestroyACK::ID: | |
| 33 case GpuVideoDecoderHostMsg_FlushACK::ID: | |
| 34 case GpuVideoDecoderHostMsg_PrerollDone::ID: | |
| 35 case GpuVideoDecoderHostMsg_EmptyThisBufferACK::ID: | |
| 36 case GpuVideoDecoderHostMsg_EmptyThisBufferDone::ID: | |
| 37 case GpuVideoDecoderHostMsg_ConsumeVideoFrame::ID: | |
| 38 case GpuVideoDecoderHostMsg_AllocateVideoFrames::ID: | |
| 39 case GpuVideoDecoderHostMsg_ReleaseAllVideoFrames::ID: | |
| 40 if (!router_.RouteMessage(msg)) { | |
| 41 LOG(ERROR) << "GpuVideoDecoderHostMsg cannot be dispatched."; | |
| 42 } | |
| 43 return true; | |
| 44 default: | |
| 45 return false; | |
| 46 } | |
| 47 } | |
| 48 | |
| 49 GpuVideoDecoderHost* GpuVideoServiceHost::CreateVideoDecoder( | |
| 50 int context_route_id) { | |
| 51 GpuVideoDecoderHost* host = new GpuVideoDecoderHost(&router_, channel_, | |
| 52 context_route_id, | |
| 53 next_decoder_host_id_); | |
| 54 // TODO(hclam): Handle thread safety of incrementing the ID. | |
| 55 ++next_decoder_host_id_; | |
| 56 return host; | |
| 57 } | |
| OLD | NEW |