Chromium Code Reviews| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 public: | 78 public: |
| 79 // Create an AudioContext for rendering to the audio hardware. | 79 // Create an AudioContext for rendering to the audio hardware. |
| 80 static PassRefPtr<AudioContext> create(Document&, ExceptionState&); | 80 static PassRefPtr<AudioContext> create(Document&, ExceptionState&); |
| 81 | 81 |
| 82 // Deprecated: create an AudioContext for offline (non-realtime) rendering. | 82 // Deprecated: create an AudioContext for offline (non-realtime) rendering. |
| 83 static PassRefPtr<AudioContext> create(Document&, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState&); | 83 static PassRefPtr<AudioContext> create(Document&, unsigned numberOfChannels, size_t numberOfFrames, float sampleRate, ExceptionState&); |
| 84 | 84 |
| 85 virtual ~AudioContext(); | 85 virtual ~AudioContext(); |
| 86 | 86 |
| 87 bool isInitialized() const; | 87 bool isInitialized() const; |
| 88 // This is called on constructor of AudioNode when the first node of context is created except destination node. | |
|
Raymond Toy
2014/04/02 17:11:32
I think this comment is slightly wrong because the
KhNo
2014/04/03 13:21:02
Done.
| |
| 89 void lazyInitialize(); | |
| 88 | 90 |
| 89 bool isOfflineContext() { return m_isOfflineContext; } | 91 bool isOfflineContext() { return m_isOfflineContext; } |
| 90 | 92 |
| 91 // Document notification | 93 // Document notification |
| 92 virtual void stop() OVERRIDE FINAL; | 94 virtual void stop() OVERRIDE FINAL; |
| 93 virtual bool hasPendingActivity() const OVERRIDE; | 95 virtual bool hasPendingActivity() const OVERRIDE; |
| 94 | 96 |
| 95 AudioDestinationNode* destination() { return m_destinationNode.get(); } | 97 AudioDestinationNode* destination() { return m_destinationNode.get(); } |
| 96 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF rame(); } | 98 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF rame(); } |
| 97 double currentTime() const { return m_destinationNode->currentTime(); } | 99 double currentTime() const { return m_destinationNode->currentTime(); } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 | 240 |
| 239 protected: | 241 protected: |
| 240 explicit AudioContext(Document*); | 242 explicit AudioContext(Document*); |
| 241 AudioContext(Document*, unsigned numberOfChannels, size_t numberOfFrames, fl oat sampleRate); | 243 AudioContext(Document*, unsigned numberOfChannels, size_t numberOfFrames, fl oat sampleRate); |
| 242 | 244 |
| 243 static bool isSampleRateRangeGood(float sampleRate); | 245 static bool isSampleRateRangeGood(float sampleRate); |
| 244 | 246 |
| 245 private: | 247 private: |
| 246 void constructCommon(); | 248 void constructCommon(); |
| 247 | 249 |
| 248 void lazyInitialize(); | |
| 249 void uninitialize(); | 250 void uninitialize(); |
| 250 | 251 |
| 251 // ExecutionContext calls stop twice. | 252 // ExecutionContext calls stop twice. |
| 252 // We'd like to schedule only one stop action for them. | 253 // We'd like to schedule only one stop action for them. |
| 253 bool m_isStopScheduled; | 254 bool m_isStopScheduled; |
| 254 static void stopDispatch(void* userData); | 255 static void stopDispatch(void* userData); |
| 255 bool m_isCleared; | 256 bool m_isCleared; |
| 256 void clear(); | 257 void clear(); |
| 257 | 258 |
| 258 void scheduleNodeDeletion(); | 259 void scheduleNodeDeletion(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 // It is somewhat arbitrary and could be increased if necessary. | 328 // It is somewhat arbitrary and could be increased if necessary. |
| 328 enum { MaxNumberOfChannels = 32 }; | 329 enum { MaxNumberOfChannels = 32 }; |
| 329 | 330 |
| 330 // Number of AudioBufferSourceNodes that are active (playing). | 331 // Number of AudioBufferSourceNodes that are active (playing). |
| 331 int m_activeSourceCount; | 332 int m_activeSourceCount; |
| 332 }; | 333 }; |
| 333 | 334 |
| 334 } // WebCore | 335 } // WebCore |
| 335 | 336 |
| 336 #endif // AudioContext_h | 337 #endif // AudioContext_h |
| OLD | NEW |