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 30 matching lines...) Expand all Loading... | |
| 41 #include <stdio.h> | 41 #include <stdio.h> |
| 42 #endif | 42 #endif |
| 43 | 43 |
| 44 namespace WebCore { | 44 namespace WebCore { |
| 45 | 45 |
| 46 AudioNode::AudioNode(AudioContext* context, float sampleRate) | 46 AudioNode::AudioNode(AudioContext* context, float sampleRate) |
| 47 : m_isInitialized(false) | 47 : m_isInitialized(false) |
| 48 , m_nodeType(NodeTypeUnknown) | 48 , m_nodeType(NodeTypeUnknown) |
| 49 , m_context(context) | 49 , m_context(context) |
| 50 , m_sampleRate(sampleRate) | 50 , m_sampleRate(sampleRate) |
| 51 #if ENABLE(OILPAN) | |
| 52 , m_keepAlive(adoptPtr(new Persistent<AudioNode>(this))) | |
| 53 #endif | |
| 51 , m_lastProcessingTime(-1) | 54 , m_lastProcessingTime(-1) |
| 52 , m_lastNonSilentTime(-1) | 55 , m_lastNonSilentTime(-1) |
| 53 , m_normalRefCount(1) // start out with normal refCount == 1 (like WTF::RefC ounted class) | 56 , m_normalRefCount(1) // start out with normal refCount == 1 (like WTF::RefC ounted class) |
| 54 , m_connectionRefCount(0) | 57 , m_connectionRefCount(0) |
| 55 , m_isMarkedForDeletion(false) | 58 , m_isMarkedForDeletion(false) |
| 56 , m_isDisabled(false) | 59 , m_isDisabled(false) |
| 57 , m_channelCount(2) | 60 , m_channelCount(2) |
| 58 , m_channelCountMode(Max) | 61 , m_channelCountMode(Max) |
| 59 , m_channelInterpretation(AudioBus::Speakers) | 62 , m_channelInterpretation(AudioBus::Speakers) |
| 60 { | 63 { |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 if (nodeType() != NodeTypeConvolver && nodeType() != NodeTypeDelay) { | 469 if (nodeType() != NodeTypeConvolver && nodeType() != NodeTypeDelay) { |
| 467 m_isDisabled = true; | 470 m_isDisabled = true; |
| 468 for (unsigned i = 0; i < m_outputs.size(); ++i) | 471 for (unsigned i = 0; i < m_outputs.size(); ++i) |
| 469 output(i)->disable(); | 472 output(i)->disable(); |
| 470 } | 473 } |
| 471 } | 474 } |
| 472 } | 475 } |
| 473 | 476 |
| 474 void AudioNode::ref(RefType refType) | 477 void AudioNode::ref(RefType refType) |
| 475 { | 478 { |
| 479 #if ENABLE(OILPAN) | |
| 480 ASSERT(m_keepAlive); | |
| 481 #endif | |
| 476 switch (refType) { | 482 switch (refType) { |
| 477 case RefTypeNormal: | 483 case RefTypeNormal: |
| 478 atomicIncrement(&m_normalRefCount); | 484 atomicIncrement(&m_normalRefCount); |
| 479 break; | 485 break; |
| 480 case RefTypeConnection: | 486 case RefTypeConnection: |
| 481 atomicIncrement(&m_connectionRefCount); | 487 atomicIncrement(&m_connectionRefCount); |
| 482 break; | 488 break; |
| 483 default: | 489 default: |
| 484 ASSERT_NOT_REACHED(); | 490 ASSERT_NOT_REACHED(); |
| 485 } | 491 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 fprintf(stderr, "===========================\n"); | 586 fprintf(stderr, "===========================\n"); |
| 581 | 587 |
| 582 for (unsigned i = 0; i < NodeTypeEnd; ++i) | 588 for (unsigned i = 0; i < NodeTypeEnd; ++i) |
| 583 fprintf(stderr, "%d: %d\n", i, s_nodeCount[i]); | 589 fprintf(stderr, "%d: %d\n", i, s_nodeCount[i]); |
| 584 | 590 |
| 585 fprintf(stderr, "===========================\n\n\n"); | 591 fprintf(stderr, "===========================\n\n\n"); |
| 586 } | 592 } |
| 587 | 593 |
| 588 #endif // DEBUG_AUDIONODE_REFERENCES | 594 #endif // DEBUG_AUDIONODE_REFERENCES |
| 589 | 595 |
| 596 void AudioNode::trace(Visitor* visitor) | |
| 597 { | |
| 598 visitor->trace(m_context); | |
| 599 } | |
| 600 | |
| 601 #if ENABLE(OILPAN) | |
| 602 void AudioNode::clearKeepAlive() | |
| 603 { | |
| 604 // It is safe to drop the self-persistent when the ref count | |
| 605 // of a ScriptProcessorNode reaches zero. At that point, the | |
|
Mads Ager (chromium)
2014/04/24 09:05:37
ScriptProcessorNode -> AudioNode (and one occurren
keishi
2014/05/06 20:00:03
Done.
| |
| 606 // ScriptProcessor node is removed from the AudioContext and | |
| 607 // it cannot be reattached. Therefore, the reference count | |
| 608 // will not go above zero again. | |
| 609 ASSERT(m_keepAlive); | |
| 610 m_keepAlive = nullptr; | |
| 611 } | |
| 612 #endif | |
| 613 | |
| 590 } // namespace WebCore | 614 } // namespace WebCore |
| 591 | 615 |
| 592 #endif // ENABLE(WEB_AUDIO) | 616 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |