OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_RENDERER_GPU_GPU_VIDEO_SERVICE_HOST_H_ | 5 #ifndef CONTENT_RENDERER_GPU_GPU_VIDEO_SERVICE_HOST_H_ |
6 #define CONTENT_RENDERER_GPU_GPU_VIDEO_SERVICE_HOST_H_ | 6 #define CONTENT_RENDERER_GPU_GPU_VIDEO_SERVICE_HOST_H_ |
7 | 7 |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "content/renderer/gpu/gpu_channel_host.h" | 9 #include "content/renderer/gpu/gpu_channel_host.h" |
10 #include "ipc/ipc_channel.h" | 10 #include "ipc/ipc_channel.h" |
11 #include "media/base/buffers.h" | 11 #include "media/base/buffers.h" |
12 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
13 #include "media/video/video_decode_accelerator.h" | 13 #include "media/video/video_decode_accelerator.h" |
14 | 14 |
15 class GpuVideoDecodeAcceleratorHost; | 15 class GpuVideoDecodeAcceleratorHost; |
| 16 namespace gpu { |
| 17 class CommandBufferHelper; |
| 18 } |
16 | 19 |
17 // GpuVideoServiceHost lives on IO thread and is used to dispatch IPC messages | 20 // GpuVideoServiceHost lives on IO thread and is used to dispatch IPC messages |
18 // to GpuVideoDecoderHost objects. | 21 // to GpuVideoDecoderHost objects. |
19 class GpuVideoServiceHost : public IPC::ChannelProxy::MessageFilter { | 22 class GpuVideoServiceHost : public IPC::ChannelProxy::MessageFilter { |
20 public: | 23 public: |
21 GpuVideoServiceHost(); | 24 GpuVideoServiceHost(); |
22 virtual ~GpuVideoServiceHost(); | 25 virtual ~GpuVideoServiceHost(); |
23 | 26 |
24 // IPC::ChannelProxy::MessageFilter implementations, called on IO thread. | 27 // IPC::ChannelProxy::MessageFilter implementations, called on IO thread. |
25 virtual bool OnMessageReceived(const IPC::Message& message); | 28 virtual bool OnMessageReceived(const IPC::Message& message); |
26 virtual void OnFilterAdded(IPC::Channel* channel); | 29 virtual void OnFilterAdded(IPC::Channel* channel); |
27 virtual void OnFilterRemoved(); | 30 virtual void OnFilterRemoved(); |
28 virtual void OnChannelClosing(); | 31 virtual void OnChannelClosing(); |
29 | 32 |
30 // Register a callback to be notified when |*this| can be used to | 33 // Register a callback to be notified when |*this| can be used to |
31 // CreateVideo{Decoder,Accelerator} below. Called on RenderThread. | 34 // CreateVideo{Decoder,Accelerator} below. Called on RenderThread. |
32 // |on_initialized| will get invoked in-line in this function if |*this| is | 35 // |on_initialized| will get invoked in-line in this function if |*this| is |
33 // already ready for use, and asynchronously after this function returns | 36 // already ready for use, and asynchronously after this function returns |
34 // otherwise. | 37 // otherwise. |
35 void SetOnInitialized(const base::Closure& on_initialized); | 38 void SetOnInitialized(const base::Closure& on_initialized); |
36 | 39 |
37 // Called on RenderThread to create a hardware accelerated video decoder | 40 // Called on RenderThread to create a hardware accelerated video decoder |
38 // in the GPU process. | 41 // in the GPU process. |
39 GpuVideoDecodeAcceleratorHost* CreateVideoAccelerator( | 42 GpuVideoDecodeAcceleratorHost* CreateVideoAccelerator( |
40 media::VideoDecodeAccelerator::Client* client, | 43 media::VideoDecodeAccelerator::Client* client, |
41 int command_buffer_route_id); | 44 int32 command_buffer_route_id, |
| 45 gpu::CommandBufferHelper* cmd_buffer_helper); |
42 | 46 |
43 private: | 47 private: |
44 // Guards all members other than |router_|. | 48 // Guards all members other than |router_|. |
45 base::Lock lock_; | 49 base::Lock lock_; |
46 | 50 |
47 // Reference to the channel that the service listens to. | 51 // Reference to the channel that the service listens to. |
48 IPC::Channel* channel_; | 52 IPC::Channel* channel_; |
49 | 53 |
50 // Router to send messages to a GpuVideoDecoderHost. | 54 // Router to send messages to a GpuVideoDecoderHost. |
51 MessageRouter router_; | 55 MessageRouter router_; |
52 | 56 |
53 // ID for the next GpuVideoDecoderHost. | 57 // ID for the next GpuVideoDecoderHost. |
54 int32 next_decoder_host_id_; | 58 int32 next_decoder_host_id_; |
55 | 59 |
56 // Callback to invoke when initialized. | 60 // Callback to invoke when initialized. |
57 base::Closure on_initialized_; | 61 base::Closure on_initialized_; |
58 | 62 |
59 DISALLOW_COPY_AND_ASSIGN(GpuVideoServiceHost); | 63 DISALLOW_COPY_AND_ASSIGN(GpuVideoServiceHost); |
60 }; | 64 }; |
61 | 65 |
62 #endif // CONTENT_RENDERER_GPU_GPU_VIDEO_SERVICE_HOST_H_ | 66 #endif // CONTENT_RENDERER_GPU_GPU_VIDEO_SERVICE_HOST_H_ |
OLD | NEW |