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

Side by Side Diff: content/common/gpu/media/gpu_video_decode_accelerator.h

Issue 7292010: Delete GpuVideoService and move GpuVideoDecodeAccelerator ownership to stubs (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_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/shared_memory.h" 11 #include "base/shared_memory.h"
12 #include "ipc/ipc_channel.h" 12 #include "ipc/ipc_channel.h"
13 #include "ipc/ipc_message.h" 13 #include "ipc/ipc_message.h"
14 #include "media/video/video_decode_accelerator.h" 14 #include "media/video/video_decode_accelerator.h"
15 15
16 namespace gpu { 16 namespace gpu {
17 class ReadWriteTokens; 17 class ReadWriteTokens;
18 } 18 }
19 19
20 class GpuCommandBufferStub; 20 class GpuCommandBufferStub;
21 21
22 class GpuVideoDecodeAccelerator 22 class GpuVideoDecodeAccelerator
23 : public base::RefCountedThreadSafe<GpuVideoDecodeAccelerator>, 23 : public IPC::Channel::Listener,
24 public IPC::Channel::Listener,
25 public IPC::Message::Sender, 24 public IPC::Message::Sender,
26 public media::VideoDecodeAccelerator::Client { 25 public media::VideoDecodeAccelerator::Client {
27 public: 26 public:
28 GpuVideoDecodeAccelerator(IPC::Message::Sender* sender, 27 GpuVideoDecodeAccelerator(IPC::Message::Sender* sender,
29 int32 host_route_id, 28 int32 host_route_id,
30 int32 decoder_route_id, 29 int32 decoder_route_id,
31 GpuCommandBufferStub* stub); 30 GpuCommandBufferStub* stub);
32 virtual ~GpuVideoDecodeAccelerator(); 31 virtual ~GpuVideoDecodeAccelerator();
33 32
34 // IPC::Channel::Listener implementation. 33 // IPC::Channel::Listener implementation.
(...skipping 11 matching lines...) Expand all
46 virtual void NotifyInitializeDone() OVERRIDE; 45 virtual void NotifyInitializeDone() OVERRIDE;
47 virtual void NotifyEndOfStream() OVERRIDE; 46 virtual void NotifyEndOfStream() OVERRIDE;
48 virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE; 47 virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE;
49 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE; 48 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE;
50 virtual void NotifyFlushDone() OVERRIDE; 49 virtual void NotifyFlushDone() OVERRIDE;
51 virtual void NotifyAbortDone() OVERRIDE; 50 virtual void NotifyAbortDone() OVERRIDE;
52 51
53 // Function to delegate sending to actual sender. 52 // Function to delegate sending to actual sender.
54 virtual bool Send(IPC::Message* message); 53 virtual bool Send(IPC::Message* message);
55 54
56 void set_video_decode_accelerator(
57 media::VideoDecodeAccelerator* accelerator) {
58 DCHECK(!video_decode_accelerator_.get());
59 video_decode_accelerator_.reset(accelerator);
60 }
61
62 void AssignGLESBuffers(const std::vector<media::GLESBuffer>& buffers);
63
64 // Callback to be fired when the underlying stub receives a new token. 55 // Callback to be fired when the underlying stub receives a new token.
65 void OnSetToken(int32 token); 56 void OnSetToken(int32 token);
66 57
67 private: 58 private:
68 // Defers |msg| for later processing if it specifies a write token that hasn't 59 // Defers |msg| for later processing if it specifies a write token that hasn't
69 // come to pass yet, and set |*deferred| to true. Return false if the message 60 // come to pass yet, and set |*deferred| to true. Return false if the message
70 // failed to parse. 61 // failed to parse.
71 bool DeferMessageIfNeeded(const IPC::Message& msg, bool* deferred); 62 bool DeferMessageIfNeeded(const IPC::Message& msg, bool* deferred);
72 63
73 // Handlers for IPC messages. 64 // Handlers for IPC messages.
74 void OnGetConfigs( 65 void OnGetConfigs(
75 const gpu::ReadWriteTokens& /* tokens */, 66 const gpu::ReadWriteTokens& /* tokens */,
76 const std::vector<uint32>& config, 67 const std::vector<uint32>& config,
77 std::vector<uint32>* configs); 68 std::vector<uint32>* configs);
78 void OnInitialize( 69 void OnInitialize(
79 const gpu::ReadWriteTokens& /* tokens */, 70 const gpu::ReadWriteTokens& /* tokens */,
80 const std::vector<uint32>& configs); 71 const std::vector<uint32>& configs);
81 void OnDecode( 72 void OnDecode(
82 const gpu::ReadWriteTokens& /* tokens */, 73 const gpu::ReadWriteTokens& /* tokens */,
83 base::SharedMemoryHandle handle, int32 id, int32 size); 74 base::SharedMemoryHandle handle, int32 id, int32 size);
84 void OnAssignTextures( 75 void OnAssignGLESBuffers(
85 const gpu::ReadWriteTokens& /* tokens */, 76 const gpu::ReadWriteTokens& /* tokens */,
86 const std::vector<int32>& buffer_ids, 77 const std::vector<int32>& buffer_ids,
87 const std::vector<uint32>& texture_ids, 78 const std::vector<uint32>& texture_ids,
88 const std::vector<gfx::Size>& sizes); 79 const std::vector<gfx::Size>& sizes);
89 void OnAssignSysmemBuffers( 80 void OnAssignSysmemBuffers(
90 const gpu::ReadWriteTokens& /* tokens */, 81 const gpu::ReadWriteTokens& /* tokens */,
91 const std::vector<int32> buffer_ids, 82 const std::vector<int32> buffer_ids,
92 const std::vector<base::SharedMemoryHandle> data, 83 const std::vector<base::SharedMemoryHandle> data,
93 const std::vector<gfx::Size> sizes); 84 const std::vector<gfx::Size> sizes);
94 void OnReusePictureBuffer( 85 void OnReusePictureBuffer(
(...skipping 17 matching lines...) Expand all
112 // Unowned pointer to the underlying GpuCommandBufferStub. 103 // Unowned pointer to the underlying GpuCommandBufferStub.
113 GpuCommandBufferStub* stub_; 104 GpuCommandBufferStub* stub_;
114 105
115 // Pointer to the underlying VideoDecodeAccelerator. 106 // Pointer to the underlying VideoDecodeAccelerator.
116 scoped_ptr<media::VideoDecodeAccelerator> video_decode_accelerator_; 107 scoped_ptr<media::VideoDecodeAccelerator> video_decode_accelerator_;
117 108
118 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); 109 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator);
119 }; 110 };
120 111
121 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ 112 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698