DatabaseOptions is getting too large for the "explicit out of line
constructor for complex types" presubmit. Adding a constructor to it
prevents it from being an aggregate type, which is how most of the
callers currently use it.
This Cl makes DatabaseOptions members private and adds builder-type
setters for each member. It also updates all callers, and adds an out of
line constructor.
A future improvement could be to add a passkey to the setters for
discouraged options.
Bug: None
Change-Id: I63562f43c8b290247878d194039487b240e958c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6216099
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Greg Thompson <grt@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Commit-Queue: Anthony Vallée-Dubois <anthonyvd@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414974}
This CL removes the default value of the `tag` argument on the 2
`sql::Database` constructors, and updates all callers that didn't
explicitly pass a tag to do so.
As a convenience, this CL also defines a common tag for unit tests.
This will allow the implementation and monitoring of per-database
performance metrics (time to open, statement execution time, VMSteps,
etc) without the possibility of having some of the databases
uninstrumented. This is useful for diagnosing issues such as crbug.com/369635654 in the wild, and required for some performance investigations that we have in the pipeline.
The last step of this work item (asserting that the tag is correctly defined in histograms.xml variants) is implemented in https://chromium-review.googlesource.com/c/chromium/src/+/6055279.
Bug: 40949392
Change-Id: I6dec0fb86a5e7b98cd42ac3a9db18e23eaf9e9bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6039025
Reviewed-by: manuk hovanesian <manukh@chromium.org>
Commit-Queue: Anthony Vallée-Dubois <anthonyvd@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1395446}
This change almost allows us to remove FTS3 support from the SQLite
build (saving ~64kb of binary size on Android), as it is only needed by
WebSQL, which is in the process of being removed, but WebSQL is still
enabled for WebView.
As a result, in order to retain test coverage of FTS3 availability,
we add a test-only private field to allow sql::Database to continue
enabling virtual tables. This field will be removed once we are sure
that WebSQL and therefore FTS3 support can be removed as well.
Bug: 340805983
Change-Id: I7ac2f7aeb35bd230194ac224a9413a47a7343988
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5539299
Reviewed-by: Evan Stade <estade@chromium.org>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Commit-Queue: Andrew Paseltiner <apaseltiner@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1301504}
This CL moves ReadPageSize() from an anonymous namespace to
to ensure that SQLite is indeed using the indicated page size.
sql: :test:ReadDatabasePageSize() and uses it in DatabaseOptions's test
Change-Id: If037ed19e96a88d7a199bb98685e7bd6b561730a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3541048
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@{#983717}
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}
The tests ensure that our sql::Database::Open*() implementations
configure SQLite with the values in sql::DatabaseOptions. Some tests in
this CL are new, while some tests are moved over from sql::Database's
unit tests.
Change-Id: I709c5380726e1a3f6cd9022cce0734b6d2cbe713
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3526264
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/main@{#981393}