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

Side by Side Diff: Source/modules/webaudio/AudioScheduledSourceNode.h

Issue 54173005: Signal exceptions if start/stop is called out-of-order or too many times. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 NotifyEndedTask(PassRefPtr<AudioScheduledSourceNode> scheduledNode); 61 NotifyEndedTask(PassRefPtr<AudioScheduledSourceNode> scheduledNode);
62 void notifyEnded(); 62 void notifyEnded();
63 63
64 private: 64 private:
65 RefPtr<AudioScheduledSourceNode> m_scheduledNode; 65 RefPtr<AudioScheduledSourceNode> m_scheduledNode;
66 }; 66 };
67 67
68 AudioScheduledSourceNode(AudioContext*, float sampleRate); 68 AudioScheduledSourceNode(AudioContext*, float sampleRate);
69 69
70 // Scheduling. 70 // Scheduling.
71 void start(double when = 0); 71 void start(ExceptionState& es) { start(0.0, es); }
72 void stop(double when = 0); 72 void start(double when, ExceptionState&);
73 73 void stop(ExceptionState& es) { stop(0.0, es); }
74 void noteOn(double when); 74 void stop(double when, ExceptionState&);
75 void noteOff(double when);
76 75
77 unsigned short playbackState() const { return static_cast<unsigned short>(m_ playbackState); } 76 unsigned short playbackState() const { return static_cast<unsigned short>(m_ playbackState); }
78 bool isPlayingOrScheduled() const { return m_playbackState == PLAYING_STATE || m_playbackState == SCHEDULED_STATE; } 77 bool isPlayingOrScheduled() const { return m_playbackState == PLAYING_STATE || m_playbackState == SCHEDULED_STATE; }
79 bool hasFinished() const { return m_playbackState == FINISHED_STATE; } 78 bool hasFinished() const { return m_playbackState == FINISHED_STATE; }
80 79
81 EventListener* onended(DOMWrapperWorld* isolatedWorld) { return getAttribute EventListener(EventTypeNames::ended, isolatedWorld); } 80 EventListener* onended(DOMWrapperWorld* isolatedWorld) { return getAttribute EventListener(EventTypeNames::ended, isolatedWorld); }
82 void setOnended(PassRefPtr<EventListener>, DOMWrapperWorld* isolatedWorld = 0); 81 void setOnended(PassRefPtr<EventListener>, DOMWrapperWorld* isolatedWorld = 0);
83 82
84 protected: 83 protected:
85 // Get frame information for the current time quantum. 84 // Get frame information for the current time quantum.
(...skipping 17 matching lines...) Expand all
103 102
104 // m_startTime is the time to start playing based on the context's timeline (0 or a time less than the context's current time means "now"). 103 // m_startTime is the time to start playing based on the context's timeline (0 or a time less than the context's current time means "now").
105 double m_startTime; // in seconds 104 double m_startTime; // in seconds
106 105
107 // m_endTime is the time to stop playing based on the context's timeline (0 or a time less than the context's current time means "now"). 106 // m_endTime is the time to stop playing based on the context's timeline (0 or a time less than the context's current time means "now").
108 // If it hasn't been set explicitly, then the sound will not stop playing (i f looping) or will stop when the end of the AudioBuffer 107 // If it hasn't been set explicitly, then the sound will not stop playing (i f looping) or will stop when the end of the AudioBuffer
109 // has been reached. 108 // has been reached.
110 double m_endTime; // in seconds 109 double m_endTime; // in seconds
111 110
112 bool m_hasEndedListener; 111 bool m_hasEndedListener;
112 bool m_stopCalled;
113 113
114 static const double UnknownTime; 114 static const double UnknownTime;
115 }; 115 };
116 116
117 } // namespace WebCore 117 } // namespace WebCore
118 118
119 #endif // AudioScheduledSourceNode_h 119 #endif // AudioScheduledSourceNode_h
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioNode.cpp ('k') | Source/modules/webaudio/AudioScheduledSourceNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698