Requesting Guidance on Using absl::StatusOr in Chromium

2,528 views
Skip to first unread message

Tsuyoshi Horo

unread,
Jan 30, 2024, 10:48:40 AMJan 30
to c...@chromium.org, dani...@chromium.org, jbr...@chromium.org, Daniel Cheng, Patrick Meenan
Dear cxx@ folks,

I'm working on some integration work of the third-party library "liburlpattern" into Chromium. The library's liburlpattern::Parse() method requires a function returning an absl::StatusOr type. To facilitate this, I've added a specific_include_rules entry to the components/url_pattern/DEPS file to include the necessary Abseil header ("third_party/abseil-cpp/absl/status/statusor.h") in this CL.

However, an OWNER of third_party/abseil-cpp/OWNERS has requested me to seek approval from the cxx group before proceeding. Could you please advise on the following:
 - Is using absl::StatusOr for this integration an acceptable practice within Chromium?
 - If so, are there any specific guidelines or recommendations I should be aware of?

Thanks.

Peter Kasting

unread,
Jan 30, 2024, 11:00:15 AMJan 30
to Tsuyoshi Horo, cxx, Danil Chapovalov, Jeremy Roman, Daniel Cheng, Patrick Meenan
In general, you can use disallowed types like this at the boundaries of third party code where necessary to integrate. You should use the disallowed type minimally (within reason), translating to an equivalent allowed type for any nontrivial chrome-side use. In this case, that would probably be base::expected<>.

PK

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CADk0S-Wwcbi18LM%2BsvsEDeAnq1ExqDGHQerVZeeAfWka9Kr4vA%40mail.gmail.com.

Jeremy Roman

unread,
Jan 30, 2024, 11:02:12 AMJan 30
to Peter Kasting, Tsuyoshi Horo, cxx, Danil Chapovalov, Daniel Cheng, Patrick Meenan
+1. In addition, I think we discussed the particular case of liburlpattern (though if it was on this list, I can't immediately find it). This code is kinda weird in that it's pseudo-third-party, but we made a decision at the time to treat it like third-party code in this respect and not allow a dependency on base/ if we could help it.

I believe the relevant CL does translate immediately, as does the existing calling code.

Alex Cooper

unread,
Jan 30, 2024, 12:10:53 PMJan 30
to Peter Kasting, Tsuyoshi Horo, cxx, Danil Chapovalov, Jeremy Roman, Daniel Cheng, Patrick Meenan
> In general, you can use disallowed types like this at the boundaries of third party code where necessary to integrate. You should use the disallowed type minimally (within reason), translating to an equivalent allowed type for any nontrivial chrome-side use. 

I thought there was an explicit line in the chromium style guide or one of the adjacent docs that stated this, but I cannot find it now.

Tsuyoshi Horo

unread,
Jan 30, 2024, 12:51:16 PMJan 30
to Alex Cooper, Peter Kasting, cxx, Danil Chapovalov, Jeremy Roman, Daniel Cheng, Patrick Meenan
Thank you very much for answering my questions.

Joe Mason

unread,
Jan 30, 2024, 3:13:14 PMJan 30
to Alex Cooper, Peter Kasting, Tsuyoshi Horo, cxx, Danil Chapovalov, Jeremy Roman, Daniel Cheng, Patrick Meenan
I just put up a styleguide CL with this advice at https://crrev.com/c/5251128

On Tue, Jan 30, 2024 at 12:10 PM Alex Cooper <alco...@chromium.org> wrote:
> In general, you can use disallowed types like this at the boundaries of third party code where necessary to integrate. You should use the disallowed type minimally (within reason), translating to an equivalent allowed type for any nontrivial chrome-side use. 

I thought there was an explicit line in the chromium style guide or one of the adjacent docs that stated this, but I cannot find it now.

On Tue, Jan 30, 2024 at 8:00 AM 'Peter Kasting' via cxx <c...@chromium.org> wrote:
In general, you can use disallowed types like this at the boundaries of third party code where necessary to integrate. You should use the disallowed type minimally (within reason), translating to an equivalent allowed type for any nontrivial chrome-side use. In this case, that would probably be base::expected<>.

PK

On Tue, Jan 30, 2024, 7:48 AM Tsuyoshi Horo <ho...@chromium.org> wrote:
Dear cxx@ folks,

I'm working on some integration work of the third-party library "liburlpattern" into Chromium. The library's liburlpattern::Parse() method requires a function returning an absl::StatusOr type. To facilitate this, I've added a specific_include_rules entry to the components/url_pattern/DEPS file to include the necessary Abseil header ("third_party/abseil-cpp/absl/status/statusor.h") in this CL.

However, an OWNER of third_party/abseil-cpp/OWNERS has requested me to seek approval from the cxx group before proceeding. Could you please advise on the following:
 - Is using absl::StatusOr for this integration an acceptable practice within Chromium?
 - If so, are there any specific guidelines or recommendations I should be aware of?

Thanks.

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CADk0S-Wwcbi18LM%2BsvsEDeAnq1ExqDGHQerVZeeAfWka9Kr4vA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAAHOzFByFaE1dSVzz886CuTcVsXS0LHMxOAq%2BS%3DkYjMiUx87EA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
Reply all
Reply to author
Forward
0 new messages