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" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 void TearDown() override { AudioWorkletThread::clearSharedBackingThread(); } | 72 void TearDown() override { AudioWorkletThread::clearSharedBackingThread(); } |
73 | 73 |
74 std::unique_ptr<AudioWorkletThread> createAudioWorkletThread() { | 74 std::unique_ptr<AudioWorkletThread> createAudioWorkletThread() { |
75 std::unique_ptr<AudioWorkletThread> thread = AudioWorkletThread::create( | 75 std::unique_ptr<AudioWorkletThread> thread = AudioWorkletThread::create( |
76 nullptr, *m_reportingProxy, m_parentFrameTaskRunners.get()); | 76 nullptr, *m_reportingProxy, m_parentFrameTaskRunners.get()); |
77 thread->start(WorkerThreadStartupData::create( | 77 thread->start(WorkerThreadStartupData::create( |
78 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", "", | 78 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", "", |
79 nullptr, DontPauseWorkerGlobalScopeOnStart, nullptr, "", | 79 nullptr, DontPauseWorkerGlobalScopeOnStart, nullptr, "", |
80 m_securityOrigin.get(), nullptr, WebAddressSpaceLocal, nullptr, nullptr, | 80 m_securityOrigin.get(), nullptr, WebAddressSpaceLocal, nullptr, nullptr, |
81 WorkerV8Settings::Default())); | 81 WorkerV8Settings::Default(), false /* inspectorNetworkCapability */)); |
82 return thread; | 82 return thread; |
83 } | 83 } |
84 | 84 |
85 // Attempts to run some simple script for |thread|. | 85 // Attempts to run some simple script for |thread|. |
86 void checkWorkletCanExecuteScript(WorkerThread* thread) { | 86 void checkWorkletCanExecuteScript(WorkerThread* thread) { |
87 WaitableEvent waitEvent; | 87 WaitableEvent waitEvent; |
88 thread->workerBackingThread().backingThread().postTask( | 88 thread->workerBackingThread().backingThread().postTask( |
89 BLINK_FROM_HERE, | 89 BLINK_FROM_HERE, |
90 crossThreadBind(&AudioWorkletThreadTest::executeScriptInWorklet, | 90 crossThreadBind(&AudioWorkletThreadTest::executeScriptInWorklet, |
91 crossThreadUnretained(this), | 91 crossThreadUnretained(this), |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 ASSERT_TRUE(secondIsolate); | 190 ASSERT_TRUE(secondIsolate); |
191 EXPECT_EQ(firstIsolate, secondIsolate); | 191 EXPECT_EQ(firstIsolate, secondIsolate); |
192 | 192 |
193 // Verify that the isolate can run some scripts correctly in the second | 193 // Verify that the isolate can run some scripts correctly in the second |
194 // worklet. | 194 // worklet. |
195 checkWorkletCanExecuteScript(secondWorklet.get()); | 195 checkWorkletCanExecuteScript(secondWorklet.get()); |
196 secondWorklet->terminateAndWait(); | 196 secondWorklet->terminateAndWait(); |
197 } | 197 } |
198 | 198 |
199 } // namespace blink | 199 } // namespace blink |
OLD | NEW |