Commit e60ff259 authored by Richard Li's avatar Richard Li Committed by Commit Bot

[OnionSoup] Address the comments in CL:1164848

The comments link is:
https://chromium-review.googlesource.com/c/chromium/src/+/1164848#message
-a1a1783bcd50bae7f7ba603c9a24c070d62327f1

Change-Id: I6fa64d07308c40b98bcc7c620ea21c714ef85704
Bug: 789854
Reviewed-on: https://chromium-review.googlesource.com/1182960Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Commit-Queue: Han Leon <leon.han@intel.com>
Cr-Commit-Position: refs/heads/master@{#585763}
parent ccab4bc3
......@@ -54,8 +54,8 @@ bool ContainsHeader(const base::flat_map<std::string, std::string>& headers,
return headers.cend() !=
std::find_if(headers.cbegin(), headers.cend(),
[target](const auto& pair) -> bool {
return base::CompareCaseInsensitiveASCII(pair.first,
target) == 0;
return base::EqualsCaseInsensitiveASCII(pair.first,
target);
});
}
......
......@@ -83,8 +83,7 @@ struct CONTENT_EXPORT
}
static blink::mojom::FetchAPIResponsePtr response(
const content::BackgroundFetchSettledFetch& fetch) {
return content::BackgroundFetchSettledFetch::MakeCloneResponse(
fetch.response);
return content::BackgroundFetchSettledFetch::CloneResponse(fetch.response);
}
static bool Read(blink::mojom::BackgroundFetchSettledFetchDataView data,
......
......@@ -7,7 +7,7 @@
namespace {
blink::mojom::SerializedBlobPtr MakeCloneSerializedBlob(
blink::mojom::SerializedBlobPtr CloneSerializedBlob(
const blink::mojom::SerializedBlobPtr& blob) {
if (!blob)
return nullptr;
......@@ -53,18 +53,19 @@ BackgroundFetchRegistration::BackgroundFetchRegistration(
BackgroundFetchRegistration::~BackgroundFetchRegistration() = default;
// static
blink::mojom::FetchAPIResponsePtr
BackgroundFetchSettledFetch::MakeCloneResponse(
blink::mojom::FetchAPIResponsePtr BackgroundFetchSettledFetch::CloneResponse(
const blink::mojom::FetchAPIResponsePtr& response) {
// TODO(https://crbug.com/876546): Replace this method with response.Clone()
// if the associated bug is fixed.
if (!response)
return nullptr;
return blink::mojom::FetchAPIResponse::New(
response->url_list, response->status_code, response->status_text,
response->response_type, response->headers,
MakeCloneSerializedBlob(response->blob), response->error,
CloneSerializedBlob(response->blob), response->error,
response->response_time, response->cache_storage_cache_name,
response->cors_exposed_header_names, response->is_in_cache_storage,
MakeCloneSerializedBlob(response->side_data_blob));
CloneSerializedBlob(response->side_data_blob));
}
BackgroundFetchSettledFetch::BackgroundFetchSettledFetch() = default;
......@@ -76,7 +77,7 @@ BackgroundFetchSettledFetch::BackgroundFetchSettledFetch(
BackgroundFetchSettledFetch& BackgroundFetchSettledFetch::operator=(
const BackgroundFetchSettledFetch& other) {
request = other.request;
response = MakeCloneResponse(other.response);
response = CloneResponse(other.response);
return *this;
}
......
......@@ -69,7 +69,7 @@ struct CONTENT_EXPORT BackgroundFetchRegistration {
// Analogous to the following structure in the spec:
// http://wicg.github.io/background-fetch/#backgroundfetchsettledfetch
struct CONTENT_EXPORT BackgroundFetchSettledFetch {
static blink::mojom::FetchAPIResponsePtr MakeCloneResponse(
static blink::mojom::FetchAPIResponsePtr CloneResponse(
const blink::mojom::FetchAPIResponsePtr& response);
BackgroundFetchSettledFetch();
BackgroundFetchSettledFetch(const BackgroundFetchSettledFetch& other);
......
......@@ -304,7 +304,8 @@ void ToWebServiceWorkerRequest(const ServiceWorkerFetchRequest& request,
web_request->SetIsHistoryNavigation(request.is_history_navigation);
}
// Converts |response| to its equivalent type in the Blink API.
// Converts |response| to its equivalent type in the Blink API. This conversion
// is destructive.
// TODO(leonhsl): Remove this when we propagate
// blink::mojom::FetchAPIResponsePtr into Blink instead of
// WebServiceWorkerResponse.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment