OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef AudioWorkletObjectProxy_h |
| 6 #define AudioWorkletObjectProxy_h |
| 7 |
| 8 #include "bindings/core/v8/SourceLocation.h" |
| 9 #include "core/CoreExport.h" |
| 10 #include "core/dom/MessagePort.h" |
| 11 #include "core/workers/ThreadedObjectProxyBase.h" |
| 12 #include "core/workers/WorkerReportingProxy.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 class AudioWorkletHandler; |
| 17 class AudioWorkletMessagingProxy; |
| 18 class WaitableEvent; |
| 19 class WorkerThread; |
| 20 |
| 21 // This class is a duplication of ThreadedWorkletObjectProxy, in order to match |
| 22 // the implementation of AudioWorkletMessagingProxy. |
| 23 class CORE_EXPORT AudioWorkletObjectProxy : public ThreadedObjectProxyBase { |
| 24 USING_FAST_MALLOC(AudioWorkletObjectProxy); |
| 25 WTF_MAKE_NONCOPYABLE(AudioWorkletObjectProxy); |
| 26 |
| 27 public: |
| 28 static std::unique_ptr<AudioWorkletObjectProxy> Create( |
| 29 AudioWorkletMessagingProxy*, |
| 30 ParentFrameTaskRunners*); |
| 31 ~AudioWorkletObjectProxy() override; |
| 32 |
| 33 void EvaluateScript(const String& source, |
| 34 const KURL& script_url, |
| 35 WorkerThread*); |
| 36 |
| 37 void CreateProcessorInstance(const String& name, |
| 38 AudioWorkletHandler*, |
| 39 WaitableEvent*, |
| 40 WorkerThread*); |
| 41 |
| 42 // ThreadedObjectProxyBase overrides. |
| 43 void ReportException(const String& error_message, |
| 44 std::unique_ptr<SourceLocation>, |
| 45 int exception_id) final {} |
| 46 void DidEvaluateWorkerScript(bool success) final {} |
| 47 void WillDestroyWorkerGlobalScope() final {} |
| 48 |
| 49 protected: |
| 50 AudioWorkletObjectProxy(AudioWorkletMessagingProxy*, |
| 51 ParentFrameTaskRunners*); |
| 52 |
| 53 CrossThreadWeakPersistent<ThreadedMessagingProxyBase> MessagingProxyWeakPtr() |
| 54 final; |
| 55 |
| 56 private: |
| 57 // No guarantees about the lifetimes of tasks posted by this proxy wrt the |
| 58 // AudioWorkletMessagingProxy so a weak pointer must be used when posting |
| 59 // the tasks. |
| 60 CrossThreadWeakPersistent<AudioWorkletMessagingProxy> |
| 61 messaging_proxy_weak_ptr_; |
| 62 }; |
| 63 |
| 64 } // namespace blink |
| 65 |
| 66 #endif // AudioWorkletObjectProxy_h |
OLD | NEW |