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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/ConvolverNode.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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 10 matching lines...) Expand all
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #ifndef ConvolverNode_h 25 #ifndef ConvolverNode_h
26 #define ConvolverNode_h 26 #define ConvolverNode_h
27 27
28 #include "base/gtest_prod_util.h" 28 #include "base/gtest_prod_util.h"
29 #include "modules/ModulesExport.h" 29 #include "modules/ModulesExport.h"
30 #include "modules/webaudio/AudioNode.h" 30 #include "modules/webaudio/AudioNode.h"
31 #include "wtf/OwnPtr.h"
31 #include "wtf/RefPtr.h" 32 #include "wtf/RefPtr.h"
32 #include "wtf/ThreadingPrimitives.h" 33 #include "wtf/ThreadingPrimitives.h"
33 #include <memory>
34 34
35 namespace blink { 35 namespace blink {
36 36
37 class AudioBuffer; 37 class AudioBuffer;
38 class ExceptionState; 38 class ExceptionState;
39 class Reverb; 39 class Reverb;
40 40
41 class MODULES_EXPORT ConvolverHandler final : public AudioHandler { 41 class MODULES_EXPORT ConvolverHandler final : public AudioHandler {
42 public: 42 public:
43 static PassRefPtr<ConvolverHandler> create(AudioNode&, float sampleRate); 43 static PassRefPtr<ConvolverHandler> create(AudioNode&, float sampleRate);
44 ~ConvolverHandler() override; 44 ~ConvolverHandler() override;
45 45
46 // AudioHandler 46 // AudioHandler
47 void process(size_t framesToProcess) override; 47 void process(size_t framesToProcess) override;
48 48
49 // Impulse responses 49 // Impulse responses
50 void setBuffer(AudioBuffer*, ExceptionState&); 50 void setBuffer(AudioBuffer*, ExceptionState&);
51 AudioBuffer* buffer(); 51 AudioBuffer* buffer();
52 52
53 bool normalize() const { return m_normalize; } 53 bool normalize() const { return m_normalize; }
54 void setNormalize(bool normalize) { m_normalize = normalize; } 54 void setNormalize(bool normalize) { m_normalize = normalize; }
55 55
56 private: 56 private:
57 ConvolverHandler(AudioNode&, float sampleRate); 57 ConvolverHandler(AudioNode&, float sampleRate);
58 double tailTime() const override; 58 double tailTime() const override;
59 double latencyTime() const override; 59 double latencyTime() const override;
60 60
61 std::unique_ptr<Reverb> m_reverb; 61 OwnPtr<Reverb> m_reverb;
62 // This Persistent doesn't make a reference cycle including the owner 62 // This Persistent doesn't make a reference cycle including the owner
63 // ConvolverNode. 63 // ConvolverNode.
64 Persistent<AudioBuffer> m_buffer; 64 Persistent<AudioBuffer> m_buffer;
65 65
66 // This synchronizes dynamic changes to the convolution impulse response wit h process(). 66 // This synchronizes dynamic changes to the convolution impulse response wit h process().
67 mutable Mutex m_processLock; 67 mutable Mutex m_processLock;
68 68
69 // Normalize the impulse response or not. Must default to true. 69 // Normalize the impulse response or not. Must default to true.
70 bool m_normalize; 70 bool m_normalize;
71 71
(...skipping 13 matching lines...) Expand all
85 private: 85 private:
86 ConvolverNode(AbstractAudioContext&); 86 ConvolverNode(AbstractAudioContext&);
87 ConvolverHandler& convolverHandler() const; 87 ConvolverHandler& convolverHandler() const;
88 88
89 FRIEND_TEST_ALL_PREFIXES(ConvolverNodeTest, ReverbLifetime); 89 FRIEND_TEST_ALL_PREFIXES(ConvolverNodeTest, ReverbLifetime);
90 }; 90 };
91 91
92 } // namespace blink 92 } // namespace blink
93 93
94 #endif // ConvolverNode_h 94 #endif // ConvolverNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698