| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ |
| 6 #define MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ | 6 #define MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/sequence_checker.h" |
| 15 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
| 16 #include "base/threading/non_thread_safe.h" | |
| 17 #include "ipc/ipc_listener.h" | 17 #include "ipc/ipc_listener.h" |
| 18 #include "ipc/ipc_sender.h" | 18 #include "ipc/ipc_sender.h" |
| 19 #include "media/video/jpeg_decode_accelerator.h" | 19 #include "media/video/jpeg_decode_accelerator.h" |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 class SingleThreadTaskRunner; | 22 class SingleThreadTaskRunner; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace gpu { | 25 namespace gpu { |
| 26 class FilteredSender; | 26 class FilteredSender; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace media { | 29 namespace media { |
| 30 | 30 |
| 31 class GpuJpegDecodeAcceleratorFactoryProvider { | 31 class GpuJpegDecodeAcceleratorFactoryProvider { |
| 32 public: | 32 public: |
| 33 using CreateAcceleratorCB = | 33 using CreateAcceleratorCB = |
| 34 base::Callback<std::unique_ptr<JpegDecodeAccelerator>( | 34 base::Callback<std::unique_ptr<JpegDecodeAccelerator>( |
| 35 scoped_refptr<base::SingleThreadTaskRunner>)>; | 35 scoped_refptr<base::SingleThreadTaskRunner>)>; |
| 36 | 36 |
| 37 // Static query for JPEG supported. This query calls the appropriate | 37 // Static query for JPEG supported. This query calls the appropriate |
| 38 // platform-specific version. | 38 // platform-specific version. |
| 39 static bool IsAcceleratedJpegDecodeSupported(); | 39 static bool IsAcceleratedJpegDecodeSupported(); |
| 40 | 40 |
| 41 static std::vector<CreateAcceleratorCB> GetAcceleratorFactories(); | 41 static std::vector<CreateAcceleratorCB> GetAcceleratorFactories(); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 class GpuJpegDecodeAccelerator | 44 class GpuJpegDecodeAccelerator |
| 45 : public IPC::Sender, | 45 : public IPC::Sender, |
| 46 public base::NonThreadSafe, | |
| 47 public base::SupportsWeakPtr<GpuJpegDecodeAccelerator> { | 46 public base::SupportsWeakPtr<GpuJpegDecodeAccelerator> { |
| 48 public: | 47 public: |
| 49 // |channel| must outlive this object. | 48 // |channel| must outlive this object. |
| 50 // This convenience constructor internally calls | 49 // This convenience constructor internally calls |
| 51 // GpuJpegDecodeAcceleratorFactoryProvider::GetAcceleratorFactories() to | 50 // GpuJpegDecodeAcceleratorFactoryProvider::GetAcceleratorFactories() to |
| 52 // fill |accelerator_factory_functions_|. | 51 // fill |accelerator_factory_functions_|. |
| 53 GpuJpegDecodeAccelerator( | 52 GpuJpegDecodeAccelerator( |
| 54 gpu::FilteredSender* channel, | 53 gpu::FilteredSender* channel, |
| 55 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); | 54 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); |
| 56 | 55 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 87 | 86 |
| 88 // GPU child task runner. | 87 // GPU child task runner. |
| 89 scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; | 88 scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; |
| 90 | 89 |
| 91 // GPU IO task runner. | 90 // GPU IO task runner. |
| 92 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 91 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 93 | 92 |
| 94 // Number of clients added to |filter_|. | 93 // Number of clients added to |filter_|. |
| 95 int client_number_; | 94 int client_number_; |
| 96 | 95 |
| 96 SEQUENCE_CHECKER(sequence_checker_); |
| 97 |
| 97 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator); | 98 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuJpegDecodeAccelerator); |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 } // namespace media | 101 } // namespace media |
| 101 | 102 |
| 102 #endif // MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ | 103 #endif // MEDIA_GPU_IPC_SERVICE_GPU_JPEG_DECODE_ACCELERATOR_H_ |
| OLD | NEW |