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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/ConvolverNode.h

Issue 2702243003: Disallow cross-thread Persistent<> read access. (Closed)
Patch Set: rebased upto r451733 Created 3 years, 10 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 void setNormalize(bool normalize) { m_normalize = normalize; } 56 void setNormalize(bool normalize) { m_normalize = normalize; }
57 57
58 private: 58 private:
59 ConvolverHandler(AudioNode&, float sampleRate); 59 ConvolverHandler(AudioNode&, float sampleRate);
60 double tailTime() const override; 60 double tailTime() const override;
61 double latencyTime() const override; 61 double latencyTime() const override;
62 62
63 std::unique_ptr<Reverb> m_reverb; 63 std::unique_ptr<Reverb> m_reverb;
64 // This Persistent doesn't make a reference cycle including the owner 64 // This Persistent doesn't make a reference cycle including the owner
65 // ConvolverNode. 65 // ConvolverNode.
66 Persistent<AudioBuffer> m_buffer; 66 // It is cross-thread, as it will be accessed by the audio and main threads.
67 CrossThreadPersistent<AudioBuffer> m_buffer;
67 68
68 // This synchronizes dynamic changes to the convolution impulse response with 69 // This synchronizes dynamic changes to the convolution impulse response with
69 // process(). 70 // process().
70 mutable Mutex m_processLock; 71 mutable Mutex m_processLock;
71 72
72 // Normalize the impulse response or not. Must default to true. 73 // Normalize the impulse response or not. Must default to true.
73 bool m_normalize; 74 bool m_normalize;
74 75
75 FRIEND_TEST_ALL_PREFIXES(ConvolverNodeTest, ReverbLifetime); 76 FRIEND_TEST_ALL_PREFIXES(ConvolverNodeTest, ReverbLifetime);
76 }; 77 };
(...skipping 15 matching lines...) Expand all
92 private: 93 private:
93 ConvolverNode(BaseAudioContext&); 94 ConvolverNode(BaseAudioContext&);
94 ConvolverHandler& convolverHandler() const; 95 ConvolverHandler& convolverHandler() const;
95 96
96 FRIEND_TEST_ALL_PREFIXES(ConvolverNodeTest, ReverbLifetime); 97 FRIEND_TEST_ALL_PREFIXES(ConvolverNodeTest, ReverbLifetime);
97 }; 98 };
98 99
99 } // namespace blink 100 } // namespace blink
100 101
101 #endif // ConvolverNode_h 102 #endif // ConvolverNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698