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

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

Issue 2913303002: Avoid unsafe heap access from audio thread. (Closed)
Patch Set: improve method documentation Created 3 years, 6 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/BaseAudioContext.cpp ('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) 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 HandleStoppableSourceNodes(); 381 HandleStoppableSourceNodes();
382 382
383 return ShouldSuspend(); 383 return ShouldSuspend();
384 } 384 }
385 385
386 void OfflineAudioContext::HandlePostOfflineRenderTasks() { 386 void OfflineAudioContext::HandlePostOfflineRenderTasks() {
387 DCHECK(IsAudioThread()); 387 DCHECK(IsAudioThread());
388 388
389 // OfflineGraphAutoLocker here locks the audio graph for the same reason 389 // OfflineGraphAutoLocker here locks the audio graph for the same reason
390 // above in |handlePreOfflineRenderTasks|. 390 // above in |handlePreOfflineRenderTasks|.
391 bool did_remove = false;
392 { 391 {
393 OfflineGraphAutoLocker locker(this); 392 OfflineGraphAutoLocker locker(this);
394 393
395 GetDeferredTaskHandler().BreakConnections(); 394 GetDeferredTaskHandler().BreakConnections();
396 did_remove = ReleaseFinishedSourceNodes();
397 GetDeferredTaskHandler().HandleDeferredTasks(); 395 GetDeferredTaskHandler().HandleDeferredTasks();
398 GetDeferredTaskHandler().RequestToDeleteHandlersOnMainThread(); 396 GetDeferredTaskHandler().RequestToDeleteHandlersOnMainThread();
399 } 397 }
400
401 RemoveFinishedSourceNodes(did_remove);
402 } 398 }
403 399
404 OfflineAudioDestinationHandler& OfflineAudioContext::DestinationHandler() { 400 OfflineAudioDestinationHandler& OfflineAudioContext::DestinationHandler() {
405 return static_cast<OfflineAudioDestinationHandler&>( 401 return static_cast<OfflineAudioDestinationHandler&>(
406 destination()->GetAudioDestinationHandler()); 402 destination()->GetAudioDestinationHandler());
407 } 403 }
408 404
409 void OfflineAudioContext::ResolveSuspendOnMainThread(size_t frame) { 405 void OfflineAudioContext::ResolveSuspendOnMainThread(size_t frame) {
410 DCHECK(IsMainThread()); 406 DCHECK(IsMainThread());
411 407
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 449
454 // Note that the GraphLock is required before this check. Since this needs 450 // Note that the GraphLock is required before this check. Since this needs
455 // to run on the audio thread, OfflineGraphAutoLocker must be used. 451 // to run on the audio thread, OfflineGraphAutoLocker must be used.
456 if (scheduled_suspends_.Contains(CurrentSampleFrame())) 452 if (scheduled_suspends_.Contains(CurrentSampleFrame()))
457 return true; 453 return true;
458 454
459 return false; 455 return false;
460 } 456 }
461 457
462 } // namespace blink 458 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/BaseAudioContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698