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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/PannerNode.cpp

Issue 1952793002: Move the exception logic to the AudioNode creator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 7 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
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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 614
615 if (hasMoved) { 615 if (hasMoved) {
616 m_lastPosition = currentPosition; 616 m_lastPosition = currentPosition;
617 m_lastOrientation = currentOrientation; 617 m_lastOrientation = currentOrientation;
618 618
619 markPannerAsDirty(PannerHandler::AzimuthElevationDirty | PannerHandler:: DistanceConeGainDirty); 619 markPannerAsDirty(PannerHandler::AzimuthElevationDirty | PannerHandler:: DistanceConeGainDirty);
620 } 620 }
621 } 621 }
622 // ---------------------------------------------------------------- 622 // ----------------------------------------------------------------
623 623
624 PannerNode::PannerNode(AbstractAudioContext& context, float sampleRate) 624 PannerNode::PannerNode(AbstractAudioContext& context)
625 : AudioNode(context) 625 : AudioNode(context)
626 , m_positionX(AudioParam::create(context, ParamTypePannerPositionX, 0.0)) 626 , m_positionX(AudioParam::create(context, ParamTypePannerPositionX, 0.0))
627 , m_positionY(AudioParam::create(context, ParamTypePannerPositionY, 0.0)) 627 , m_positionY(AudioParam::create(context, ParamTypePannerPositionY, 0.0))
628 , m_positionZ(AudioParam::create(context, ParamTypePannerPositionZ, 0.0)) 628 , m_positionZ(AudioParam::create(context, ParamTypePannerPositionZ, 0.0))
629 , m_orientationX(AudioParam::create(context, ParamTypePannerOrientationX, 1. 0)) 629 , m_orientationX(AudioParam::create(context, ParamTypePannerOrientationX, 1. 0))
630 , m_orientationY(AudioParam::create(context, ParamTypePannerOrientationY, 0. 0)) 630 , m_orientationY(AudioParam::create(context, ParamTypePannerOrientationY, 0. 0))
631 , m_orientationZ(AudioParam::create(context, ParamTypePannerOrientationZ, 0. 0)) 631 , m_orientationZ(AudioParam::create(context, ParamTypePannerOrientationZ, 0. 0))
632 { 632 {
633 setHandler(PannerHandler::create( 633 setHandler(PannerHandler::create(
634 *this, 634 *this,
635 sampleRate, 635 context.sampleRate(),
636 m_positionX->handler(), 636 m_positionX->handler(),
637 m_positionY->handler(), 637 m_positionY->handler(),
638 m_positionZ->handler(), 638 m_positionZ->handler(),
639 m_orientationX->handler(), 639 m_orientationX->handler(),
640 m_orientationY->handler(), 640 m_orientationY->handler(),
641 m_orientationZ->handler())); 641 m_orientationZ->handler()));
642 } 642 }
643 643
644 PannerNode* PannerNode::create(AbstractAudioContext& context, float sampleRate) 644 PannerNode* PannerNode::create(AbstractAudioContext& context, ExceptionState& ex ceptionState)
645 { 645 {
646 return new PannerNode(context, sampleRate); 646 DCHECK(isMainThread());
647
648 if (context.isContextClosed()) {
649 context.throwExceptionForClosedState(exceptionState);
650 return nullptr;
651 }
652
653 return new PannerNode(context);
647 } 654 }
648 655
649 PannerHandler& PannerNode::pannerHandler() const 656 PannerHandler& PannerNode::pannerHandler() const
650 { 657 {
651 return static_cast<PannerHandler&>(handler()); 658 return static_cast<PannerHandler&>(handler());
652 } 659 }
653 660
654 String PannerNode::panningModel() const 661 String PannerNode::panningModel() const
655 { 662 {
656 return pannerHandler().panningModel(); 663 return pannerHandler().panningModel();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 visitor->trace(m_positionZ); 761 visitor->trace(m_positionZ);
755 762
756 visitor->trace(m_orientationX); 763 visitor->trace(m_orientationX);
757 visitor->trace(m_orientationY); 764 visitor->trace(m_orientationY);
758 visitor->trace(m_orientationZ); 765 visitor->trace(m_orientationZ);
759 766
760 AudioNode::trace(visitor); 767 AudioNode::trace(visitor);
761 } 768 }
762 769
763 } // namespace blink 770 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/PannerNode.h ('k') | third_party/WebKit/Source/modules/webaudio/PeriodicWave.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698