Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: content/renderer/gpu/gpu_video_service_host.h

Issue 7260008: Implement proper synchronization between HW video decode IPC and CommandBuffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/threading/non_thread_safe.h"
9 #include "content/renderer/gpu/gpu_channel_host.h" 10 #include "content/renderer/gpu/gpu_channel_host.h"
10 #include "ipc/ipc_channel.h" 11 #include "ipc/ipc_channel.h"
11 #include "media/base/buffers.h" 12 #include "media/base/buffers.h"
12 #include "media/base/video_frame.h" 13 #include "media/base/video_frame.h"
13 #include "media/video/video_decode_accelerator.h" 14 #include "media/video/video_decode_accelerator.h"
14 15
15 class GpuVideoDecodeAcceleratorHost; 16 class GpuVideoDecodeAcceleratorHost;
17 namespace gpu {
18 class CommandBufferHelper;
19 }
16 20
17 // GpuVideoServiceHost lives on IO thread and is used to dispatch IPC messages 21 // GpuVideoServiceHost lives on renderer thread and is used to dispatch IPC
18 // to GpuVideoDecoderHost objects. 22 // messages to GpuVideoDecodeAcceleratorHost objects.
19 class GpuVideoServiceHost : public IPC::ChannelProxy::MessageFilter { 23 class GpuVideoServiceHost
24 : public IPC::Channel::Listener,
25 public base::NonThreadSafe,
26 public base::RefCountedThreadSafe<GpuVideoServiceHost> {
20 public: 27 public:
21 GpuVideoServiceHost(); 28 GpuVideoServiceHost();
22 virtual ~GpuVideoServiceHost(); 29 virtual ~GpuVideoServiceHost();
23 30
24 // IPC::ChannelProxy::MessageFilter implementations, called on IO thread. 31 void set_channel(IPC::SyncChannel* channel);
25 virtual bool OnMessageReceived(const IPC::Message& message); 32
26 virtual void OnFilterAdded(IPC::Channel* channel); 33 // IPC::Channel::Listener implementation; called on render thread because of
27 virtual void OnFilterRemoved(); 34 // GpuChannelHost's use of a ChannelProxy/SyncChannel.
28 virtual void OnChannelClosing(); 35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
36 virtual void OnChannelError() OVERRIDE;
29 37
30 // Register a callback to be notified when |*this| can be used to 38 // Register a callback to be notified when |*this| can be used to
31 // CreateVideo{Decoder,Accelerator} below. Called on RenderThread. 39 // CreateVideo{Decoder,Accelerator} below. Called on RenderThread.
32 // |on_initialized| will get invoked in-line in this function if |*this| is 40 // |on_initialized| will get invoked in-line in this function if |*this| is
33 // already ready for use, and asynchronously after this function returns 41 // already ready for use, and asynchronously after this function returns
34 // otherwise. 42 // otherwise.
35 void SetOnInitialized(const base::Closure& on_initialized); 43 void SetOnInitialized(const base::Closure& on_initialized);
36 44
37 // Called on RenderThread to create a hardware accelerated video decoder 45 // Called on RenderThread to create a hardware accelerated video decoder
38 // in the GPU process. 46 // in the GPU process.
39 GpuVideoDecodeAcceleratorHost* CreateVideoAccelerator( 47 GpuVideoDecodeAcceleratorHost* CreateVideoAccelerator(
40 media::VideoDecodeAccelerator::Client* client, 48 media::VideoDecodeAccelerator::Client* client,
41 int command_buffer_route_id); 49 int32 command_buffer_route_id,
50 gpu::CommandBufferHelper* cmd_buffer_helper);
42 51
43 private: 52 private:
44 // Guards all members other than |router_|.
45 base::Lock lock_;
46
47 // Reference to the channel that the service listens to. 53 // Reference to the channel that the service listens to.
48 IPC::Channel* channel_; 54 IPC::SyncChannel* channel_;
49 55
50 // Router to send messages to a GpuVideoDecoderHost. 56 // Router to send messages to a GpuVideoDecoderHost.
51 MessageRouter router_; 57 MessageRouter router_;
52 58
53 // ID for the next GpuVideoDecoderHost. 59 // ID for the next GpuVideoDecoderHost.
54 int32 next_decoder_host_id_; 60 int32 next_decoder_host_id_;
55 61
56 // Callback to invoke when initialized. 62 // Callback to invoke when initialized.
57 base::Closure on_initialized_; 63 base::Closure on_initialized_;
58 64
59 DISALLOW_COPY_AND_ASSIGN(GpuVideoServiceHost); 65 DISALLOW_COPY_AND_ASSIGN(GpuVideoServiceHost);
60 }; 66 };
61 67
62 #endif // CONTENT_RENDERER_GPU_GPU_VIDEO_SERVICE_HOST_H_ 68 #endif // CONTENT_RENDERER_GPU_GPU_VIDEO_SERVICE_HOST_H_
OLDNEW
« no previous file with comments | « content/renderer/gpu/gpu_video_decode_accelerator_host.cc ('k') | content/renderer/gpu/gpu_video_service_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698