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/AudioWorkletMessagingProxy.h

Issue 2793593002: AudioWorklet prototype
Patch Set: Merge changes, AudioParam bug fix Created 3 years, 5 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef AudioWorkletMessagingProxy_h 5 #ifndef AudioWorkletMessagingProxy_h
6 #define AudioWorkletMessagingProxy_h 6 #define AudioWorkletMessagingProxy_h
7 7
8 #include <memory> 8 #include <memory>
9 #include "core/workers/ThreadedWorkletMessagingProxy.h" 9 #include "core/CoreExport.h"
10 #include "core/loader/WorkletScriptLoader.h"
11 #include "core/workers/ThreadedMessagingProxyBase.h"
12 #include "core/workers/WorkletGlobalScopeProxy.h"
13 #include "core/workers/WorkletPendingTasks.h"
14 #include "platform/wtf/WeakPtr.h"
10 15
11 namespace blink { 16 namespace blink {
12 17
13 class ExecutionContext; 18 class AudioWorkletHandler;
14 class WorkerThread; 19 class AudioWorkletObjectProxy;
20 class ScriptSourceCode;
21 class WaitableEvent;
22 class WebThreadSupportingGC;
15 23
16 class AudioWorkletMessagingProxy final : public ThreadedWorkletMessagingProxy { 24 // NOTE: Currently this class is a duplication of ThreadedWorkletMessagingProxy,
25 // because it needs to have the ownership of the worker thread.
26 //
27 // When rebasing the code, make sure to copy the behavior of
28 // |ThreadedWorkletMessagingProxy| instead of inheriting from it. Think of this
29 // class is a composition of |ThreadedWorkletMessagingProxy| and
30 // |AudioWorkletMessagingProxy|. This is because we need a direct access of
31 // |worklet_object_proxy| from BaseAudioContext.
32
33 class CORE_EXPORT AudioWorkletMessagingProxy
34 : public ThreadedMessagingProxyBase,
35 public WorkletGlobalScopeProxy {
36 USING_GARBAGE_COLLECTED_MIXIN(AudioWorkletMessagingProxy);
37
17 public: 38 public:
18 AudioWorkletMessagingProxy(ExecutionContext*, WorkerClients*); 39 AudioWorkletMessagingProxy(ExecutionContext*, WorkerClients*);
19 40
41 // WorkletGlobalScopeProxy implementation.
42 void FetchAndInvokeScript(const KURL& module_url_record,
43 WebURLRequest::FetchCredentialsMode,
44 RefPtr<WebTaskRunner> outside_settings_task_runner,
45 WorkletPendingTasks*) final;
46 void WorkletObjectDestroyed() final;
47 void TerminateWorkletGlobalScope() final;
48
49 void Initialize();
50
51 DECLARE_VIRTUAL_TRACE();
52
53 // This blocks the main thread until the rendering thread completes the
54 // creation of AudioWorkletProcessor.
55 void CreateProcessorInstance(const String& name,
56 AudioWorkletHandler*,
57 WaitableEvent*);
58
59 // This returns the rendering thread so it can be passed to AudioDestination.
60 WebThreadSupportingGC* GetRenderingThread();
61
62 protected:
63 std::unique_ptr<WorkerThread> CreateWorkerThread(double origin_time) override;
64
65 AudioWorkletObjectProxy& WorkletObjectProxy() {
66 return *worklet_object_proxy_;
67 }
68
20 private: 69 private:
21 ~AudioWorkletMessagingProxy() override; 70 friend class AudioWorkletMessagingProxyForTest;
71 class LoaderClient;
22 72
23 std::unique_ptr<WorkerThread> CreateWorkerThread(double origin_time) override; 73 void NotifyLoadingFinished(WorkletScriptLoader*);
74 void EvaluateScript(const ScriptSourceCode&);
75
76 std::unique_ptr<AudioWorkletObjectProxy> worklet_object_proxy_;
77 HeapHashSet<Member<WorkletScriptLoader>> loaders_;
24 }; 78 };
25 79
26 } // namespace blink 80 } // namespace blink
27 81
28 #endif // AudioWorkletMessagingProxy_h 82 #endif // AudioWorkletMessagingProxy_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698