Skip to content

Commit 2dc8a95

Browse files
[cr139] Fix access to CreateCookieOptions
There is an override, namely, `URLRequestHttpJob::CreateCookieOptions`, which is used to capture all calls to `CreateCookieOptions` declared in the TUs annonymous namespace, and adding extra operations to it. This override has recently broken as the annonymous namespace was moved into the `net` namespace. This change creates a trampoline function to allow the override we have in `URLRequestHttpJob`, which has the same name, to call `CreateCookieOptions` through this middle function with a differing name. Chromium changes: https://chromium.googlesource.com/chromium/src/+/4395b43126e0dccea609c06e4294bea030c4d726 commit 4395b43126e0dccea609c06e4294bea030c4d726 Author: Adam Rice <ricea@chromium.org> Date: Fri Jun 13 01:21:39 2025 -0700 net: Avoid unnecessary string construction Fix a few places in //net where std::strings were constructed unnecessarily. Also inline the string constants in //net/http/http_auth_scheme.h so the compiler can optimize them more easily. Also wrap all of url_request_http_job.cc in namespace net and remove unnecessary namespace qualifiers from that file. Also use base::flat_set instead of std::set for sets that are always small. Change-Id: Id2ffa42ac058c9bcd1f11ddc662034b0caacf254 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6622734 Auto-Submit: Adam Rice <ricea@chromium.org> Reviewed-by: Kenichi Ishibashi <bashi@chromium.org> Reviewed-by: Peter Beverloo <peter@chromium.org> Reviewed-by: Sylvain Defresne <sdefresne@chromium.org> Commit-Queue: Adam Rice <ricea@chromium.org> Cr-Commit-Position: refs/heads/main@{#1473415}
1 parent 34539e3 commit 2dc8a95

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

chromium_src/net/url_request/url_request_http_job.cc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,24 @@
2424

2525
namespace net {
2626

27+
namespace {
28+
29+
// This function acts as a trampoline between
30+
// `URLRequestHttpJob::CreateCookieOptions` and the `CreateCookieOptions`
31+
// declared in the annonymous namespace inside `net::`. This is necessary
32+
// because otherwise there's no way for `URLRequestHttpJob::CreateCookieOptions`
33+
// to capture calls to `CreateCookieOptions` and at the same time be able to
34+
// call it in the annonymous namespace.
35+
CookieOptions CreateCookieOptionsCaller(
36+
CookieOptions::SameSiteCookieContext same_site_context) {
37+
return CreateCookieOptions(same_site_context);
38+
}
39+
40+
} // namespace
41+
2742
CookieOptions URLRequestHttpJob::CreateCookieOptions(
2843
CookieOptions::SameSiteCookieContext same_site_context) const {
29-
CookieOptions cookie_options = ::CreateCookieOptions(same_site_context);
44+
CookieOptions cookie_options = CreateCookieOptionsCaller(same_site_context);
3045
FillEphemeralStorageParams(
3146
request_->url(), request_->site_for_cookies(),
3247
request_->isolation_info().top_frame_origin(),

0 commit comments

Comments
 (0)