| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 88 |
| 89 bool isOfflineContext() { return m_isOfflineContext; } | 89 bool isOfflineContext() { return m_isOfflineContext; } |
| 90 | 90 |
| 91 // Document notification | 91 // Document notification |
| 92 virtual void stop() OVERRIDE FINAL; | 92 virtual void stop() OVERRIDE FINAL; |
| 93 virtual bool hasPendingActivity() const OVERRIDE; |
| 93 | 94 |
| 94 AudioDestinationNode* destination() { return m_destinationNode.get(); } | 95 AudioDestinationNode* destination() { return m_destinationNode.get(); } |
| 95 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF
rame(); } | 96 size_t currentSampleFrame() const { return m_destinationNode->currentSampleF
rame(); } |
| 96 double currentTime() const { return m_destinationNode->currentTime(); } | 97 double currentTime() const { return m_destinationNode->currentTime(); } |
| 97 float sampleRate() const { return m_destinationNode->sampleRate(); } | 98 float sampleRate() const { return m_destinationNode->sampleRate(); } |
| 98 unsigned long activeSourceCount() const { return static_cast<unsigned long>(
m_activeSourceCount); } | 99 unsigned long activeSourceCount() const { return static_cast<unsigned long>(
m_activeSourceCount); } |
| 99 | 100 |
| 100 void incrementActiveSourceCount(); | 101 void incrementActiveSourceCount(); |
| 101 void decrementActiveSourceCount(); | 102 void decrementActiveSourceCount(); |
| 102 | 103 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 private: | 245 private: |
| 245 void constructCommon(); | 246 void constructCommon(); |
| 246 | 247 |
| 247 void lazyInitialize(); | 248 void lazyInitialize(); |
| 248 void uninitialize(); | 249 void uninitialize(); |
| 249 | 250 |
| 250 // ExecutionContext calls stop twice. | 251 // ExecutionContext calls stop twice. |
| 251 // We'd like to schedule only one stop action for them. | 252 // We'd like to schedule only one stop action for them. |
| 252 bool m_isStopScheduled; | 253 bool m_isStopScheduled; |
| 253 static void stopDispatch(void* userData); | 254 static void stopDispatch(void* userData); |
| 255 bool m_isCleared; |
| 254 void clear(); | 256 void clear(); |
| 255 | 257 |
| 256 void scheduleNodeDeletion(); | 258 void scheduleNodeDeletion(); |
| 257 static void deleteMarkedNodesDispatch(void* userData); | 259 static void deleteMarkedNodesDispatch(void* userData); |
| 258 | 260 |
| 259 bool m_isInitialized; | 261 bool m_isInitialized; |
| 260 bool m_isAudioThreadFinished; | 262 bool m_isAudioThreadFinished; |
| 261 | 263 |
| 262 // The context itself keeps a reference to all source nodes. The source nod
es, then reference all nodes they're connected to. | 264 // The context itself keeps a reference to all source nodes. The source nod
es, then reference all nodes they're connected to. |
| 263 // In turn, these nodes reference all nodes they're connected to. All nodes
are ultimately connected to the AudioDestinationNode. | 265 // In turn, these nodes reference all nodes they're connected to. All nodes
are ultimately connected to the AudioDestinationNode. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 // It is somewhat arbitrary and could be increased if necessary. | 327 // It is somewhat arbitrary and could be increased if necessary. |
| 326 enum { MaxNumberOfChannels = 32 }; | 328 enum { MaxNumberOfChannels = 32 }; |
| 327 | 329 |
| 328 // Number of AudioBufferSourceNodes that are active (playing). | 330 // Number of AudioBufferSourceNodes that are active (playing). |
| 329 int m_activeSourceCount; | 331 int m_activeSourceCount; |
| 330 }; | 332 }; |
| 331 | 333 |
| 332 } // WebCore | 334 } // WebCore |
| 333 | 335 |
| 334 #endif // AudioContext_h | 336 #endif // AudioContext_h |
| OLD | NEW |