0
Commit Graph

16 Commits

Author SHA1 Message Date
Peter Kasting
3f01b691ee [cleanup] Replace base::ranges with std::ranges: sql/
Done entirely with `git grep` and `sed` + `git cl format`, no
hand-editing.

Bug: 386918226
Change-Id: Ic4bae3c955936455ce0112a7e5d4efe806f5b9b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6196286
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Etienne Bergeron <etienneb@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1411795}
2025-01-27 11:50:47 -08:00
Peter Boström
db6998d611 Revert "Reimplement "Push non-official CHECK_op failures into lambda""
This reverts commit 7ad9365ab4.

Reason for revert: Breakage in https://ci.chromium.org/ui/p/chromium/bisection/test-analysis/b/5295039715475456

Original change's description:
> Reimplement "Push non-official CHECK_op failures into lambda"
>
> This new implementation seems simpler and doesn't tickle the same msan
> bugs that the original changelist got reverted for. In this solution
> ::Check##name##Impl returns two strings on failure (likely inlined
> anyways) instead of a single pointer and the caller can construct the
> check-failure object.
>
> Original change's description:
> > Revert "Push non-official CHECK_op failures into lambda"
> >
> > This reverts commit a5911aa482.
> >
> > Reason for revert: This breaks some tests on Linux MSAN. Please see crbug.com/384553537 for more details.
> >
> > Original change's description:
> > > Push non-official CHECK_op failures into lambda
> > >
> > > This seems to generate significantly better code in the hot spot of a
> > > fuzzer (~800 ms instead of ~1200 ms). If we're lucky it also translates
> > > some to real-world performance of developer and official-DCHECK builds.
> > > This is believed to be because most of the code for the failure path
> > > can get out-of-lined by the compiler now.
> > >
> > > This also intends to out-of-line the "foo < bar" string from in the hot
> > > spot of a CHECK_op macro which hopefully means less parameter passing.
> > >
> > > Bug: 40241607, 382071730
> > > Change-Id: I9a4bbef3e3a77280056e158fb215647656a8c00f
> > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6095761
> > > Reviewed-by: Peter Kasting <pkasting@chromium.org>
> > > Commit-Queue: Peter Boström <pbos@chromium.org>
> > > Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
> > > Cr-Commit-Position: refs/heads/main@{#1396998}
> >
> > Bug: 384553537, 40241607, 382071730
> > Change-Id: Ibd85c1dbea710fc7585d08ac86fcf9ad7af1ba47
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6097359
> > Owners-Override: Taiyo Mizuhashi <taiyo@chromium.org>
> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > Reviewed-by: thefrog <thefrog@chromium.org>
> > Commit-Queue: thefrog <thefrog@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1398076}
>
> Bug: 384553537, 40241607, 382071730
> Change-Id: Ie5663afbabda3eccbd01656617bd889169e8cd8b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6124647
> Reviewed-by: Peter Kasting <pkasting@chromium.org>
> Commit-Queue: Peter Boström <pbos@chromium.org>
> Owners-Override: Peter Boström <pbos@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1401663}

Bug: 384553537, 40241607, 382071730
Change-Id: Ic79f8dca5e80f155de2f886709de0d3cade2d54e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6124761
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Peter Boström <pbos@chromium.org>
Owners-Override: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1401700}
2025-01-02 22:22:39 -08:00
Peter Boström
7ad9365ab4 Reimplement "Push non-official CHECK_op failures into lambda"
This new implementation seems simpler and doesn't tickle the same msan
bugs that the original changelist got reverted for. In this solution
::Check##name##Impl returns two strings on failure (likely inlined
anyways) instead of a single pointer and the caller can construct the
check-failure object.

Original change's description:
> Revert "Push non-official CHECK_op failures into lambda"
>
> This reverts commit a5911aa482.
>
> Reason for revert: This breaks some tests on Linux MSAN. Please see crbug.com/384553537 for more details.
>
> Original change's description:
> > Push non-official CHECK_op failures into lambda
> >
> > This seems to generate significantly better code in the hot spot of a
> > fuzzer (~800 ms instead of ~1200 ms). If we're lucky it also translates
> > some to real-world performance of developer and official-DCHECK builds.
> > This is believed to be because most of the code for the failure path
> > can get out-of-lined by the compiler now.
> >
> > This also intends to out-of-line the "foo < bar" string from in the hot
> > spot of a CHECK_op macro which hopefully means less parameter passing.
> >
> > Bug: 40241607, 382071730
> > Change-Id: I9a4bbef3e3a77280056e158fb215647656a8c00f
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6095761
> > Reviewed-by: Peter Kasting <pkasting@chromium.org>
> > Commit-Queue: Peter Boström <pbos@chromium.org>
> > Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
> > Cr-Commit-Position: refs/heads/main@{#1396998}
>
> Bug: 384553537, 40241607, 382071730
> Change-Id: Ibd85c1dbea710fc7585d08ac86fcf9ad7af1ba47
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6097359
> Owners-Override: Taiyo Mizuhashi <taiyo@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: thefrog <thefrog@chromium.org>
> Commit-Queue: thefrog <thefrog@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1398076}

Bug: 384553537, 40241607, 382071730
Change-Id: Ie5663afbabda3eccbd01656617bd889169e8cd8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6124647
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Owners-Override: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1401663}
2025-01-02 17:43:12 -08:00
Daniel Cheng
a565e82bd7 Convert base::ranges::{begin,end} usage to std::ranges::{begin,end}
The //base implementation uses base::priority_tag, which is infrequently
used and is slated for removal. The STL helpers are drop-in
replacements.

Bug: 337356049
Change-Id: I4cdd6d8487cb8addb51ba270dcfaf9f5a87d6f4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5494910
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1323329}
2024-07-04 14:09:17 +00:00
Nathan Memmott
4aff5048b7 sql: Don't DCHECK sqlite codes aren't kUnusedChrome
The sqlite codes that get mapped to kUnusedChrome can happen due to
sqlite database corruption.

Bug: 343808334
Change-Id: I229dc6d33c98cafecaedaf840f1d619ee3e98f5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5609872
Commit-Queue: Nathan Memmott <memmott@chromium.org>
Reviewed-by: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1314175}
2024-06-12 19:27:51 +00:00
Peter Boström
6baf523d51 CHECK that SQLite result codes are present in map
This replaces a NOTREACHED() that's about to turn fatal.

Bug: 40580068
Change-Id: I36a921a562ea7bc7bffc283aec7a484c2919f595
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5598763
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Evan Stade <estade@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Auto-Submit: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1310976}
2024-06-05 23:40:05 +00:00
Dan McArdle
b52665ca6b sql: Assorted IWYU fixes
This CL also adds IWYU annotations to third_party/sqlite/sqlite3.h so
other files that include it will not see spurious IWYU warnings.

Change-Id: I30cd3f06dd8e9c805dd35a858f666911853325e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5555205
Reviewed-by: Evan Stade <estade@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1305306}
2024-05-23 20:24:31 +00:00
Peter Boström
188188db8b Migrate most remaining NOTREACHED()
This s/NOTREACHED()/NOTREACHED_IN_MIGRATION() for most of remaining
src/. Then I went through all changes and made sure that we didn't do
this for comments or "NOTREACHED(): " log strings.

Rolling in the corresponding change for remaining third_party/crashpad
is separately up for review.

Bug: 40580068
Low-Coverage-Reason: TRIVIAL_CHANGE Unreachable code is not reachable.
Change-Id: I707e582b710bf65474db2e3477fa06f5b8d8ea06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5545807
Owners-Override: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1302866}
2024-05-17 21:35:58 +00:00
Peter Boström
7843eba214 Use NOTREACHED_IN_MIGRATION() in the rest of src/
This was generated by replacing "  NOTREACHED()" with
"  NOTREACHED_IN_MIGRATION()" and running git cl format.

This prepares for making NOTREACHED() [[noreturn]] alongside
NotReachedIsFatal migration of existing inventory.

third_party/crashpad is still excluded, needs to be changed upstream.

Bug: 40580068
Change-Id: Ia5dbaddf53dba2fedefb67f1d428e8b24e9edffe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5545021
Commit-Queue: Peter Boström <pbos@chromium.org>
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1302314}
2024-05-16 23:41:33 +00:00
Takuto Ikuta
2eb6134247 sql: apply clang-tidy's misc-include-cleaner
Bug: 336474469
Change-Id: I3378c04b5b88c202885e412bbe2190af6824433f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5504232
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1299145}
2024-05-10 09:05:35 +00:00
Md Hasibul Hasan
52ffeca692 Convert StringPiece to std::string_view in //sql
Bug: 40506050
Change-Id: Ib65254fb3011507a1330848ffa9d3e12175ffcf6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5394490
Reviewed-by: Evan Stade <estade@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1278487}
2024-03-26 18:23:18 +00:00
Will Harris
b60653ccde Add new histograms to report errors initializing SQLite database.
This CL adds two new histograms that report more details on failed
SQLitePersistentStore DB initialization. These new metrics are
reported for both instantiations, ReportingAndNEL and Cookie.

The first, ErrorInitializeDB is the SQLite error code upon
initialization failure and is reported on all platforms.

The second, WinGetLastErrorInitializeDB is the ::GetLastError returned
on the DB thread after attempting to load the database, and is only
reported on Windows.

A test is added to verify this behavior, along with verifying that
the new histograms are only emitted in the failure case.

UmaHistogramSqliteResult is updated to take a const std::string ref
to match the underlying UMA functions being called.

BUG=1429117

Change-Id: I1bc2c898b005232305cebfde80a0dd8d4cfafd68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4608890
Reviewed-by: Austin Sullivan <asully@chromium.org>
Reviewed-by: Chris Fredrickson <cfredric@chromium.org>
Commit-Queue: Will Harris <wfh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1157192}
2023-06-13 22:32:23 +00:00
Ivan Murashov
3c7a0d50d5 sql: Add missing terminating " character in '#error' directive
In the CL https://crrev.com/c/3538180 was missed terminating " character
in the '#error' directive.
Added missing character and updated the error comment.

Bug: 1308290
Change-Id: Ie63d12588cdc16c2c4be5b142cc32d87c4a4e624
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3986423
Reviewed-by: Austin Sullivan <asully@chromium.org>
Commit-Queue: Austin Sullivan <asully@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1064546}
2022-10-27 21:21:47 +00:00
Avi Drissman
69b874fee0 Update copyright headers in sql/, storage/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c95.

No-Try: true
Bug: 1098010
Change-Id: I68bb81a4dcae37f944f4d8cd39d82ed540364615
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3899461
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047607}
2022-09-15 19:11:14 +00:00
Victor Costan
f176d2453a sql: Integrate SqliteResultCode with sql::Statement.
Bug: 1308290
Change-Id: Idec3754173581b72452bc0e0ca4b0aab82562bef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3538833
Auto-Submit: Victor Costan <pwnall@chromium.org>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Commit-Queue: Austin Sullivan <asully@chromium.org>
Cr-Commit-Position: refs/heads/main@{#983682}
2022-03-22 05:31:22 +00:00
Victor Costan
ab7a24586c sql: Introduce strongly typed enums for SQLite result codes.
This CL introduces the following strongly typed enums, which are meant
to replace raw integers in Chrome's layer on top of SQLite.

* SqliteResultCode represents all result codes.
* SqliteErrorCode represent a result code that's known to be an error.

This CL integrates each new type in one place, to give an idea of what
our code will look like once we adopt these new types.

* SqliteResultCode is integrated in
  Database::ExecuteAndReturnResultCode().
* SqliteErrorCode is integrated in Database::OnSqliteError().

The new enums are declared in //sql/sqlite_result_code.h, together with
helper functions for converting raw integers returned by the SQLite API.
The values for the new enums are defined in a separate header,
//sql/sqlite_result_code_values.h. This is intended to help readability,
as sqlite_result_code.h has everything developers need to start using
the types, while the boilerplate is relegated to
sqlite_result_code_values.h.

Last, this CL moves the SqliteLoggedResultCode logic from
error_metrics.{h,cc} into the newly introduced files. This is done in
part because this type is also a strongly typed replacement for SQLite's
result codes, and in part because we want all the SQLite result code
conversion logic to share one mapping table.

Bug: 1308290
Change-Id: I580ae4649cabccaab74c1d4749b5f349cf42f047
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3538180
Auto-Submit: Victor Costan <pwnall@chromium.org>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Commit-Queue: Austin Sullivan <asully@chromium.org>
Cr-Commit-Position: refs/heads/main@{#983543}
2022-03-21 23:06:08 +00:00