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

Side by Side Diff: media/audio/audio_debug_file_writer.h

Issue 2891983002: Make AudioDebugFileWriter::AudioFileWriter use a SequencedTaskRunner (Closed)
Patch Set: move semantic Created 3 years, 7 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
« no previous file with comments | « no previous file | media/audio/audio_debug_file_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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=(OnSequenceDeleter&&);
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_
OLDNEW
« no previous file with comments | « no previous file | media/audio/audio_debug_file_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698