InProcessWorkerMessagingProxyForTest(ExecutionContext* executionContext, BlinkGC::ThreadHeapMode threadHeapMode) : InProcessWorkerMessagingProxy(executionContext, nullptr /* workerObject */, nullptr /* workerClients */) { workerObjectProxy().m_defaultIntervalInSec = kDefaultIntervalInSec; workerObjectProxy().m_nextIntervalInSec = kNextIntervalInSec; workerObjectProxy().m_maxIntervalInSec = kMaxIntervalInSec; m_mockWorkerLoaderProxyProvider = wrapUnique(new MockWorkerLoaderProxyProvider()); m_workerThread = wrapUnique( new DedicatedWorkerThreadForTest(m_mockWorkerLoaderProxyProvider.get(), workerObjectProxy(), threadHeapMode)); workerThreadCreated(); m_mockWorkerThreadLifecycleObserver = new MockWorkerThreadLifecycleObserver( m_workerThread->getWorkerThreadLifecycleContext()); EXPECT_CALL(*m_mockWorkerThreadLifecycleObserver, contextDestroyed()) .Times(1); }
void DedicatedWorkerGlobalScope::postMessage( ExecutionContext* context, PassRefPtr<SerializedScriptValue> message, const MessagePortArray& ports, ExceptionState& exceptionState) { // Disentangle the port in preparation for sending it to the remote context. std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(context, ports, exceptionState); if (exceptionState.hadException()) return; workerObjectProxy().postMessageToWorkerObject(std::move(message), std::move(channels)); }
PassRefPtr<WorkerThread> DedicatedWorkerMessagingProxy::createWorkerThread(double originTime) { return DedicatedWorkerThread::create(loaderProxy(), workerObjectProxy(), originTime); }
void WorkerMessagingProxy::postMessageToWorkerGlobalScope(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels) { if (m_askedToTerminate) return; OwnPtr<ExecutionContextTask> task = createCrossThreadTask(&processMessageOnWorkerGlobalScope, message, channels, AllowCrossThreadAccess(&workerObjectProxy())); if (m_workerThread) { ++m_unconfirmedMessageCount; m_workerThread->postTask(FROM_HERE, task.release()); } else { m_queuedEarlyTasks.append(task.release()); } }
std::unique_ptr<WorkerThread> CompositorWorkerMessagingProxy::createWorkerThread(double originTime) { return CompositorWorkerThread::create(loaderProxy(), workerObjectProxy(), originTime); }