Chromium Code Reviews| 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_AUDIO_AUDIO_DEBUG_FILE_WRITER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_DEBUG_FILE_WRITER_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_DEBUG_FILE_WRITER_H_ | 6 #define MEDIA_AUDIO_AUDIO_DEBUG_FILE_WRITER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/sequence_checker.h" | 15 #include "base/sequence_checker.h" |
| 16 #include "base/sequenced_task_runner.h" | |
| 16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 17 #include "media/base/audio_parameters.h" | 18 #include "media/base/audio_parameters.h" |
| 18 #include "media/base/media_export.h" | 19 #include "media/base/media_export.h" |
| 19 | 20 |
| 20 namespace media { | 21 namespace media { |
| 21 | 22 |
| 22 class AudioBus; | 23 class AudioBus; |
| 23 | 24 |
| 24 // Writes audio data to a 16 bit PCM WAVE file used for debugging purposes. All | 25 // Writes audio data to a 16 bit PCM WAVE file used for debugging purposes. All |
| 25 // operations are non-blocking. | 26 // operations are non-blocking. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 // the filename. | 59 // the filename. |
| 59 virtual const base::FilePath::CharType* GetFileNameExtension(); | 60 virtual const base::FilePath::CharType* GetFileNameExtension(); |
| 60 | 61 |
| 61 protected: | 62 protected: |
| 62 const AudioParameters params_; | 63 const AudioParameters params_; |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 class AudioFileWriter; | 66 class AudioFileWriter; |
| 66 | 67 |
| 67 // Deleter for AudioFileWriter. | 68 // Deleter for AudioFileWriter. |
| 68 struct OnThreadDeleter { | 69 struct OnSequenceDeleter { |
| 69 public: | 70 public: |
| 70 OnThreadDeleter(); | 71 OnSequenceDeleter(); |
| 71 OnThreadDeleter(const OnThreadDeleter& other); | 72 OnSequenceDeleter(OnSequenceDeleter&& other); |
| 72 OnThreadDeleter(scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 73 OnSequenceDeleter& operator=(const OnSequenceDeleter&); |
|
gab
2017/05/18 22:11:21
Actually you want the matching move assignment ope
Sébastien Marchand
2017/05/18 22:47:25
Ha! Time for me to re learn C++11 and the move sem
| |
| 73 ~OnThreadDeleter(); | 74 OnSequenceDeleter(scoped_refptr<base::SequencedTaskRunner> task_runner); |
| 75 ~OnSequenceDeleter(); | |
| 74 void operator()(AudioFileWriter* ptr) const; | 76 void operator()(AudioFileWriter* ptr) const; |
| 75 | 77 |
| 76 private: | 78 private: |
| 77 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 79 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 using AudioFileWriterUniquePtr = | 82 using AudioFileWriterUniquePtr = |
| 81 std::unique_ptr<AudioFileWriter, OnThreadDeleter>; | 83 std::unique_ptr<AudioFileWriter, OnSequenceDeleter>; |
| 82 | 84 |
| 83 AudioFileWriterUniquePtr file_writer_; | 85 AudioFileWriterUniquePtr file_writer_; |
| 84 base::SequenceChecker client_sequence_checker_; | 86 base::SequenceChecker client_sequence_checker_; |
| 85 | 87 |
| 86 // The task runner to do file output operations on. | 88 // The task runner to do file output operations on. |
| 87 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | 89 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
| 88 | 90 |
| 89 DISALLOW_COPY_AND_ASSIGN(AudioDebugFileWriter); | 91 DISALLOW_COPY_AND_ASSIGN(AudioDebugFileWriter); |
| 90 }; | 92 }; |
| 91 | 93 |
| 92 } // namspace media | 94 } // namspace media |
| 93 | 95 |
| 94 #endif // MEDIA_AUDIO_AUDIO_DEBUG_FILE_WRITER_H_ | 96 #endif // MEDIA_AUDIO_AUDIO_DEBUG_FILE_WRITER_H_ |
| OLD | NEW |