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

Unified Diff: Source/modules/webaudio/AudioScheduledSourceNode.h

Issue 1256053006: Protect AudioScheduledSoureNode::m_startTime and m_endTime. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/webaudio/AudioScheduledSourceNode.h
diff --git a/Source/modules/webaudio/AudioScheduledSourceNode.h b/Source/modules/webaudio/AudioScheduledSourceNode.h
index 11c3e5196ff65c116e8ad6e1ebc1b4e48cf37065..752cf51e5c60596c875bd7b05d4f807f12e11e72 100644
--- a/Source/modules/webaudio/AudioScheduledSourceNode.h
+++ b/Source/modules/webaudio/AudioScheduledSourceNode.h
@@ -103,6 +103,33 @@ protected:
void notifyEnded();
+ // Both |m_startTime| and |m_endTime| are accessed from both the main thread and the audio
+ // thread. Use the setters and getters to protect the access to these!
+
+ double startTime() const
+ {
+ return acquireLoad(&m_startTime);
tkent 2015/08/07 01:10:03 I'm not sure acquireLoad and releaseStore are enou
Raymond Toy 2015/08/07 15:45:00 Hmm. I perhaps erroneously assumed floating-point
tkent 2015/08/11 00:45:19 Alternative would be a normal mutex, or a spin loc
+ }
+
+ void setStartTime(double newStartTime)
+ {
+ releaseStore(&m_startTime, newStartTime);
+ }
+
+ double endTime() const
+ {
+ return acquireLoad(&m_endTime);
+ }
+
+ void setEndTime(double newEndTime)
+ {
+ releaseStore(&m_endTime, newEndTime);
+ }
+
+ bool m_hasEndedListener;
+
+ static const double UnknownTime;
+private:
// 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").
double m_startTime; // in seconds
@@ -111,10 +138,6 @@ protected:
// has been reached.
double m_endTime; // in seconds
- bool m_hasEndedListener;
-
- static const double UnknownTime;
-private:
// This is accessed by both the main thread and audio thread. Use the setter and getter to
// protect the access to this!
int m_playbackState;

Powered by Google App Engine
This is Rietveld 408576698