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

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

Issue 2666703002: Correct confusing error message from OfflineAudioContext.suspend() (Closed)
Patch Set: Refined error message Created 3 years, 10 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 "cannot schedule a suspend at frame " + String::number(frame) + " (" + 250 "cannot schedule a suspend at frame " + String::number(frame) + " (" +
251 String::number(when) + " seconds) " + "because it is greater than " 251 String::number(when) + " seconds) " + "because it is greater than "
252 "or equal to the total " 252 "or equal to the total "
253 "render duration of " + 253 "render duration of " +
254 String::number(m_totalRenderFrames) + " frames")); 254 String::number(m_totalRenderFrames) + " frames"));
255 return promise; 255 return promise;
256 } 256 }
257 257
258 // The specified suspend time is in the past; reject the promise. 258 // The specified suspend time is in the past; reject the promise.
259 if (frame < currentSampleFrame()) { 259 if (frame < currentSampleFrame()) {
260 size_t currentFrameClamped = std::min(currentSampleFrame(), length());
261 double currentTimeClamped =
262 std::min(currentTime(), length() / static_cast<double>(sampleRate()));
260 resolver->reject(DOMException::create( 263 resolver->reject(DOMException::create(
261 InvalidStateError, 264 InvalidStateError,
262 "cannot schedule a suspend at frame " + String::number(frame) + " (" + 265 "suspend(" + String::number(when) + ") failed to suspend at frame " +
263 String::number(when) + 266 String::number(frame) + " because it is earlier than the current " +
264 " seconds) because it is earlier than the current frame of " + 267 "frame of " + String::number(currentFrameClamped) + " (" +
265 String::number(currentSampleFrame()) + " (" + 268 String::number(currentTimeClamped) + " seconds)"));
266 String::number(currentTime()) + " seconds)"));
267 return promise; 269 return promise;
268 } 270 }
269 271
270 // Wait until the suspend map is available for the insertion. Here we should 272 // Wait until the suspend map is available for the insertion. Here we should
271 // use AutoLocker because it locks the graph from the main thread. 273 // use AutoLocker because it locks the graph from the main thread.
272 AutoLocker locker(this); 274 AutoLocker locker(this);
273 275
274 // If there is a duplicate suspension at the same quantized frame, 276 // If there is a duplicate suspension at the same quantized frame,
275 // reject the promise. 277 // reject the promise.
276 if (m_scheduledSuspends.contains(frame)) { 278 if (m_scheduledSuspends.contains(frame)) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 443
442 // Note that the GraphLock is required before this check. Since this needs 444 // Note that the GraphLock is required before this check. Since this needs
443 // to run on the audio thread, OfflineGraphAutoLocker must be used. 445 // to run on the audio thread, OfflineGraphAutoLocker must be used.
444 if (m_scheduledSuspends.contains(currentSampleFrame())) 446 if (m_scheduledSuspends.contains(currentSampleFrame()))
445 return true; 447 return true;
446 448
447 return false; 449 return false;
448 } 450 }
449 451
450 } // namespace blink 452 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698