void BlobResourceHandle::failed(int errorCode) { ASSERT(m_async); // Notify the client. notifyFail(errorCode); // Close the file if needed. if (m_fileOpened) { m_fileOpened = false; m_asyncStream->close(); } }
void BlobResourceHandle::doStart() { ASSERT(isMainThread()); // Do not continue if the request is aborted or an error occurs. if (m_aborted || m_errorCode) return; if (!equalLettersIgnoringASCIICase(firstRequest().httpMethod(), "get")) { notifyFail(methodNotAllowed); return; } // If the blob data is not found, fail now. if (!m_blobData) { m_errorCode = notFoundError; notifyResponse(); return; } // Parse the "Range" header we care about. String range = firstRequest().httpHeaderField(HTTPHeaderName::Range); if (!range.isEmpty() && !parseRange(range, m_rangeOffset, m_rangeEnd, m_rangeSuffixLength)) { m_errorCode = rangeError; notifyResponse(); return; } if (m_async) getSizeForNext(); else { Ref<BlobResourceHandle> protectedThis(*this); // getSizeForNext calls the client for (size_t i = 0; i < m_blobData->items().size() && !m_aborted && !m_errorCode; ++i) getSizeForNext(); notifyResponse(); } }