feat: [net] add "priority" option to net.request (#47320)
document the default value of priority option Update the priority test to not use the httpbin.org as server Fixed the lint errors Fixed the build error Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Zeeker <13848632+zeeker999@users.noreply.github.com>
This commit is contained in:
parent
ec1704a1dd
commit
b328de39e5
5 changed files with 103 additions and 2 deletions
|
@ -644,6 +644,24 @@ gin::Handle<SimpleURLLoaderWrapper> SimpleURLLoaderWrapper::Create(
|
|||
break;
|
||||
}
|
||||
|
||||
if (std::string priority; opts.Get("priority", &priority)) {
|
||||
static constexpr auto Lookup =
|
||||
base::MakeFixedFlatMap<std::string_view, net::RequestPriority>({
|
||||
{"throttled", net::THROTTLED},
|
||||
{"idle", net::IDLE},
|
||||
{"lowest", net::LOWEST},
|
||||
{"low", net::LOW},
|
||||
{"medium", net::MEDIUM},
|
||||
{"highest", net::HIGHEST},
|
||||
});
|
||||
if (auto iter = Lookup.find(priority); iter != Lookup.end())
|
||||
request->priority = iter->second;
|
||||
}
|
||||
if (bool priorityIncremental = request->priority_incremental;
|
||||
opts.Get("priorityIncremental", &priorityIncremental)) {
|
||||
request->priority_incremental = priorityIncremental;
|
||||
}
|
||||
|
||||
const bool use_session_cookies =
|
||||
opts.ValueOrDefault("useSessionCookies", false);
|
||||
int options = network::mojom::kURLLoadOptionSniffMimeType;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue