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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. 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"
38 #include "wtf/ThreadingPrimitives.h" 36 #include "wtf/ThreadingPrimitives.h"
39 #include "wtf/Vector.h" 37 #include "wtf/Vector.h"
38 #include <memory>
40 39
41 namespace blink { 40 namespace blink {
42 41
43 class AudioBus; 42 class AudioBus;
44 class AudioDSPKernel; 43 class AudioDSPKernel;
45 class AudioProcessor; 44 class AudioProcessor;
46 45
47 // AudioDSPKernelProcessor processes one input -> one output (N channels each) 46 // AudioDSPKernelProcessor processes one input -> one output (N channels each)
48 // It uses one AudioDSPKernel object per channel to do the processing, thus ther e is no cross-channel processing. 47 // It uses one AudioDSPKernel object per channel to do the processing, thus ther e is no cross-channel processing.
49 // Despite this limitation it turns out to be a very common and useful type of p rocessor. 48 // Despite this limitation it turns out to be a very common and useful type of p rocessor.
50 49
51 class PLATFORM_EXPORT AudioDSPKernelProcessor : public AudioProcessor { 50 class PLATFORM_EXPORT AudioDSPKernelProcessor : public AudioProcessor {
52 public: 51 public:
53 // numberOfChannels may be later changed if object is not yet in an "initial ized" state 52 // numberOfChannels may be later changed if object is not yet in an "initial ized" state
54 AudioDSPKernelProcessor(float sampleRate, unsigned numberOfChannels); 53 AudioDSPKernelProcessor(float sampleRate, unsigned numberOfChannels);
55 54
56 // Subclasses create the appropriate type of processing kernel here. 55 // Subclasses create the appropriate type of processing kernel here.
57 // We'll call this to create a kernel for each channel. 56 // We'll call this to create a kernel for each channel.
58 virtual PassOwnPtr<AudioDSPKernel> createKernel() = 0; 57 virtual std::unique_ptr<AudioDSPKernel> createKernel() = 0;
59 58
60 // AudioProcessor methods 59 // AudioProcessor methods
61 void initialize() override; 60 void initialize() override;
62 void uninitialize() override; 61 void uninitialize() override;
63 void process(const AudioBus* source, AudioBus* destination, size_t framesToP rocess) override; 62 void process(const AudioBus* source, AudioBus* destination, size_t framesToP rocess) override;
64 void reset() override; 63 void reset() override;
65 void setNumberOfChannels(unsigned) override; 64 void setNumberOfChannels(unsigned) override;
66 unsigned numberOfChannels() const override { return m_numberOfChannels; } 65 unsigned numberOfChannels() const override { return m_numberOfChannels; }
67 66
68 double tailTime() const override; 67 double tailTime() const override;
69 double latencyTime() const override; 68 double latencyTime() const override;
70 69
71 protected: 70 protected:
72 Vector<OwnPtr<AudioDSPKernel>> m_kernels; 71 Vector<std::unique_ptr<AudioDSPKernel>> m_kernels;
73 mutable Mutex m_processLock; 72 mutable Mutex m_processLock;
74 bool m_hasJustReset; 73 bool m_hasJustReset;
75 }; 74 };
76 75
77 } // namespace blink 76 } // namespace blink
78 77
79 #endif // AudioDSPKernelProcessor_h 78 #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