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

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

Issue 2404743002: Web Audio: record autoplay status when an AudioContext is destroyed. (Closed)
Patch Set: move recording Created 4 years, 2 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) 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 * 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 finish(); 142 finish();
143 } 143 }
144 144
145 return; 145 return;
146 } 146 }
147 147
148 void AudioScheduledSourceHandler::start(double when, 148 void AudioScheduledSourceHandler::start(double when,
149 ExceptionState& exceptionState) { 149 ExceptionState& exceptionState) {
150 DCHECK(isMainThread()); 150 DCHECK(isMainThread());
151 151
152 // TODO(mlamouri): record when this is called with a user gesture and could 152 context()->maybeRecordStartAttempt();
153 // have started the AudioContext if following Safari iOS rules.
154 153
155 if (playbackState() != UNSCHEDULED_STATE) { 154 if (playbackState() != UNSCHEDULED_STATE) {
156 exceptionState.throwDOMException(InvalidStateError, 155 exceptionState.throwDOMException(InvalidStateError,
157 "cannot call start more than once."); 156 "cannot call start more than once.");
158 return; 157 return;
159 } 158 }
160 159
161 if (when < 0) { 160 if (when < 0) {
162 exceptionState.throwDOMException( 161 exceptionState.throwDOMException(
163 InvalidAccessError, 162 InvalidAccessError,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // playback state if the context is closed. 273 // playback state if the context is closed.
275 if (context()->isContextClosed()) 274 if (context()->isContextClosed())
276 return false; 275 return false;
277 276
278 // If a node is scheduled or playing, do not collect the node prematurely 277 // If a node is scheduled or playing, do not collect the node prematurely
279 // even its reference is out of scope. Then fire onended event if assigned. 278 // even its reference is out of scope. Then fire onended event if assigned.
280 return audioScheduledSourceHandler().isPlayingOrScheduled(); 279 return audioScheduledSourceHandler().isPlayingOrScheduled();
281 } 280 }
282 281
283 } // namespace blink 282 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698