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

Side by Side Diff: Source/modules/webaudio/AudioContext.h

Issue 19724003: Revert "Transition modules/** to use ExceptionState" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/webaudio/AudioBuffer.cpp ('k') | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 28 matching lines...) Expand all
39 #include "wtf/PassRefPtr.h" 39 #include "wtf/PassRefPtr.h"
40 #include "wtf/RefCounted.h" 40 #include "wtf/RefCounted.h"
41 #include "wtf/RefPtr.h" 41 #include "wtf/RefPtr.h"
42 #include "wtf/ThreadSafeRefCounted.h" 42 #include "wtf/ThreadSafeRefCounted.h"
43 #include "wtf/Threading.h" 43 #include "wtf/Threading.h"
44 #include "wtf/Vector.h" 44 #include "wtf/Vector.h"
45 #include "wtf/text/AtomicStringHash.h" 45 #include "wtf/text/AtomicStringHash.h"
46 46
47 namespace WebCore { 47 namespace WebCore {
48 48
49 class AnalyserNode;
50 class AudioBuffer; 49 class AudioBuffer;
51 class AudioBufferCallback; 50 class AudioBufferCallback;
52 class AudioBufferSourceNode; 51 class AudioBufferSourceNode;
52 class MediaElementAudioSourceNode;
53 class MediaStreamAudioDestinationNode;
54 class MediaStreamAudioSourceNode;
55 class HTMLMediaElement;
56 class ChannelMergerNode;
57 class ChannelSplitterNode;
58 class GainNode;
59 class PannerNode;
53 class AudioListener; 60 class AudioListener;
54 class AudioSummingJunction; 61 class AudioSummingJunction;
55 class BiquadFilterNode; 62 class BiquadFilterNode;
56 class ChannelMergerNode;
57 class ChannelSplitterNode;
58 class ConvolverNode;
59 class DelayNode; 63 class DelayNode;
60 class Document; 64 class Document;
65 class ConvolverNode;
61 class DynamicsCompressorNode; 66 class DynamicsCompressorNode;
62 class ExceptionState; 67 class AnalyserNode;
63 class GainNode; 68 class WaveShaperNode;
64 class HTMLMediaElement; 69 class ScriptProcessorNode;
65 class MediaElementAudioSourceNode;
66 class MediaStreamAudioDestinationNode;
67 class MediaStreamAudioSourceNode;
68 class OscillatorNode; 70 class OscillatorNode;
69 class PannerNode;
70 class PeriodicWave; 71 class PeriodicWave;
71 class ScriptProcessorNode;
72 class WaveShaperNode;
73 72
74 // AudioContext is the cornerstone of the web audio API and all AudioNodes are c reated from it. 73 // AudioContext is the cornerstone of the web audio API and all AudioNodes are c reated from it.
75 // For thread safety between the audio thread and the main thread, it has a rend ering graph locking mechanism. 74 // For thread safety between the audio thread and the main thread, it has a rend ering graph locking mechanism.
76 75
77 class AudioContext : public ActiveDOMObject, public ScriptWrappable, public Thre adSafeRefCounted<AudioContext>, public EventTarget { 76 class AudioContext : public ActiveDOMObject, public ScriptWrappable, public Thre adSafeRefCounted<AudioContext>, public EventTarget {
78 public: 77 public:
79 // Create an AudioContext for rendering to the audio hardware. 78 // Create an AudioContext for rendering to the audio hardware.
80 static PassRefPtr<AudioContext> create(Document*); 79 static PassRefPtr<AudioContext> create(Document*);
81 80
82 // Create an AudioContext for offline (non-realtime) rendering. 81 // Create an AudioContext for offline (non-realtime) rendering.
83 static PassRefPtr<AudioContext> createOfflineContext(Document*, unsigned num berOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState&); 82 static PassRefPtr<AudioContext> createOfflineContext(Document*, unsigned num berOfChannels, size_t numberOfFrames, float sampleRate, ExceptionCode&);
84 83
85 virtual ~AudioContext(); 84 virtual ~AudioContext();
86 85
87 bool isInitialized() const; 86 bool isInitialized() const;
88 87
89 bool isOfflineContext() { return m_isOfflineContext; } 88 bool isOfflineContext() { return m_isOfflineContext; }
90 89
91 // Returns true when initialize() was called AND all asynchronous initializa tion has completed. 90 // Returns true when initialize() was called AND all asynchronous initializa tion has completed.
92 bool isRunnable() const; 91 bool isRunnable() const;
93 92
94 HRTFDatabaseLoader* hrtfDatabaseLoader() const { return m_hrtfDatabaseLoader .get(); } 93 HRTFDatabaseLoader* hrtfDatabaseLoader() const { return m_hrtfDatabaseLoader .get(); }
95 94
96 // Document notification 95 // Document notification
97 virtual void stop(); 96 virtual void stop();
98 97
99 Document* document() const; // ASSERTs if document no longer exists. 98 Document* document() const; // ASSERTs if document no longer exists.
100 bool hasDocument(); 99 bool hasDocument();
101 100
102 AudioDestinationNode* destination() { return m_destinationNode.get(); } 101 AudioDestinationNode* destination() { return m_destinationNode.get(); }
103 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF rame(); } 102 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF rame(); }
104 double currentTime() const { return m_destinationNode->currentTime(); } 103 double currentTime() const { return m_destinationNode->currentTime(); }
105 float sampleRate() const { return m_destinationNode->sampleRate(); } 104 float sampleRate() const { return m_destinationNode->sampleRate(); }
106 unsigned long activeSourceCount() const { return static_cast<unsigned long>( m_activeSourceCount); } 105 unsigned long activeSourceCount() const { return static_cast<unsigned long>( m_activeSourceCount); }
107 106
108 void incrementActiveSourceCount(); 107 void incrementActiveSourceCount();
109 void decrementActiveSourceCount(); 108 void decrementActiveSourceCount();
110 109
111 PassRefPtr<AudioBuffer> createBuffer(unsigned numberOfChannels, size_t numbe rOfFrames, float sampleRate, ExceptionState&); 110 PassRefPtr<AudioBuffer> createBuffer(unsigned numberOfChannels, size_t numbe rOfFrames, float sampleRate, ExceptionCode&);
112 PassRefPtr<AudioBuffer> createBuffer(ArrayBuffer*, bool mixToMono, Exception State&); 111 PassRefPtr<AudioBuffer> createBuffer(ArrayBuffer*, bool mixToMono, Exception Code&);
113 112
114 // Asynchronous audio file data decoding. 113 // Asynchronous audio file data decoding.
115 void decodeAudioData(ArrayBuffer*, PassRefPtr<AudioBufferCallback>, PassRefP tr<AudioBufferCallback>, ExceptionState&); 114 void decodeAudioData(ArrayBuffer*, PassRefPtr<AudioBufferCallback>, PassRefP tr<AudioBufferCallback>, ExceptionCode&);
116 115
117 AudioListener* listener() { return m_listener.get(); } 116 AudioListener* listener() { return m_listener.get(); }
118 117
119 // The AudioNode create methods are called on the main thread (from JavaScri pt). 118 // The AudioNode create methods are called on the main thread (from JavaScri pt).
120 PassRefPtr<AudioBufferSourceNode> createBufferSource(); 119 PassRefPtr<AudioBufferSourceNode> createBufferSource();
121 PassRefPtr<MediaElementAudioSourceNode> createMediaElementSource(HTMLMediaEl ement*, ExceptionState&); 120 PassRefPtr<MediaElementAudioSourceNode> createMediaElementSource(HTMLMediaEl ement*, ExceptionCode&);
122 PassRefPtr<MediaStreamAudioSourceNode> createMediaStreamSource(MediaStream*, ExceptionState&); 121 PassRefPtr<MediaStreamAudioSourceNode> createMediaStreamSource(MediaStream*, ExceptionCode&);
123 PassRefPtr<MediaStreamAudioDestinationNode> createMediaStreamDestination(); 122 PassRefPtr<MediaStreamAudioDestinationNode> createMediaStreamDestination();
124 PassRefPtr<GainNode> createGain(); 123 PassRefPtr<GainNode> createGain();
125 PassRefPtr<BiquadFilterNode> createBiquadFilter(); 124 PassRefPtr<BiquadFilterNode> createBiquadFilter();
126 PassRefPtr<WaveShaperNode> createWaveShaper(); 125 PassRefPtr<WaveShaperNode> createWaveShaper();
127 PassRefPtr<DelayNode> createDelay(ExceptionState&); 126 PassRefPtr<DelayNode> createDelay(ExceptionCode&);
128 PassRefPtr<DelayNode> createDelay(double maxDelayTime, ExceptionState&); 127 PassRefPtr<DelayNode> createDelay(double maxDelayTime, ExceptionCode&);
129 PassRefPtr<PannerNode> createPanner(); 128 PassRefPtr<PannerNode> createPanner();
130 PassRefPtr<ConvolverNode> createConvolver(); 129 PassRefPtr<ConvolverNode> createConvolver();
131 PassRefPtr<DynamicsCompressorNode> createDynamicsCompressor(); 130 PassRefPtr<DynamicsCompressorNode> createDynamicsCompressor();
132 PassRefPtr<AnalyserNode> createAnalyser(); 131 PassRefPtr<AnalyserNode> createAnalyser();
133 PassRefPtr<ScriptProcessorNode> createScriptProcessor(size_t bufferSize, Exc eptionState&); 132 PassRefPtr<ScriptProcessorNode> createScriptProcessor(size_t bufferSize, Exc eptionCode&);
134 PassRefPtr<ScriptProcessorNode> createScriptProcessor(size_t bufferSize, siz e_t numberOfInputChannels, ExceptionState&); 133 PassRefPtr<ScriptProcessorNode> createScriptProcessor(size_t bufferSize, siz e_t numberOfInputChannels, ExceptionCode&);
135 PassRefPtr<ScriptProcessorNode> createScriptProcessor(size_t bufferSize, siz e_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionState&); 134 PassRefPtr<ScriptProcessorNode> createScriptProcessor(size_t bufferSize, siz e_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionCode&);
136 PassRefPtr<ChannelSplitterNode> createChannelSplitter(ExceptionState&); 135 PassRefPtr<ChannelSplitterNode> createChannelSplitter(ExceptionCode&);
137 PassRefPtr<ChannelSplitterNode> createChannelSplitter(size_t numberOfOutputs , ExceptionState&); 136 PassRefPtr<ChannelSplitterNode> createChannelSplitter(size_t numberOfOutputs , ExceptionCode&);
138 PassRefPtr<ChannelMergerNode> createChannelMerger(ExceptionState&); 137 PassRefPtr<ChannelMergerNode> createChannelMerger(ExceptionCode&);
139 PassRefPtr<ChannelMergerNode> createChannelMerger(size_t numberOfInputs, Exc eptionState&); 138 PassRefPtr<ChannelMergerNode> createChannelMerger(size_t numberOfInputs, Exc eptionCode&);
140 PassRefPtr<OscillatorNode> createOscillator(); 139 PassRefPtr<OscillatorNode> createOscillator();
141 PassRefPtr<PeriodicWave> createPeriodicWave(Float32Array* real, Float32Array * imag, ExceptionState&); 140 PassRefPtr<PeriodicWave> createPeriodicWave(Float32Array* real, Float32Array * imag, ExceptionCode&);
142 141
143 // When a source node has no more processing to do (has finished playing), t hen it tells the context to dereference it. 142 // When a source node has no more processing to do (has finished playing), t hen it tells the context to dereference it.
144 void notifyNodeFinishedProcessing(AudioNode*); 143 void notifyNodeFinishedProcessing(AudioNode*);
145 144
146 // Called at the start of each render quantum. 145 // Called at the start of each render quantum.
147 void handlePreRenderTasks(); 146 void handlePreRenderTasks();
148 147
149 // Called at the end of each render quantum. 148 // Called at the end of each render quantum.
150 void handlePostRenderTasks(); 149 void handlePostRenderTasks();
151 150
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // It is somewhat arbitrary and could be increased if necessary. 345 // It is somewhat arbitrary and could be increased if necessary.
347 enum { MaxNumberOfChannels = 32 }; 346 enum { MaxNumberOfChannels = 32 };
348 347
349 // Number of AudioBufferSourceNodes that are active (playing). 348 // Number of AudioBufferSourceNodes that are active (playing).
350 int m_activeSourceCount; 349 int m_activeSourceCount;
351 }; 350 };
352 351
353 } // WebCore 352 } // WebCore
354 353
355 #endif // AudioContext_h 354 #endif // AudioContext_h
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioBuffer.cpp ('k') | Source/modules/webaudio/AudioContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698