0
Commit Graph

4 Commits

Author SHA1 Message Date
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
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