Introduce CSVPassword::TryParse()
CSVPassword already has the method Parse(PasswordForm*), which parses the associated CSV row. It returns the success/failure of the parsing and stores the corresponding PasswordForm into the location passed as the only argument. If the argument is null, Parse() only checks that the CSV row is a correct serialization of a credential and then does not create the PasswordForm. This is often used in the code. This CL introduces the TryParse() method, which is equivalent to calling (the old) Parse(nullptr). Its purpose is to improve readability of the code: with Parse(nullptr) the reader might wonder what the type and meaning of the "nullptr" is, whereas with TryParse() it is clear that this is some kind of check that parsing works. Parse() now DCHECKS that the passed PasswordForm* is not null. Bug: 934326 Change-Id: I92578ac1f87798535a7e8ba11bd7b464dd724629 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1932776 Commit-Queue: Vaclav Brozek <vabr@chromium.org> Reviewed-by:Jan Wilken Dörrie <jdoerrie@chromium.org> Cr-Commit-Position: refs/heads/master@{#719222}
Showing
Please register or sign in to comment