Deduping conversions between ResourceRequestBody/WebHTTPBody/ExplodedHttpBody.
It turns out that https://crrev.com/1987053002 has still left some
remaining / unaddressed code deduplication opportunities - they are
taken care of by the current CL.
The CL replaces the following old fields of ExplodedHttpBody:
- std::vector<ExplodedHttpBodyElement> elements
- int64_t identifier
- bool is_null
with a single field:
- scoped_ptr<ResourceRequestBody> request_body
- the old is_null field is effectively replaced by scoped_ptr
- the old identifier is covered by ResourceRequestBody::identifier_
Note that ExplodedHttpBody still contains extra data on top of
ResourceRequestBody, like |bool contains_password| and
|base::NullableString16| http_content_type (and because of this the
whole ExplodedHttpBody struct cannot at this point be replaced with
ResourceRequestBody).
This CL deletes
void AppendHttpBodyElement(const ResourceRequestBodyElement&, WebHTTPBody)
function from //content/renderer/http_body_conversions.h and tweaks
callsites to instead use
scoped_refptr<ResourceRequestBody> GetRequestBodyForWebHTTPBody(
const blink::WebHTTPBody& httpBody)
which has been extracted from the already existing:
scoped_refptr<ResourceRequestBody> GetRequestBodyForWebURLRequest(
const blink::WebURLRequest& request)
(both in content/child/web_url_request_util.h).
This CL moves
void ConvertToHttpBodyElement(const WebHTTPBody::Element& input,
ResourceRequestBody::Element* output)
function from //content/renderer/http_body_conversions.h into
content/child/web_url_request_util.h and makes this function more generic
(i.e. covering the whole ResourceRequestBody rather than working with
individual elements):
blink::WebHTTPBody GetWebHTTPBodyForRequestBody
const scoped_refptr<ResourceRequestBody>& input);
BUG=582211
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation
Review-Url: https://codereview.chromium.org/2012913002
Cr-Commit-Position: refs/heads/master@{#396882}
12 files changed