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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/WaveShaperNode.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
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/WaveShaperNode.h ('k') | no next file » | 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) 2011, Google Inc. All rights reserved. 2 * Copyright (C) 2011, 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 21 matching lines...) Expand all
32 namespace blink { 32 namespace blink {
33 33
34 WaveShaperNode::WaveShaperNode(AbstractAudioContext& context) 34 WaveShaperNode::WaveShaperNode(AbstractAudioContext& context)
35 : AudioNode(context) 35 : AudioNode(context)
36 { 36 {
37 setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShap er, *this, context.sampleRate(), adoptPtr(new WaveShaperProcessor(context.sample Rate(), 1)))); 37 setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShap er, *this, context.sampleRate(), adoptPtr(new WaveShaperProcessor(context.sample Rate(), 1))));
38 38
39 handler().initialize(); 39 handler().initialize();
40 } 40 }
41 41
42 WaveShaperNode* WaveShaperNode::create(AbstractAudioContext& context, ExceptionS tate& exceptionState)
43 {
44 DCHECK(isMainThread());
45
46 if (context.isContextClosed()) {
47 context.throwExceptionForClosedState(exceptionState);
48 return nullptr;
49 }
50
51 return new WaveShaperNode(context);
52 }
53
42 WaveShaperProcessor* WaveShaperNode::getWaveShaperProcessor() const 54 WaveShaperProcessor* WaveShaperNode::getWaveShaperProcessor() const
43 { 55 {
44 return static_cast<WaveShaperProcessor*>(static_cast<AudioBasicProcessorHand ler&>(handler()).processor()); 56 return static_cast<WaveShaperProcessor*>(static_cast<AudioBasicProcessorHand ler&>(handler()).processor());
45 } 57 }
46 58
47 void WaveShaperNode::setCurve(DOMFloat32Array* curve, ExceptionState& exceptionS tate) 59 void WaveShaperNode::setCurve(DOMFloat32Array* curve, ExceptionState& exceptionS tate)
48 { 60 {
49 ASSERT(isMainThread()); 61 ASSERT(isMainThread());
50 62
51 if (curve && curve->length() < 2) { 63 if (curve && curve->length() < 2) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 case WaveShaperProcessor::OverSample4x: 108 case WaveShaperProcessor::OverSample4x:
97 return "4x"; 109 return "4x";
98 default: 110 default:
99 ASSERT_NOT_REACHED(); 111 ASSERT_NOT_REACHED();
100 return "none"; 112 return "none";
101 } 113 }
102 } 114 }
103 115
104 } // namespace blink 116 } // namespace blink
105 117
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/WaveShaperNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698