bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder* decoder, ResourceResponse& resourceResponse) { if (kShouldSerializeWebCoreData) { bool responseIsNull; if (!decoder->decode(responseIsNull)) return false; if (responseIsNull) { resourceResponse = ResourceResponse(); return true; } ResourceResponse response; String url; if (!decoder->decode(url)) return false; response.setURL(KURL(KURL(), url)); int32_t httpStatusCode; if (!decoder->decode(httpStatusCode)) return false; response.setHTTPStatusCode(httpStatusCode); HTTPHeaderMap headers; if (!decoder->decode(headers)) return false; for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end(); it != end; ++it) response.setHTTPHeaderField(it->key, it->value); String mimeType; if (!decoder->decode(mimeType)) return false; response.setMimeType(mimeType); String textEncodingName; if (!decoder->decode(textEncodingName)) return false; response.setTextEncodingName(textEncodingName); int64_t contentLength; if (!decoder->decode(contentLength)) return false; response.setExpectedContentLength(contentLength); String httpStatusText; if (!decoder->decode(httpStatusText)) return false; response.setHTTPStatusText(httpStatusText); String suggestedFilename; if (!decoder->decode(suggestedFilename)) return false; response.setSuggestedFilename(suggestedFilename); resourceResponse = response; } return decodePlatformData(decoder, resourceResponse); }
bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder& decoder, ResourceRequest& resourceRequest) { if (kShouldSerializeWebCoreData) { ResourceRequest request; String url; if (!decoder.decode(url)) return false; request.setURL(URL(URL(), url)); String httpMethod; if (!decoder.decode(httpMethod)) return false; request.setHTTPMethod(httpMethod); HTTPHeaderMap headers; if (!decoder.decode(headers)) return false; request.addHTTPHeaderFields(headers); bool hasHTTPBody; if (!decoder.decode(hasHTTPBody)) return false; if (hasHTTPBody) { String httpBody; if (!decoder.decode(httpBody)) return false; request.setHTTPBody(FormData::create(httpBody.utf8())); } String firstPartyForCookies; if (!decoder.decode(firstPartyForCookies)) return false; request.setFirstPartyForCookies(URL(URL(), firstPartyForCookies)); resourceRequest = request; } #if ENABLE(CACHE_PARTITIONING) String cachePartition; if (!decoder.decode(cachePartition)) return false; resourceRequest.setCachePartition(cachePartition); #endif return decodePlatformData(decoder, resourceRequest); }
bool ArgumentCoder<ResourceError>::decode(ArgumentDecoder& decoder, ResourceError& resourceError) { if (kShouldSerializeWebCoreData) { bool errorIsNull; if (!decoder.decode(errorIsNull)) return false; if (errorIsNull) { resourceError = ResourceError(); return true; } String domain; if (!decoder.decode(domain)) return false; int errorCode; if (!decoder.decode(errorCode)) return false; String failingURL; if (!decoder.decode(failingURL)) return false; String localizedDescription; if (!decoder.decode(localizedDescription)) return false; bool isCancellation; if (!decoder.decode(isCancellation)) return false; bool isTimeout; if (!decoder.decode(isTimeout)) return false; resourceError = ResourceError(domain, errorCode, failingURL, localizedDescription); resourceError.setIsCancellation(isCancellation); resourceError.setIsTimeout(isTimeout); } return decodePlatformData(decoder, resourceError); }
bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder* decoder, ResourceRequest& resourceRequest) { if (kShouldSerializeWebCoreData) { ResourceRequest request; String url; if (!decoder->decode(url)) return false; request.setURL(KURL(KURL(), url)); String httpMethod; if (!decoder->decode(httpMethod)) return false; request.setHTTPMethod(httpMethod); HTTPHeaderMap headers; if (!decoder->decode(headers)) return false; request.addHTTPHeaderFields(headers); bool hasHTTPBody; if (!decoder->decode(hasHTTPBody)) return false; if (hasHTTPBody) { String httpBody; if (!decoder->decode(httpBody)) return false; request.setHTTPBody(FormData::create(httpBody.utf8())); } String firstPartyForCookies; if (!decoder->decode(firstPartyForCookies)) return false; request.setFirstPartyForCookies(KURL(KURL(), firstPartyForCookies)); resourceRequest = request; } return decodePlatformData(decoder, resourceRequest); }