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

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

Issue 2698153003: Reduce createSameThreadTask usage in modules/ (Closed)
Patch Set: Move a static callback to an anonymous namespace 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) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, 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 15 matching lines...) Expand all
26 #include "modules/webaudio/BaseAudioContext.h" 26 #include "modules/webaudio/BaseAudioContext.h"
27 27
28 #include "bindings/core/v8/Dictionary.h" 28 #include "bindings/core/v8/Dictionary.h"
29 #include "bindings/core/v8/ExceptionMessages.h" 29 #include "bindings/core/v8/ExceptionMessages.h"
30 #include "bindings/core/v8/ExceptionState.h" 30 #include "bindings/core/v8/ExceptionState.h"
31 #include "bindings/core/v8/ScriptPromiseResolver.h" 31 #include "bindings/core/v8/ScriptPromiseResolver.h"
32 #include "bindings/core/v8/ScriptState.h" 32 #include "bindings/core/v8/ScriptState.h"
33 #include "core/dom/DOMException.h" 33 #include "core/dom/DOMException.h"
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/dom/ExceptionCode.h" 35 #include "core/dom/ExceptionCode.h"
36 #include "core/dom/ExecutionContextTask.h"
37 #include "core/dom/TaskRunnerHelper.h" 36 #include "core/dom/TaskRunnerHelper.h"
38 #include "core/frame/Settings.h" 37 #include "core/frame/Settings.h"
39 #include "core/html/HTMLMediaElement.h" 38 #include "core/html/HTMLMediaElement.h"
40 #include "core/inspector/ConsoleMessage.h" 39 #include "core/inspector/ConsoleMessage.h"
41 #include "core/inspector/ConsoleTypes.h" 40 #include "core/inspector/ConsoleTypes.h"
42 #include "modules/mediastream/MediaStream.h" 41 #include "modules/mediastream/MediaStream.h"
43 #include "modules/webaudio/AnalyserNode.h" 42 #include "modules/webaudio/AnalyserNode.h"
44 #include "modules/webaudio/AudioBuffer.h" 43 #include "modules/webaudio/AudioBuffer.h"
45 #include "modules/webaudio/AudioBufferCallback.h" 44 #include "modules/webaudio/AudioBufferCallback.h"
46 #include "modules/webaudio/AudioBufferSourceNode.h" 45 #include "modules/webaudio/AudioBufferSourceNode.h"
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 606
608 if (newState == m_contextState) { 607 if (newState == m_contextState) {
609 // DCHECKs above failed; just return. 608 // DCHECKs above failed; just return.
610 return; 609 return;
611 } 610 }
612 611
613 m_contextState = newState; 612 m_contextState = newState;
614 613
615 // Notify context that state changed 614 // Notify context that state changed
616 if (getExecutionContext()) 615 if (getExecutionContext())
617 getExecutionContext()->postTask( 616 TaskRunnerHelper::get(TaskType::MediaElementEvent, getExecutionContext())
618 TaskType::MediaElementEvent, BLINK_FROM_HERE, 617 ->postTask(BLINK_FROM_HERE,
619 createSameThreadTask(&BaseAudioContext::notifyStateChange, 618 WTF::bind(&BaseAudioContext::notifyStateChange,
620 wrapPersistent(this))); 619 wrapPersistent(this)));
621 } 620 }
622 621
623 void BaseAudioContext::notifyStateChange() { 622 void BaseAudioContext::notifyStateChange() {
624 dispatchEvent(Event::create(EventTypeNames::statechange)); 623 dispatchEvent(Event::create(EventTypeNames::statechange));
625 } 624 }
626 625
627 void BaseAudioContext::notifySourceNodeFinishedProcessing( 626 void BaseAudioContext::notifySourceNodeFinishedProcessing(
628 AudioHandler* handler) { 627 AudioHandler* handler) {
629 DCHECK(isAudioThread()); 628 DCHECK(isAudioThread());
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 } 898 }
900 899
901 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const { 900 SecurityOrigin* BaseAudioContext::getSecurityOrigin() const {
902 if (getExecutionContext()) 901 if (getExecutionContext())
903 return getExecutionContext()->getSecurityOrigin(); 902 return getExecutionContext()->getSecurityOrigin();
904 903
905 return nullptr; 904 return nullptr;
906 } 905 }
907 906
908 } // namespace blink 907 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/Sensor.cpp ('k') | third_party/WebKit/Source/modules/webdatabase/Database.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698