| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ | 5 #ifndef MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ |
| 6 #define MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ | 6 #define MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/sequence_checker.h" |
| 14 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 15 #include "base/threading/non_thread_safe.h" | |
| 16 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | 16 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| 17 #include "ipc/ipc_listener.h" | 17 #include "ipc/ipc_listener.h" |
| 18 #include "media/video/video_decode_accelerator.h" | 18 #include "media/video/video_decode_accelerator.h" |
| 19 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
| 20 | 20 |
| 21 struct AcceleratedVideoDecoderHostMsg_PictureReady_Params; | 21 struct AcceleratedVideoDecoderHostMsg_PictureReady_Params; |
| 22 | 22 |
| 23 namespace gpu { | 23 namespace gpu { |
| 24 class GpuChannelHost; | 24 class GpuChannelHost; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace media { | 27 namespace media { |
| 28 | 28 |
| 29 // This class is used to talk to VideoDecodeAccelerator in the Gpu process | 29 // This class is used to talk to VideoDecodeAccelerator in the Gpu process |
| 30 // through IPC messages. | 30 // through IPC messages. |
| 31 class GpuVideoDecodeAcceleratorHost | 31 class GpuVideoDecodeAcceleratorHost |
| 32 : public IPC::Listener, | 32 : public IPC::Listener, |
| 33 public VideoDecodeAccelerator, | 33 public VideoDecodeAccelerator, |
| 34 public gpu::CommandBufferProxyImpl::DeletionObserver, | 34 public gpu::CommandBufferProxyImpl::DeletionObserver { |
| 35 public base::NonThreadSafe { | |
| 36 public: | 35 public: |
| 37 // |this| is guaranteed not to outlive |impl|. (See comments for |impl_|.) | 36 // |this| is guaranteed not to outlive |impl|. (See comments for |impl_|.) |
| 38 explicit GpuVideoDecodeAcceleratorHost(gpu::CommandBufferProxyImpl* impl); | 37 explicit GpuVideoDecodeAcceleratorHost(gpu::CommandBufferProxyImpl* impl); |
| 39 | 38 |
| 40 // IPC::Listener implementation. | 39 // IPC::Listener implementation. |
| 41 void OnChannelError() override; | 40 void OnChannelError() override; |
| 42 bool OnMessageReceived(const IPC::Message& message) override; | 41 bool OnMessageReceived(const IPC::Message& message) override; |
| 43 | 42 |
| 44 // VideoDecodeAccelerator implementation. | 43 // VideoDecodeAccelerator implementation. |
| 45 bool Initialize(const Config& config, Client* client) override; | 44 bool Initialize(const Config& config, Client* client) override; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 98 |
| 100 // Requested dimensions of the buffer, from ProvidePictureBuffers(). | 99 // Requested dimensions of the buffer, from ProvidePictureBuffers(). |
| 101 gfx::Size picture_buffer_dimensions_; | 100 gfx::Size picture_buffer_dimensions_; |
| 102 | 101 |
| 103 // Task runner for tasks that should run on the thread this class is | 102 // Task runner for tasks that should run on the thread this class is |
| 104 // constructed. | 103 // constructed. |
| 105 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; | 104 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; |
| 106 | 105 |
| 107 // WeakPtr for posting tasks to ourself. | 106 // WeakPtr for posting tasks to ourself. |
| 108 base::WeakPtr<GpuVideoDecodeAcceleratorHost> weak_this_; | 107 base::WeakPtr<GpuVideoDecodeAcceleratorHost> weak_this_; |
| 108 |
| 109 SEQUENCE_CHECKER(sequence_checker_); |
| 110 |
| 109 base::WeakPtrFactory<GpuVideoDecodeAcceleratorHost> weak_this_factory_; | 111 base::WeakPtrFactory<GpuVideoDecodeAcceleratorHost> weak_this_factory_; |
| 110 | 112 |
| 111 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecodeAcceleratorHost); | 113 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecodeAcceleratorHost); |
| 112 }; | 114 }; |
| 113 | 115 |
| 114 } // namespace media | 116 } // namespace media |
| 115 | 117 |
| 116 #endif // MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ | 118 #endif // MEDIA_GPU_IPC_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ |
| OLD | NEW |