blob: 2971ff2225bd53477056b85fc3946ef4d0363a93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/renderer/gpu_video_service_host.h"
#include "chrome/common/gpu_messages.h"
#include "chrome/renderer/gpu_video_decoder_host.h"
#include "chrome/renderer/render_thread.h"
GpuVideoServiceHost::GpuVideoServiceHost()
: channel_(NULL),
next_decoder_host_id_(0) {
}
void GpuVideoServiceHost::OnFilterAdded(IPC::Channel* channel) {
channel_ = channel;
}
void GpuVideoServiceHost::OnFilterRemoved() {
// TODO(hclam): Implement.
}
void GpuVideoServiceHost::OnChannelClosing() {
// TODO(hclam): Implement.
}
bool GpuVideoServiceHost::OnMessageReceived(const IPC::Message& msg) {
switch (msg.type()) {
case GpuVideoDecoderHostMsg_CreateVideoDecoderDone::ID:
case GpuVideoDecoderHostMsg_InitializeACK::ID:
case GpuVideoDecoderHostMsg_DestroyACK::ID:
case GpuVideoDecoderHostMsg_FlushACK::ID:
case GpuVideoDecoderHostMsg_PrerollDone::ID:
case GpuVideoDecoderHostMsg_EmptyThisBufferACK::ID:
case GpuVideoDecoderHostMsg_EmptyThisBufferDone::ID:
case GpuVideoDecoderHostMsg_ConsumeVideoFrame::ID:
case GpuVideoDecoderHostMsg_AllocateVideoFrames::ID:
case GpuVideoDecoderHostMsg_ReleaseAllVideoFrames::ID:
if (!router_.RouteMessage(msg)) {
LOG(ERROR) << "GpuVideoDecoderHostMsg cannot be dispatched.";
}
return true;
default:
return false;
}
}
GpuVideoDecoderHost* GpuVideoServiceHost::CreateVideoDecoder(
int context_route_id) {
GpuVideoDecoderHost* host = new GpuVideoDecoderHost(&router_, channel_,
context_route_id,
next_decoder_host_id_);
// TODO(hclam): Handle thread safety of incrementing the ID.
++next_decoder_host_id_;
return host;
}
|