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

Side by Side Diff: third_party/WebKit/Source/platform/audio/AudioDSPKernelProcessor.h

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef AudioDSPKernelProcessor_h 31 #ifndef AudioDSPKernelProcessor_h
32 #define AudioDSPKernelProcessor_h 32 #define AudioDSPKernelProcessor_h
33 33
34 #include "platform/audio/AudioBus.h" 34 #include "platform/audio/AudioBus.h"
35 #include "platform/audio/AudioProcessor.h" 35 #include "platform/audio/AudioProcessor.h"
36 #include "wtf/OwnPtr.h"
37 #include "wtf/PassOwnPtr.h"
36 #include "wtf/ThreadingPrimitives.h" 38 #include "wtf/ThreadingPrimitives.h"
37 #include "wtf/Vector.h" 39 #include "wtf/Vector.h"
38 #include <memory>
39 40
40 namespace blink { 41 namespace blink {
41 42
42 class AudioBus; 43 class AudioBus;
43 class AudioDSPKernel; 44 class AudioDSPKernel;
44 class AudioProcessor; 45 class AudioProcessor;
45 46
46 // AudioDSPKernelProcessor processes one input -> one output (N channels each) 47 // AudioDSPKernelProcessor processes one input -> one output (N channels each)
47 // It uses one AudioDSPKernel object per channel to do the processing, thus ther e is no cross-channel processing. 48 // It uses one AudioDSPKernel object per channel to do the processing, thus ther e is no cross-channel processing.
48 // Despite this limitation it turns out to be a very common and useful type of p rocessor. 49 // Despite this limitation it turns out to be a very common and useful type of p rocessor.
49 50
50 class PLATFORM_EXPORT AudioDSPKernelProcessor : public AudioProcessor { 51 class PLATFORM_EXPORT AudioDSPKernelProcessor : public AudioProcessor {
51 public: 52 public:
52 // numberOfChannels may be later changed if object is not yet in an "initial ized" state 53 // numberOfChannels may be later changed if object is not yet in an "initial ized" state
53 AudioDSPKernelProcessor(float sampleRate, unsigned numberOfChannels); 54 AudioDSPKernelProcessor(float sampleRate, unsigned numberOfChannels);
54 55
55 // Subclasses create the appropriate type of processing kernel here. 56 // Subclasses create the appropriate type of processing kernel here.
56 // We'll call this to create a kernel for each channel. 57 // We'll call this to create a kernel for each channel.
57 virtual std::unique_ptr<AudioDSPKernel> createKernel() = 0; 58 virtual PassOwnPtr<AudioDSPKernel> createKernel() = 0;
58 59
59 // AudioProcessor methods 60 // AudioProcessor methods
60 void initialize() override; 61 void initialize() override;
61 void uninitialize() override; 62 void uninitialize() override;
62 void process(const AudioBus* source, AudioBus* destination, size_t framesToP rocess) override; 63 void process(const AudioBus* source, AudioBus* destination, size_t framesToP rocess) override;
63 void reset() override; 64 void reset() override;
64 void setNumberOfChannels(unsigned) override; 65 void setNumberOfChannels(unsigned) override;
65 unsigned numberOfChannels() const override { return m_numberOfChannels; } 66 unsigned numberOfChannels() const override { return m_numberOfChannels; }
66 67
67 double tailTime() const override; 68 double tailTime() const override;
68 double latencyTime() const override; 69 double latencyTime() const override;
69 70
70 protected: 71 protected:
71 Vector<std::unique_ptr<AudioDSPKernel>> m_kernels; 72 Vector<OwnPtr<AudioDSPKernel>> m_kernels;
72 mutable Mutex m_processLock; 73 mutable Mutex m_processLock;
73 bool m_hasJustReset; 74 bool m_hasJustReset;
74 }; 75 };
75 76
76 } // namespace blink 77 } // namespace blink
77 78
78 #endif // AudioDSPKernelProcessor_h 79 #endif // AudioDSPKernelProcessor_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/audio/AudioChannel.cpp ('k') | third_party/WebKit/Source/platform/audio/AudioDestination.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698