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 #ifndef CHROME_GPU_GPU_VIDEO_SERVICE_H_ | |
6 #define CHROME_GPU_GPU_VIDEO_SERVICE_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "base/scoped_ptr.h" | |
11 #include "base/ref_counted.h" | |
12 #include "base/singleton.h" | |
13 #include "chrome/gpu/gpu_video_decoder.h" | |
14 #include "ipc/ipc_channel.h" | |
15 | |
16 class GpuChannel; | |
17 | |
18 class GpuVideoService : public IPC::Channel::Listener, | |
19 public Singleton<GpuVideoService> { | |
20 public: | |
21 // IPC::Channel::Listener. | |
22 virtual void OnChannelConnected(int32 peer_pid); | |
23 virtual void OnChannelError(); | |
24 virtual void OnMessageReceived(const IPC::Message& message); | |
25 | |
26 bool CreateVideoDecoder(GpuChannel* channel, | |
27 MessageRouter* router, | |
28 GpuVideoDecoderInfoParam* param); | |
29 void DestroyVideoDecoder(MessageRouter* router, | |
30 int32 decoder_id); | |
31 | |
32 private: | |
33 struct GpuVideoDecoderInfo { | |
34 scoped_refptr<GpuVideoDecoder> decoder_; | |
35 GpuChannel* channel_; | |
36 GpuVideoDecoderInfoParam param; | |
37 }; | |
38 | |
39 GpuVideoService(); | |
40 virtual ~GpuVideoService(); | |
41 | |
42 std::map<int32, GpuVideoDecoderInfo> decoder_map_; | |
43 int32 next_available_decoder_id_; | |
44 | |
45 // Specialize video service on different platform will override. | |
46 virtual bool IntializeGpuVideoService(); | |
47 virtual bool UnintializeGpuVideoService(); | |
48 | |
49 int32 GetNextAvailableDecoderID(); | |
50 | |
51 friend struct DefaultSingletonTraits<GpuVideoService>; | |
52 DISALLOW_COPY_AND_ASSIGN(GpuVideoService); | |
53 }; | |
54 | |
55 #endif // CHROME_GPU_GPU_VIDEO_SERVICE_H_ | |
56 | |
OLD | NEW |