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