Example #1
0
void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder& encoder, const ResourceResponse& resourceResponse)
{
#if PLATFORM(MAC)
    bool shouldSerializeWebCoreData = !resourceResponse.platformResponseIsUpToDate();
    encoder << shouldSerializeWebCoreData;
#else
    bool shouldSerializeWebCoreData = true;
#endif

    encodePlatformData(encoder, resourceResponse);

    if (shouldSerializeWebCoreData) {
        bool responseIsNull = resourceResponse.isNull();
        encoder << responseIsNull;
        if (responseIsNull)
            return;

        encoder << resourceResponse.url().string();
        encoder << static_cast<int32_t>(resourceResponse.httpStatusCode());
        encoder << resourceResponse.httpHeaderFields();

        encoder << resourceResponse.mimeType();
        encoder << resourceResponse.textEncodingName();
        encoder << static_cast<int64_t>(resourceResponse.expectedContentLength());
        encoder << resourceResponse.httpStatusText();
        encoder << resourceResponse.suggestedFilename();
    }
}
Example #2
0
void ArgumentCoder<ResourceError>::encode(ArgumentEncoder& encoder, const ResourceError& resourceError)
{
    if (kShouldSerializeWebCoreData) {
        bool errorIsNull = resourceError.isNull();
        encoder << errorIsNull;
        if (errorIsNull)
            return;

        encoder << resourceError.domain();
        encoder << resourceError.errorCode();
        encoder << resourceError.failingURL();
        encoder << resourceError.localizedDescription();
        encoder << resourceError.isCancellation();
        encoder << resourceError.isTimeout();
    }

    encodePlatformData(encoder, resourceError);
}
Example #3
0
void ArgumentCoder<ResourceRequest>::encode(ArgumentEncoder* encoder, const ResourceRequest& resourceRequest)
{
    if (kShouldSerializeWebCoreData) {
        encoder->encode(resourceRequest.url().string());
        encoder->encode(resourceRequest.httpMethod());

        const HTTPHeaderMap& headers = resourceRequest.httpHeaderFields();
        encoder->encode(headers);

        FormData* httpBody = resourceRequest.httpBody();
        encoder->encode(static_cast<bool>(httpBody));
        if (httpBody)
            encoder->encode(httpBody->flattenToString());

        encoder->encode(resourceRequest.firstPartyForCookies().string());
    }

    encodePlatformData(encoder, resourceRequest);
}
Example #4
0
void ArgumentCoder<ResourceRequest>::encode(ArgumentEncoder& encoder, const ResourceRequest& resourceRequest)
{
    if (kShouldSerializeWebCoreData) {
        encoder << resourceRequest.url().string();
        encoder << resourceRequest.httpMethod();
        encoder << resourceRequest.httpHeaderFields();

        // FIXME: Do not encode HTTP message body.
        // 1. It can be large and thus costly to send across.
        // 2. It is misleading to provide a body with some requests, while others use body streams, which cannot be serialized at all.
        FormData* httpBody = resourceRequest.httpBody();
        encoder << static_cast<bool>(httpBody);
        if (httpBody)
            encoder << httpBody->flattenToString();

        encoder << resourceRequest.firstPartyForCookies().string();
    }

    encodePlatformData(encoder, resourceRequest);
}
Example #5
0
void ArgumentCoder<ResourceResponse>::encode(ArgumentEncoder* encoder, const ResourceResponse& resourceResponse)
{
    if (kShouldSerializeWebCoreData) {
        bool responseIsNull = resourceResponse.isNull();
        encoder->encode(responseIsNull);
        if (responseIsNull)
            return;

        encoder->encode(resourceResponse.url().string());
        encoder->encode(static_cast<int32_t>(resourceResponse.httpStatusCode()));

        const HTTPHeaderMap& headers = resourceResponse.httpHeaderFields();
        encoder->encode(headers);

        encoder->encode(resourceResponse.mimeType());
        encoder->encode(resourceResponse.textEncodingName());
        encoder->encode(static_cast<int64_t>(resourceResponse.expectedContentLength()));
        encoder->encode(resourceResponse.httpStatusText());
        encoder->encode(resourceResponse.suggestedFilename());
    }

    encodePlatformData(encoder, resourceResponse);
}