void WorkerThreadableLoader::MainThreadBridge::cancel() { m_loaderProxy.postTaskToLoader(createCallbackTask(&MainThreadBridge::mainThreadCancel, this)); ThreadableLoaderClientWrapper* clientWrapper = m_workerClientWrapper.get(); if (!clientWrapper->done()) { // If the client hasn't reached a termination state, then transition it by sending a cancellation error. // Note: no more client callbacks will be done after this method -- the clearClientWrapper() call ensures that. ResourceError error(String(), 0, String(), String()); error.setIsCancellation(true); clientWrapper->didFail(error); } clearClientWrapper(); }
void WorkerThreadableLoader::MainThreadBridge::cancel() { m_loaderProxy.postTaskToLoader([this] (ScriptExecutionContext& context) { ASSERT(isMainThread()); ASSERT_UNUSED(context, context.isDocument()); if (!m_mainThreadLoader) return; m_mainThreadLoader->cancel(); m_mainThreadLoader = nullptr; }); ThreadableLoaderClientWrapper* clientWrapper = m_workerClientWrapper.get(); if (!clientWrapper->done()) { // If the client hasn't reached a termination state, then transition it by sending a cancellation error. // Note: no more client callbacks will be done after this method -- the clearClientWrapper() call ensures that. ResourceError error(String(), 0, URL(), String()); error.setIsCancellation(true); clientWrapper->didFail(error); } clearClientWrapper(); }