| OLD | NEW |
| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 AudioHandler(NodeType, AudioNode&, float sample_rate); | 101 AudioHandler(NodeType, AudioNode&, float sample_rate); |
| 102 virtual ~AudioHandler(); | 102 virtual ~AudioHandler(); |
| 103 // dispose() is called when the owner AudioNode is about to be | 103 // dispose() is called when the owner AudioNode is about to be |
| 104 // destructed. This must be called in the main thread, and while the graph | 104 // destructed. This must be called in the main thread, and while the graph |
| 105 // lock is held. | 105 // lock is held. |
| 106 // Do not release resources used by an audio rendering thread in dispose(). | 106 // Do not release resources used by an audio rendering thread in dispose(). |
| 107 virtual void Dispose(); | 107 virtual void Dispose(); |
| 108 | 108 |
| 109 // node() returns a valid object until dispose() is called. This returns | 109 // GetNode() returns a valid object until dispose() is called. This returns |
| 110 // nullptr after dispose(). We must not call node() in an audio rendering | 110 // nullptr after dispose(). We must not call GetNode() in an audio rendering |
| 111 // thread. | 111 // thread. |
| 112 AudioNode* GetNode() const; | 112 AudioNode* GetNode() const; |
| 113 // context() returns a valid object until the BaseAudioContext dies, and | 113 // context() returns a valid object until the BaseAudioContext dies, and |
| 114 // returns nullptr otherwise. This always returns a valid object in an audio | 114 // returns nullptr otherwise. This always returns a valid object in an audio |
| 115 // rendering thread, and inside dispose(). We must not call context() in the | 115 // rendering thread, and inside dispose(). We must not call context() in the |
| 116 // destructor. | 116 // destructor. |
| 117 virtual BaseAudioContext* Context() const; | 117 virtual BaseAudioContext* Context() const; |
| 118 void ClearContext() { context_ = nullptr; } | 118 void ClearContext() { context_ = nullptr; } |
| 119 | 119 |
| 120 enum ChannelCountMode { kMax, kClampedMax, kExplicit }; | 120 enum ChannelCountMode { kMax, kClampedMax, kExplicit }; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // Force all inputs to take any channel interpretation changes into account. | 252 // Force all inputs to take any channel interpretation changes into account. |
| 253 void UpdateChannelsForInputs(); | 253 void UpdateChannelsForInputs(); |
| 254 | 254 |
| 255 private: | 255 private: |
| 256 void SetNodeType(NodeType); | 256 void SetNodeType(NodeType); |
| 257 | 257 |
| 258 volatile bool is_initialized_; | 258 volatile bool is_initialized_; |
| 259 NodeType node_type_; | 259 NodeType node_type_; |
| 260 | 260 |
| 261 // The owner AudioNode. This untraced member is safe because dispose() is | 261 // The owner AudioNode. This untraced member is safe because dispose() is |
| 262 // called before the AudioNode death, and it clears m_node. Do not access | 262 // called before the AudioNode death, and it clears |node_|. Do not access |
| 263 // m_node directly, use node() instead. | 263 // |node_| directly, use GetNode() instead. |
| 264 // See http://crbug.com/404527 for the detail. | 264 // See http://crbug.com/404527 for the detail. |
| 265 UntracedMember<AudioNode> node_; | 265 UntracedMember<AudioNode> node_; |
| 266 | 266 |
| 267 // This untraced member is safe because this is cleared for all of live | 267 // This untraced member is safe because this is cleared for all of live |
| 268 // AudioHandlers when the BaseAudioContext dies. Do not access m_context | 268 // AudioHandlers when the BaseAudioContext dies. Do not access m_context |
| 269 // directly, use context() instead. | 269 // directly, use context() instead. |
| 270 // See http://crbug.com/404527 for the detail. | 270 // See http://crbug.com/404527 for the detail. |
| 271 UntracedMember<BaseAudioContext> context_; | 271 UntracedMember<BaseAudioContext> context_; |
| 272 | 272 |
| 273 Vector<std::unique_ptr<AudioNodeInput>> inputs_; | 273 Vector<std::unique_ptr<AudioNodeInput>> inputs_; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 HeapVector<Member<HeapHashSet<Member<AudioNode>>>> connected_nodes_; | 372 HeapVector<Member<HeapHashSet<Member<AudioNode>>>> connected_nodes_; |
| 373 // Represents audio node graph with Oilpan references. N-th HeapHashSet | 373 // Represents audio node graph with Oilpan references. N-th HeapHashSet |
| 374 // represents a set of AudioParam objects connected to this AudioNode's N-th | 374 // represents a set of AudioParam objects connected to this AudioNode's N-th |
| 375 // output. | 375 // output. |
| 376 HeapVector<Member<HeapHashSet<Member<AudioParam>>>> connected_params_; | 376 HeapVector<Member<HeapHashSet<Member<AudioParam>>>> connected_params_; |
| 377 }; | 377 }; |
| 378 | 378 |
| 379 } // namespace blink | 379 } // namespace blink |
| 380 | 380 |
| 381 #endif // AudioNode_h | 381 #endif // AudioNode_h |
| OLD | NEW |