OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_AVDA_CODEC_ALLOCATOR_H_ | 5 #ifndef MEDIA_GPU_AVDA_CODEC_ALLOCATOR_H_ |
6 #define MEDIA_GPU_AVDA_CODEC_ALLOCATOR_H_ | 6 #define MEDIA_GPU_AVDA_CODEC_ALLOCATOR_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/android/build_info.h" | 12 #include "base/android/build_info.h" |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/lazy_instance.h" | |
15 #include "base/logging.h" | 14 #include "base/logging.h" |
16 #include "base/optional.h" | 15 #include "base/optional.h" |
17 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
18 #include "base/sys_info.h" | 17 #include "base/sys_info.h" |
19 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
20 #include "base/threading/thread_checker.h" | 19 #include "base/threading/thread_checker.h" |
21 #include "base/time/tick_clock.h" | 20 #include "base/time/tick_clock.h" |
22 #include "base/trace_event/trace_event.h" | 21 #include "base/trace_event/trace_event.h" |
23 #include "media/base/android/media_drm_bridge_cdm_context.h" | 22 #include "media/base/android/media_drm_bridge_cdm_context.h" |
24 #include "media/base/android/sdk_media_codec_bridge.h" | 23 #include "media/base/android/sdk_media_codec_bridge.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // both threads are hung. | 163 // both threads are hung. |
165 base::Optional<TaskType> TaskTypeForAllocation(); | 164 base::Optional<TaskType> TaskTypeForAllocation(); |
166 | 165 |
167 // Return the task runner for tasks of type |type|. | 166 // Return the task runner for tasks of type |type|. |
168 scoped_refptr<base::SingleThreadTaskRunner> TaskRunnerFor(TaskType task_type); | 167 scoped_refptr<base::SingleThreadTaskRunner> TaskRunnerFor(TaskType task_type); |
169 | 168 |
170 // Return a reference to the thread for unit tests. | 169 // Return a reference to the thread for unit tests. |
171 base::Thread& GetThreadForTesting(TaskType task_type); | 170 base::Thread& GetThreadForTesting(TaskType task_type); |
172 | 171 |
173 private: | 172 private: |
174 friend struct base::DefaultLazyInstanceTraits<AVDACodecAllocator>; | |
175 friend class AVDACodecAllocatorTest; | 173 friend class AVDACodecAllocatorTest; |
176 | 174 |
177 struct OwnerRecord { | 175 struct OwnerRecord { |
178 AVDACodecAllocatorClient* owner = nullptr; | 176 AVDACodecAllocatorClient* owner = nullptr; |
179 AVDACodecAllocatorClient* waiter = nullptr; | 177 AVDACodecAllocatorClient* waiter = nullptr; |
180 }; | 178 }; |
181 | 179 |
182 class HangDetector : public base::MessageLoop::TaskObserver { | 180 class HangDetector : public base::MessageLoop::TaskObserver { |
183 public: | 181 public: |
184 HangDetector(base::TickClock* tick_clock); | 182 HangDetector(base::TickClock* tick_clock); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 234 |
237 // For canceling pending StopThreadTask()s. | 235 // For canceling pending StopThreadTask()s. |
238 base::WeakPtrFactory<AVDACodecAllocator> weak_this_factory_; | 236 base::WeakPtrFactory<AVDACodecAllocator> weak_this_factory_; |
239 | 237 |
240 DISALLOW_COPY_AND_ASSIGN(AVDACodecAllocator); | 238 DISALLOW_COPY_AND_ASSIGN(AVDACodecAllocator); |
241 }; | 239 }; |
242 | 240 |
243 } // namespace media | 241 } // namespace media |
244 | 242 |
245 #endif // MEDIA_GPU_AVDA_CODEC_ALLOCATOR_H_ | 243 #endif // MEDIA_GPU_AVDA_CODEC_ALLOCATOR_H_ |
OLD | NEW |