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, ...@@ -54,8 +54,8 @@ bool ContainsHeader(const base::flat_map<std::string, std::string>& headers,
return headers.cend() != return headers.cend() !=
std::find_if(headers.cbegin(), headers.cend(), std::find_if(headers.cbegin(), headers.cend(),
[target](const auto& pair) -> bool { [target](const auto& pair) -> bool {
return base::CompareCaseInsensitiveASCII(pair.first, return base::EqualsCaseInsensitiveASCII(pair.first,
target) == 0; target);
}); });
} }
......
...@@ -83,8 +83,7 @@ struct CONTENT_EXPORT ...@@ -83,8 +83,7 @@ struct CONTENT_EXPORT
} }
static blink::mojom::FetchAPIResponsePtr response( static blink::mojom::FetchAPIResponsePtr response(
const content::BackgroundFetchSettledFetch& fetch) { const content::BackgroundFetchSettledFetch& fetch) {
return content::BackgroundFetchSettledFetch::MakeCloneResponse( return content::BackgroundFetchSettledFetch::CloneResponse(fetch.response);
fetch.response);
} }
static bool Read(blink::mojom::BackgroundFetchSettledFetchDataView data, static bool Read(blink::mojom::BackgroundFetchSettledFetchDataView data,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
namespace { namespace {
blink::mojom::SerializedBlobPtr MakeCloneSerializedBlob( blink::mojom::SerializedBlobPtr CloneSerializedBlob(
const blink::mojom::SerializedBlobPtr& blob) { const blink::mojom::SerializedBlobPtr& blob) {
if (!blob) if (!blob)
return nullptr; return nullptr;
...@@ -53,18 +53,19 @@ BackgroundFetchRegistration::BackgroundFetchRegistration( ...@@ -53,18 +53,19 @@ BackgroundFetchRegistration::BackgroundFetchRegistration(
BackgroundFetchRegistration::~BackgroundFetchRegistration() = default; BackgroundFetchRegistration::~BackgroundFetchRegistration() = default;
// static // static
blink::mojom::FetchAPIResponsePtr blink::mojom::FetchAPIResponsePtr BackgroundFetchSettledFetch::CloneResponse(
BackgroundFetchSettledFetch::MakeCloneResponse(
const blink::mojom::FetchAPIResponsePtr& response) { const blink::mojom::FetchAPIResponsePtr& response) {
// TODO(https://crbug.com/876546): Replace this method with response.Clone()
// if the associated bug is fixed.
if (!response) if (!response)
return nullptr; return nullptr;
return blink::mojom::FetchAPIResponse::New( return blink::mojom::FetchAPIResponse::New(
response->url_list, response->status_code, response->status_text, response->url_list, response->status_code, response->status_text,
response->response_type, response->headers, response->response_type, response->headers,
MakeCloneSerializedBlob(response->blob), response->error, CloneSerializedBlob(response->blob), response->error,
response->response_time, response->cache_storage_cache_name, response->response_time, response->cache_storage_cache_name,
response->cors_exposed_header_names, response->is_in_cache_storage, response->cors_exposed_header_names, response->is_in_cache_storage,
MakeCloneSerializedBlob(response->side_data_blob)); CloneSerializedBlob(response->side_data_blob));
} }
BackgroundFetchSettledFetch::BackgroundFetchSettledFetch() = default; BackgroundFetchSettledFetch::BackgroundFetchSettledFetch() = default;
...@@ -76,7 +77,7 @@ BackgroundFetchSettledFetch::BackgroundFetchSettledFetch( ...@@ -76,7 +77,7 @@ BackgroundFetchSettledFetch::BackgroundFetchSettledFetch(
BackgroundFetchSettledFetch& BackgroundFetchSettledFetch::operator=( BackgroundFetchSettledFetch& BackgroundFetchSettledFetch::operator=(
const BackgroundFetchSettledFetch& other) { const BackgroundFetchSettledFetch& other) {
request = other.request; request = other.request;
response = MakeCloneResponse(other.response); response = CloneResponse(other.response);
return *this; return *this;
} }
......
...@@ -69,7 +69,7 @@ struct CONTENT_EXPORT BackgroundFetchRegistration { ...@@ -69,7 +69,7 @@ struct CONTENT_EXPORT BackgroundFetchRegistration {
// Analogous to the following structure in the spec: // Analogous to the following structure in the spec:
// http://wicg.github.io/background-fetch/#backgroundfetchsettledfetch // http://wicg.github.io/background-fetch/#backgroundfetchsettledfetch
struct CONTENT_EXPORT BackgroundFetchSettledFetch { struct CONTENT_EXPORT BackgroundFetchSettledFetch {
static blink::mojom::FetchAPIResponsePtr MakeCloneResponse( static blink::mojom::FetchAPIResponsePtr CloneResponse(
const blink::mojom::FetchAPIResponsePtr& response); const blink::mojom::FetchAPIResponsePtr& response);
BackgroundFetchSettledFetch(); BackgroundFetchSettledFetch();
BackgroundFetchSettledFetch(const BackgroundFetchSettledFetch& other); BackgroundFetchSettledFetch(const BackgroundFetchSettledFetch& other);
......
...@@ -304,7 +304,8 @@ void ToWebServiceWorkerRequest(const ServiceWorkerFetchRequest& request, ...@@ -304,7 +304,8 @@ void ToWebServiceWorkerRequest(const ServiceWorkerFetchRequest& request,
web_request->SetIsHistoryNavigation(request.is_history_navigation); 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 // TODO(leonhsl): Remove this when we propagate
// blink::mojom::FetchAPIResponsePtr into Blink instead of // blink::mojom::FetchAPIResponsePtr into Blink instead of
// WebServiceWorkerResponse. // 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