| OLD | NEW |
| 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 #include "modules/webaudio/AudioWorkletThread.h" | 5 #include "modules/webaudio/AudioWorkletThread.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptSourceCode.h" | 7 #include "bindings/core/v8/ScriptSourceCode.h" |
| 8 #include "bindings/core/v8/SourceLocation.h" | 8 #include "bindings/core/v8/SourceLocation.h" |
| 9 #include "bindings/core/v8/V8GCController.h" | 9 #include "bindings/core/v8/V8GCController.h" |
| 10 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 10 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| 11 #include "core/inspector/ConsoleMessage.h" | 11 #include "core/inspector/ConsoleMessage.h" |
| 12 #include "core/workers/ParentFrameTaskRunners.h" | |
| 13 #include "core/workers/WorkerBackingThread.h" | 12 #include "core/workers/WorkerBackingThread.h" |
| 14 #include "core/workers/WorkerLoaderProxy.h" | 13 #include "core/workers/WorkerLoaderProxy.h" |
| 15 #include "core/workers/WorkerOrWorkletGlobalScope.h" | 14 #include "core/workers/WorkerOrWorkletGlobalScope.h" |
| 16 #include "core/workers/WorkerReportingProxy.h" | 15 #include "core/workers/WorkerReportingProxy.h" |
| 17 #include "core/workers/WorkerThreadStartupData.h" | 16 #include "core/workers/WorkerThreadStartupData.h" |
| 18 #include "platform/CrossThreadFunctional.h" | 17 #include "platform/CrossThreadFunctional.h" |
| 19 #include "platform/WaitableEvent.h" | 18 #include "platform/WaitableEvent.h" |
| 20 #include "platform/WebThreadSupportingGC.h" | 19 #include "platform/WebThreadSupportingGC.h" |
| 21 #include "platform/heap/Handle.h" | 20 #include "platform/heap/Handle.h" |
| 22 #include "platform/testing/TestingPlatformSupport.h" | 21 #include "platform/testing/TestingPlatformSupport.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 40 | 39 |
| 41 // (Empty) WorkerReportingProxy implementation: | 40 // (Empty) WorkerReportingProxy implementation: |
| 42 void reportException(const String& errorMessage, | 41 void reportException(const String& errorMessage, |
| 43 std::unique_ptr<SourceLocation>, | 42 std::unique_ptr<SourceLocation>, |
| 44 int exceptionId) override {} | 43 int exceptionId) override {} |
| 45 void reportConsoleMessage(MessageSource, | 44 void reportConsoleMessage(MessageSource, |
| 46 MessageLevel, | 45 MessageLevel, |
| 47 const String& message, | 46 const String& message, |
| 48 SourceLocation*) override {} | 47 SourceLocation*) override {} |
| 49 void postMessageToPageInspector(const String&) override {} | 48 void postMessageToPageInspector(const String&) override {} |
| 50 ParentFrameTaskRunners* getParentFrameTaskRunners() override { | |
| 51 return m_parentFrameTaskRunners.get(); | |
| 52 } | |
| 53 | |
| 54 void didEvaluateWorkerScript(bool success) override {} | 49 void didEvaluateWorkerScript(bool success) override {} |
| 55 void didCloseWorkerGlobalScope() override {} | 50 void didCloseWorkerGlobalScope() override {} |
| 56 void willDestroyWorkerGlobalScope() override {} | 51 void willDestroyWorkerGlobalScope() override {} |
| 57 void didTerminateWorkerThread() override {} | 52 void didTerminateWorkerThread() override {} |
| 58 | 53 |
| 59 private: | 54 private: |
| 60 TestAudioWorkletReportingProxy() | 55 TestAudioWorkletReportingProxy() {} |
| 61 : m_parentFrameTaskRunners(ParentFrameTaskRunners::create(nullptr)) {} | |
| 62 | |
| 63 Persistent<ParentFrameTaskRunners> m_parentFrameTaskRunners; | |
| 64 }; | 56 }; |
| 65 | 57 |
| 66 } // namespace | 58 } // namespace |
| 67 | 59 |
| 68 class AudioWorkletThreadTest : public ::testing::Test { | 60 class AudioWorkletThreadTest : public ::testing::Test { |
| 69 public: | 61 public: |
| 70 void SetUp() override { | 62 void SetUp() override { |
| 71 AudioWorkletThread::createSharedBackingThreadForTest(); | 63 AudioWorkletThread::createSharedBackingThreadForTest(); |
| 72 m_reportingProxy = TestAudioWorkletReportingProxy::create(); | 64 m_reportingProxy = TestAudioWorkletReportingProxy::create(); |
| 73 m_securityOrigin = | 65 m_securityOrigin = |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 ASSERT_TRUE(secondIsolate); | 186 ASSERT_TRUE(secondIsolate); |
| 195 EXPECT_EQ(firstIsolate, secondIsolate); | 187 EXPECT_EQ(firstIsolate, secondIsolate); |
| 196 | 188 |
| 197 // Verify that the isolate can run some scripts correctly in the second | 189 // Verify that the isolate can run some scripts correctly in the second |
| 198 // worklet. | 190 // worklet. |
| 199 checkWorkletCanExecuteScript(secondWorklet.get()); | 191 checkWorkletCanExecuteScript(secondWorklet.get()); |
| 200 secondWorklet->terminateAndWait(); | 192 secondWorklet->terminateAndWait(); |
| 201 } | 193 } |
| 202 | 194 |
| 203 } // namespace blink | 195 } // namespace blink |
| OLD | NEW |