OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 Loading... |
56 unsigned numberOfRenderingConnections() const { return m_renderingOutputs.si
ze(); } | 56 unsigned numberOfRenderingConnections() const { return m_renderingOutputs.si
ze(); } |
57 AudioNodeOutput* renderingOutput(unsigned i) { return m_renderingOutputs[i];
} | 57 AudioNodeOutput* renderingOutput(unsigned i) { return m_renderingOutputs[i];
} |
58 bool isConnected() const { return numberOfRenderingConnections() > 0; } | 58 bool isConnected() const { return numberOfRenderingConnections() > 0; } |
59 | 59 |
60 virtual bool canUpdateState() = 0; | 60 virtual bool canUpdateState() = 0; |
61 virtual void didUpdate() = 0; | 61 virtual void didUpdate() = 0; |
62 | 62 |
63 protected: | 63 protected: |
64 explicit AudioSummingJunction(AudioContext*); | 64 explicit AudioSummingJunction(AudioContext*); |
65 | 65 |
66 // Oilpan: m_context can be null only in the destructor because | 66 RefPtrWillBeMember<AudioContext> m_context; |
67 // AudioSummingJunction objects are owned by AudioNodes, and AudioNodes have | |
68 // strong references to AudioContext. | |
69 // Theorically this should be a strong reference and AudioContext:: | |
70 // m_dirtySummingJunctions should be HeapHashSet<WeakMember< | |
71 // AudioSummingJunction>>, but we can't do them because the map is modified | |
72 // in an audio rendering thread, which has no GC support. We need to remove | |
73 // an AudioSummingJunction from AudioContext in ~AudioSummingJunction, and | |
74 // this WeakMember<> makes it possible though we can't do it with Member<>. | |
75 RefPtrWillBeWeakMember<AudioContext> m_context; | |
76 | 67 |
77 // m_outputs contains the AudioNodeOutputs representing current connections
which are not disabled. | 68 // m_outputs contains the AudioNodeOutputs representing current connections
which are not disabled. |
78 // The rendering code should never use this directly, but instead uses m_ren
deringOutputs. | 69 // The rendering code should never use this directly, but instead uses m_ren
deringOutputs. |
79 HashSet<AudioNodeOutput*> m_outputs; | 70 HashSet<AudioNodeOutput*> m_outputs; |
80 | 71 |
81 // m_renderingOutputs is a copy of m_outputs which will never be modified du
ring the graph rendering on the audio thread. | 72 // m_renderingOutputs is a copy of m_outputs which will never be modified du
ring the graph rendering on the audio thread. |
82 // This is the list which is used by the rendering code. | 73 // This is the list which is used by the rendering code. |
83 // Whenever m_outputs is modified, the context is told so it can later updat
e m_renderingOutputs from m_outputs at a safe time. | 74 // Whenever m_outputs is modified, the context is told so it can later updat
e m_renderingOutputs from m_outputs at a safe time. |
84 // Most of the time, m_renderingOutputs is identical to m_outputs. | 75 // Most of the time, m_renderingOutputs is identical to m_outputs. |
85 Vector<AudioNodeOutput*> m_renderingOutputs; | 76 Vector<AudioNodeOutput*> m_renderingOutputs; |
86 | 77 |
87 // m_renderingStateNeedUpdating keeps track if m_outputs is modified. | 78 // m_renderingStateNeedUpdating keeps track if m_outputs is modified. |
88 bool m_renderingStateNeedUpdating; | 79 bool m_renderingStateNeedUpdating; |
89 }; | 80 }; |
90 | 81 |
91 } // namespace WebCore | 82 } // namespace WebCore |
92 | 83 |
93 #endif // AudioSummingJunction_h | 84 #endif // AudioSummingJunction_h |
OLD | NEW |