0
Commit Graph

451 Commits

Author SHA1 Message Date
d4888dbd9a Add trace event for EnsureSqliteInitialized
Adding a trace event to look at databases/chrome startup.

We observed crash reports where the initialization occurs on a
background thread. Since we are unsure about the cost / impact
of that function we want to double check with slow-reports that
performance are fine.

R=sky@chromium.org

Change-Id: I7196fdc989c53eb8a37126972d8ce1b9fd5ff599
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2857994
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#877737}
2021-04-30 01:18:49 +00:00
846e1896b7 [base] Remove base::StringPiece::as_string() usages
Bug: 1049498
Change-Id: Ia6fc9f76b45e755fbe67171e6c3513c95932c00f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2601364
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Owners-Override: Gabriel Charette <gab@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#877499}
2021-04-29 16:12:03 +00:00
02f91dae7f Fix header guards in various dirs.
Generated mechanically as follows:

git ls-files '*.h' | grep "^$DIR" | \
    xargs parallel cpplint.py --filter=-,+build/header_guard -- 2>&1 | \
    grep build/header_guard | tools/apply_cpplint_header_guard.py

Bug: 1200694
Change-Id: I128daa6b322b6d1c2bf7748b7bb03d1d68cfc2d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2848538
Reviewed-by: Boris Sazonov <bsazonov@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#876278}
2021-04-26 19:47:38 +00:00
df43e9b150 sql: Fix DCHECK while recovering empty BLOB or TEXT values.
Bug: 1195993
Change-Id: I82cc96f492eb56cb31eab504dfd73417e7bf2e84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2846138
Reviewed-by: Chris Mumford <cmumford@google.com>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#875930}
2021-04-24 00:35:44 +00:00
fd24d8a528 sql: Expand README.
Change-Id: Ifd86b539728539b7b0f6028966f770da0eda4107
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2848520
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#875819}
2021-04-23 20:23:21 +00:00
841e5b74e4 sql: Add README.
Change-Id: I10e11d9582441bde86c62f791a70549b40a129d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2798769
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#874154}
2021-04-20 06:14:32 +00:00
9aeacf770a Do not return std::unique_ptr<T>() in various dirs.
This is just a convoluted way of writing nullptr, so rewrite it in the
simpler form. PRESUBMIT.py already disallows new instances of
std::unique_ptr<T>(). This removes existing instances.

Change-Id: Iee6f46b016c61a5308f701cfec2d067fe9390a32
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2803679
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: Lambros Lambrou <lambroslambrou@chromium.org>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#870130}
2021-04-07 19:02:01 +00:00
ad6b0113cd sql: Add BindTime() and ColumnTime() to sql::Statement.
These helpers use the recommended base::Time serialization method. This
addition is intended to increase the likelihood that new features use
the recommended serialization method, and reduce logic duplication
throughout the codebase.

Follow-up CLs will replace explicit base::Time serialization in SQL
code with calls to these helpers.

This CL does not introduce any behavior changes.

Bug: 1195962
Change-Id: Ic32b318192df1fff39ce7fe555d73b429a5aef97
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2805559
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#869342}
2021-04-06 00:53:48 +00:00
fb60ea0a4d Apply modernize-make-unique to remaining files
This intends to cover directories and individual files where changes
weren't large enough to warrant splitting out to a separate change.

This is a large-scale change: go/chromium-modernize-make-unique

Bug: 1194272
Change-Id: Ia50424ec4b7f998e65dee5071926332ffcce7a94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2803041
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#869273}
2021-04-05 21:06:12 +00:00
09a4396a44 [LSC] Remove base/strings/string16.h #includes
This change removes #includes of base/strings/string16.h from the
codebase.

Bug: 1184339
Change-Id: I3b29dd94c6955d01029d24f88177b755863c865d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2756167
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Owners-Override: Jan Wilken Dörrie <jdoerrie@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#862683}
2021-03-14 19:20:08 +00:00
739ccc2128 [LSC] Replace base::string16 with std::u16string in //[f-z]*
This change replaces base::string16 with std::u16string in //[f-z]*

Reproduction steps:
$ git grep -lw 'base::string16' [f-z]* | \
      xargs sed -i 's/\bbase::string16\b/std::u16string/g'
$ git cl format

Bug: 1184339
Change-Id: I4e0ff2fd300c9fd9360dbf8f4b44e74f5f511797
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2752148
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Owners-Override: Jan Wilken Dörrie <jdoerrie@chromium.org>
Owners-Override: danakj <danakj@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#862044}
2021-03-11 18:13:05 +00:00
a17b04bf2b [LSC] Replace base::char16 with char16_t outside of //base
This change replaces usages of base::char16 with char16_t outside of
//base.

Note: net/third_party/mozilla_security_manager/README.chromium needs to
modification, since it already mentions the need to fork the files due
to the heavy adaptations necessary.

Bug: 1184339
Change-Id: Ib714b6813eac8c3f7c64459aec0b25d67b4140b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2744781
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Owners-Override: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#861272}
2021-03-09 20:51:01 +00:00
56f1bfabb1 Add mek@ to OWNERS for all storage-related code.
This CL also adds ayui@ to Cookie Store tests OWNERS,
and huagndarwin@ to Async Clipboard tests OWNERS.

Change-Id: I50e8506d0c0fd18c760932e74cfd201fdeb5cba6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2726825
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Auto-Submit: Victor Costan <pwnall@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#858764}
2021-03-01 23:34:01 +00:00
dfd1edc814 Update documentation to allow owners of public APIs that are used throughout the codebase to Owners-Override changes across the source tree.
Unlike LSC which is meant for work that spans dozens of CLs, this new change is meant for one-off CLs. It's similar to google3's global approvals mechanism.

base, build, blink, content and url were chosen as an initial set because they are used in many top level directories and are frequently changing.

Also add "set noparent" to top level directories to avoid inadvertent +1s from src/OWNERS bypass owners reviews sometimes.

Change-Id: Iaa397a5e09174139af21fee34dca390de132e216
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2688805
Auto-Submit: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#857391}
2021-02-24 22:22:40 +00:00
8a2d723aab [fuchsia] Fix FuchsiaVfsCheckReservedLock return value
The sqlite3 documentation for xCheckReservedLock states:
> The xCheckReservedLock() method checks whether any database
> connection, either in this process or in some other process, is
> holding a RESERVED, PENDING, or EXCLUSIVE lock on the file.  It
> returns true if such a lock exists and false otherwise.

However, the Fuchsia implementation for this method was returning the
|lock_state| value for the file, which is incorrect.

Bug: 1175863
Change-Id: Id89c965bc073d246eb0265b683f401d6d597f936
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2702292
Commit-Queue: Fabrice de Gans-Riberi <fdegans@chromium.org>
Auto-Submit: Fabrice de Gans-Riberi <fdegans@chromium.org>
Reviewed-by: Wez <wez@chromium.org>
Reviewed-by: Chris Mumford <cmumford@google.com>
Cr-Commit-Position: refs/heads/master@{#855490}
2021-02-18 22:56:49 +00:00
b30a0cee48 Remove config setters from sql/database.h
Most of the setters for configuration options for a SQLite database only
worked before the database was opened and were no-ops otherwise. This
led to confusing semantics and needing to support unnatural behaviour in
other parts of sql/ code.

This change removes the setters for the database config now encapsulated
in the DatabaseOptions struct. This struct is only set once as part of a
new constructor.

All feature code has already been migrated to use the new constructor
instead of the setter methods.

Bug: 1126968
Change-Id: I13474fbb87c7f2da386e83fb8d1fe3d8c44ab963
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2627941
Commit-Queue: Shubham Aggarwal <shuagga@microsoft.com>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#848097}
2021-01-28 15:11:23 +00:00
15d905deef sql: Run SQLDatabaseTestExclusiveMode tests.
Currently, the SQLDatabaseTestExclusiveMode suite is not instantiated,
so the tests are not run. This CL instantiates the suite.

This problem was discovered by attempting to roll googletest past CL
315255779, which causes test binaries to fail when they include test
suites / parametrized tests that are not instantiated, and when they
include empty test suites.

Bug: 1163396
Change-Id: Ieb47f8d612c48af04f3d9d05e1873fc437c2f6c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2615579
Commit-Queue: Victor Costan <pwnall@chromium.org>
Commit-Queue: Darwin Huang <huangdarwin@chromium.org>
Auto-Submit: Victor Costan <pwnall@chromium.org>
Reviewed-by: Darwin Huang <huangdarwin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841220}
2021-01-07 22:18:58 +00:00
f40a875774 sql: Add sequence checks to sql::Statement.
sql::Statement is not thread-safe. Add checks documenting this.

The checks are currently excluded on Android, because the Android
implementation of History uses sql::Statement in a thread-unsafe way --
see https://crbug.com/866218. Landing the checks on all other platforms
now is a bit ugly, but has the benefit of preventing new errors from
creeping into the codebase while the Android issues are figured out.

Bug: 863724
Change-Id: Ia0d087f40bd892c2ed084e3acfc3cf1ecf12e6af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1137851
Commit-Queue: Victor Costan <pwnall@chromium.org>
Commit-Queue: Darwin Huang <huangdarwin@chromium.org>
Reviewed-by: Darwin Huang <huangdarwin@chromium.org>
Auto-Submit: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841165}
2021-01-07 20:22:15 +00:00
e7cd35899c sql: Fix potential integer multiplication overflow in database recovery.
Before this CL, DatabasePageReader::ReadPage() computed `read_offset`,
which is a byte offset in a SQLite database file, by multiplying two
ints, a page ID and a page size. The multiplication result is an int,
which may overflow. Even on 64-bit Unix platforms, int is 32-bit wide.

The overflow may produce a negative offset, which breaks the API
preconditions of SQLite's low-level reading functions. On Unix
platforms, the xRead() function called by ReadPage() is implemented by
unixRead(). When SQLite's mmap support is enabled (it is in Chrome),
passing a negative offset to xRead() causes it to memcpy() from an
invalid memory address.

This CL fixes the overflow by casting one of the multiplication inputs
to int64_t, which causes the multiplication result to be an int64_t.
This CL is likely to fix the attached bug, because a few sample crash
dumps are consistent with the hypothesis of a memcpy() from an invalid
offset.

Bug: 1015800
Change-Id: Ibc8e8dab52eef447acdb65d0ee9ddaeab1e160df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2605970
Auto-Submit: Victor Costan <pwnall@chromium.org>
Reviewed-by: Darwin Huang <huangdarwin@chromium.org>
Commit-Queue: Darwin Huang <huangdarwin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841034}
2021-01-07 13:53:58 +00:00
5ad7ee45fe sql: Clarify comment for MetaTable::SetCompatibleVersion().
The current comment is slightly misleading, causing extra code review
round-trips.

Change-Id: I899147eab2bc3afdb2717955ad0f2cc4d31524ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2582817
Auto-Submit: Victor Costan <pwnall@chromium.org>
Reviewed-by: Chris Mumford <cmumford@google.com>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836341}
2020-12-12 00:53:00 +00:00
00370898ce Add test coverage for WAL mode in database_unittest
This change makes it so that all tests in database_unittest.cc now run
both with WAL mode on and off. Better test coverage will help us
transition to using WAL mode by default in the future.

Bug: 78507
Change-Id: I116a8151c1ab4919a78657e46df98b26eddb7f11
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2490664
Commit-Queue: Shubham Aggarwal <shuagga@microsoft.com>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821790}
2020-10-28 17:57:54 +00:00
e2d6b60d7a sql: Move defaults from Database constructor to member declaration
We prefer having constant default values to be listed alongside the data
member declaration instead of in the constructor.

This is a purely stylistic change and should not have any functional
effect.

Change-Id: If4ad7be6e73ff52e92258452fe86a7b3a7f790b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2490860
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819698}
2020-10-22 04:41:48 +00:00
7b60fe6e30 Add sql::DatabaseOptions to encapsulate its configuration options
sql::Database uses internal state to manage its configuration options
like page size, journal mode etc. These options need to be set before
Database::Open() is called. Any change to this state has no effect if
done after the database has already been opened. There are also some
SQLite subtleties around different behaviour of this state depending on
whether the database is being opened for the first time or being
re-opened.

This change encapsulates all such state into a sql::DatabaseOptions
struct which is passed to the sql::Database constructor. This ensures
that the required options have been configured before calling Open().

We migrate sql/ to use the new constructor instead of the setters for
the state. In upcoming changes, we plan to remove the setters for this
state. This will make the Database API enforce that the options are set
only once and stay the same over the lifetime of the object.

Bug: 1126968
Change-Id: Id44b6b3883f7a695f3b5cd96ad071e15cb1dc44a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2427035
Commit-Queue: Shubham Aggarwal <shuagga@microsoft.com>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817386}
2020-10-15 06:00:28 +00:00
d6e7325a8e sql: Add support for measuring per-database memory usage.
Change-Id: I836b9412f915cdebeff46883c535b83026ed6472
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2463873
Reviewed-by: Mark Pearson <mpearson@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817189}
2020-10-14 21:11:25 +00:00
b3eab8d676 Remove unneeded scoped_feature_list.h
Remove #include from source files
that do not use ScopedFeatureList.

Bug: 1137231
Change-Id: Ie8833c4ac4dc34fcb303dbe674cb882c38380e47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2462957
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816006}
2020-10-11 16:15:40 +00:00
b223079ca1 sql: Switch SQLite to default to exclusive locking mode.
Chrome used the default SQLite configuration where databases were first
opened in the NORMAL (not exclusive) locking mode, and then databases
that opt in were switched to the EXCLUSIVE locking mode via a "PRAGMA
locking_mode" statement.

This CL switches the default. Databases are first opened in EXCLUSIVE
mode by changing the SQLITE_DEFAULT_LOCKING_MODE build configuration
macro. Databases that don't opt into exclusive mode are switched to the
NORMAL locking mode via a "PRAGMA locking_mode" statement.

This CL should not introduce any behavior changes in most cases. The
result of the "PRAGMA locking_mode" statement was previously ignored,
and is now checked. So, if the desired locking mode cannot be set,
sql::Database::Open() will now fail.

In the long run, Chrome's SQLite usage should be migrated to use the
exclusive locking mode, for the benefits outlined in
https://crbug.com/1120969. When that happens, the "PRAGMA locking_mode"
can go away.

Bug: 56559, 1120969
Change-Id: Ia9ac996fae45890bb5ca11168422e15e594087ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2460982
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: Darwin Huang <huangdarwin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815540}
2020-10-09 08:35:14 +00:00
58aa8ff4c5 Add DIR_METADATA files to //sql
Generate DIR_METADATA files and remove metadata from OWNERS files for //sql.

Bug: 1113033
Change-Id: I7fa2ca83ea5d961bea8d257c4919b035f9e6fe6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2451394
Commit-Queue: Victor Costan <pwnall@chromium.org>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814297}
2020-10-06 18:24:06 +00:00
598a10e937 Clean up SqlSkipPreload feature.
Bug: 1126640
Change-Id: I87de57b6c22c6b2f7bda8c6ca6a8b501436f863b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2435327
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Mark Pearson <mpearson@chromium.org>
Commit-Queue: Caitlin Fischer <caitlinfischer@google.com>
Cr-Commit-Position: refs/heads/master@{#812006}
2020-09-30 14:28:25 +00:00
f05bb1087f [base] Remove BasicStringPiece::starts_with()
In order to make BasicStringPiece API compatible with C++17's
std::basic_string_view this change removes the starts_with() API and
updates call sites to use base::StartsWith instead.

In order to keep this callsites concise, base::StartsWith's
case_sensitivity parameter now defaults to CompareCase::SENSITIVE.

TBR=dcheng

Bug: 1049498
Change-Id: Ie621c6d08283d2ffd1055c5753ade5451f5c0b1d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2358745
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799265}
2020-08-18 19:35:56 +00:00
959eab0e8f sql: Small documentation improvements for SandboxedVfs.
Change-Id: I472582eaea658d2ee8a4c157a0161611d2aca2e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2359229
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Ken Rockot <rockot@google.com>
Auto-Submit: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798727}
2020-08-17 18:33:56 +00:00
0168742f28 Improve Storage Service sandboxing support
This corrects some deficiencies in the Storage Service's sandboxing
support by eliminating all remaining instances of direct filesystem
traversal within DOM Storage, replacing them with appropriate
FilesystemProxy usage.

A few new IPCs are added to the Directory mojom interface in support of
this, and a new delegate is added to support use of
sql::SandboxedVfs with a FilesystemProxy backing it.

Bug: 1052045
Test: content_browsertests with StorageServiceOutOfProcess and StorageServiceSandbox enabled
Change-Id: I8e7593d9424be705cb3c2bf561a4fe4c5d61251d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2350542
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798710}
2020-08-17 18:00:59 +00:00
7655fcb62d Move SandboxedVfs to from Blink to //sql
In preparation for reusing most of this thing within the Storage Service
process, this moves SandboxedVfs into //sql and abstracts out the few
Blink-specific dependencies into a small delegate interface.

Bug: 1052045
Change-Id: I947611c63060446692c7f78b4f555b9f90994842
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2351159
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797368}
2020-08-12 19:22:40 +00:00
5deced7586 Migrate to OS_MAC and OS_APPLE in sql
Bug: 1105907
Change-Id: Icecf8ad743a7431ae5cb3ec2cf1c8e88262b8eb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2324894
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792874}
2020-07-29 21:24:58 +00:00
9720dce482 Reland "[base] Prepare //net for base::string16 switch"
This is a reland of ee99ff7f2e

Original change's description:
> [base] Prepare //net for base::string16 switch
>
> This change prepares //net for the switch of base::string16 to
> std::u16string on all platforms. This was achieved by making
> net_unittests compile on Windows after the switch was made.
>
> Furthermore, it fixes small issues in //base and //sql.
>
> Bug: 911896
> Change-Id: I11fd80998e9f5e954a87870533685a3f77fa42d9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303431
> Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
> Reviewed-by: Matt Menke <mmenke@chromium.org>
> Reviewed-by: Victor Costan <pwnall@chromium.org>
> Reviewed-by: Will Harris <wfh@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#790126}

TBR=wfh

Bug: 911896
Change-Id: Ibbd6cb6695b40149971186f05ffb6b859acd68f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2309689
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790444}
2020-07-21 17:14:23 +00:00
d4fbc9b0cd Revert "[base] Prepare //net for base::string16 switch"
This reverts commit ee99ff7f2e.

Reason for revert: Seems to have caused many windows bots to fail

https://crbug.com/1107693

Original change's description:
> [base] Prepare //net for base::string16 switch
> 
> This change prepares //net for the switch of base::string16 to
> std::u16string on all platforms. This was achieved by making
> net_unittests compile on Windows after the switch was made.
> 
> Furthermore, it fixes small issues in //base and //sql.
> 
> Bug: 911896
> Change-Id: I11fd80998e9f5e954a87870533685a3f77fa42d9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303431
> Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
> Reviewed-by: Matt Menke <mmenke@chromium.org>
> Reviewed-by: Victor Costan <pwnall@chromium.org>
> Reviewed-by: Will Harris <wfh@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#790126}

TBR=dcheng@chromium.org,mmenke@chromium.org,wfh@chromium.org,pwnall@chromium.org,jdoerrie@chromium.org

Change-Id: I55fcbe1f97fb34c943e72498e9f2e7d709a8b89c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 911896, 1107693
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2308553
Reviewed-by: Fergal Daly <fergal@chromium.org>
Commit-Queue: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790213}
2020-07-21 02:06:10 +00:00
ee99ff7f2e [base] Prepare //net for base::string16 switch
This change prepares //net for the switch of base::string16 to
std::u16string on all platforms. This was achieved by making
net_unittests compile on Windows after the switch was made.

Furthermore, it fixes small issues in //base and //sql.

Bug: 911896
Change-Id: I11fd80998e9f5e954a87870533685a3f77fa42d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303431
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790126}
2020-07-20 21:44:29 +00:00
1c06850ffa SQLite: Add WAL mode support to CorruptSizeInHeader
CorruptSizeInHeader is a test helper function that allows to simulate
a corrupt database by altering the header of the DB file. In WAL mode,
transactions don't always touch the DB file, which means the database
can behave normally even when corrupted in this way. In this change,
the CorruptSizeInHeader method checkpoints and truncates the WAL
file. This ensures that any subsequent transaction is guaranteed to hit
the DB file and hence be affect by the header corruption. This change
also adds a test that verifies that the function works correctly.

Change-Id: Ic584e29f89b09a886d96e4424a17de8d37683314
Bug: 78507
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2278413
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785702}
2020-07-07 13:42:57 +00:00
5d2679063b apple: Convert GN libs lists to frameworks in //sql.
GN recently added support for Apple frameworks to link, rather than
overloading the libs lists. This pulls .frameworks out of the libs
lists, so that GN can stop supporting .frameworks in libs in the
future.

Bug: 1052560
Change-Id: I88e2c0191af5e52e86b4a27e0caba52bd960e66a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2276761
Auto-Submit: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784304}
2020-07-01 03:45:25 +00:00
ca721596ff Remove/replace unnecessary includes of logging.h (sql/)
If the file just needs the CHECK/CHECK_OP/NOTREACHED
macros, use the appropriate header for that instead.
Or if logging.h is not needed at all, remove it.

This is both a nice cleanup (logging.h is a big header,
and including it unnecessarily has compile-time costs),
and part of the final step towards making logging.h no
longer include check.h and the others.

Bug: 1031540
Change-Id: I06bc0c29ef1369ac3d104c404a032e2937d500c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2254325
Commit-Queue: Hans Wennborg <hans@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Auto-Submit: Hans Wennborg <hans@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780708}
2020-06-22 10:27:52 +00:00
be4f97ce11 SQLite: Add support for WAL mode
As per issue 78507, we are looking to add support for SQLite databases
to use Write-ahead logging (https://www.sqlite.org/wal.html) mode in
Chromium. WAL mode should give us significant performance gains across
almost all use-cases.

This change is a first step towards achieving this. It adds opt-in
support to enable WAL mode for a database connection and perform a
checkpoint. It also adds a feature flag to enable WAL mode for all
databases by default to investigate its feasibility and impact on
performance.

Bug: 78507
Change-Id: I7fc5edcc39b50d2a13755d587cf342bded1af60a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095927
Commit-Queue: Shubham Aggarwal <shuagga@microsoft.com>
Reviewed-by: Brandon Maslen <brandm@microsoft.com>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Chris Mumford <cmumford@google.com>
Cr-Commit-Position: refs/heads/master@{#780318}
2020-06-19 15:58:57 +00:00
85d016374f Roll src/third_party/sqlite/src/ 3478eafd0..b5399f70d (246 commits)
3478eafd05..b5399f70d4

Also, update RecoverModuleTest integer expectations for sqlite v3.32.1.
This behavior changed between sqlite v.3.31.1 and v3.32.1.

$ git log 3478eafd0..b5399f70d --date=short --no-merges --format='%ad %ae %s'
2020-05-28 huangdarwin Amalgamations for release 3.32.1
2020-05-25 drh Version 3.32.1
2020-05-25 drh Extra assert() statements in the printf() logic.
2020-05-25 drh Defensive code that tries to prevent a recurrence of problems like the one described in ticket [7a5279a25c57adf1]
2020-05-25 drh Fix minor compile issues with optional extensions.
2020-05-25 drh Make sure variable declarations are at start of scope even when SQLITE_ENABLE_SNAPSHOT is used.
2020-05-24 drh Version number to 3.32.1.
2020-05-24 drh When rewriting a query for window functions, if the rewrite changes the depth of TK_AGG_FUNCTION nodes, be sure to adjust the Expr.op2 field appropriately.  Fix for ticket [7a5279a25c57adf1]
2020-05-24 drh Move some utility Walker callbacks into the walker.c source file, as they seem to belong there better.
2020-05-24 drh Improvements to parse-tree tracing logic.  No changes in deliverable code.
2020-05-24 drh Minor fix to a comment.  No code changes.
2020-05-23 drh Limit the "precision" of floating-point to text conversions in the printf() function to 100,000,000.  Fix for ticket [23439ea582241138].
2020-05-23 drh Improved bytecode comment.
2020-05-22 drh Version 3.32.0
2020-05-21 drh Change a NEVER macro into a NO_TEST comment, as the conditional is reachable, but only when compiling for Windows 32-bit.
2020-05-21 dan Avoid another potential OOB read in sqlite3expert.c.
2020-05-20 drh Back out the change from [7fab1393c2b22b1f] that tries to convert invalid surrogate characters in UTF16 into the replacement character 0xfffd, as we find that this breaks some software.
2020-05-19 drh Add compiler hints to disable TSAN for the routines that access the -shm file header in WAL mode using a double-read with memory barrier.
2020-05-19 dan In os_win.c, avoid calling sqlite3_uri_boolean() on anything other than a main-db filename.
2020-05-19 drh User-suggested improvement to the README.txt for the ICU extension.
2020-05-19 drh In wal.c, improved comments on concurrency issues.  More use of AtomicLoad() and AtomicStore().
2020-05-18 dan Add vdbevtab.lo to build of libsqlite3.lib in Makefile.msc.
2020-05-17 drh Avoid harmless UB in memcpy() in the JSON extension.
2020-05-17 drh Use the sqlite3Realloc() interface internally, rather than the public sqlite3_realloc64() equivalent, to avoid unnecessary calls to sqlite3_initialize().
2020-05-16 drh Performance optimization for the sqlite3FindTable() subroutine.
2020-05-16 drh The OP_RealAffinity opcode is not necessary after reading values from a virtual table (such as rtree).  It is harmless, but it does use CPU cycles.  Might as well leave it off.
2020-05-16 dan Fix a use-after-free bug in the fts3 snippet() function.
2020-05-16 drh Extra memory barrier during initialization.
2020-05-16 dan Add sqlite3BeginBenignMalloc() and EndBenignMalloc() calls to debugging function sqlite3VdbePrintOp().
2020-05-15 dan Update code in sqlite3expert.c to account for the fact that "-- TRIGGER xyz" VM comments are now omitted for some builds.
2020-05-15 dan Fix another build problem for SQLITE_OMIT_VIRTUALTABLE builds.
2020-05-15 drh Fix a documentation typo.  No changes to code.
2020-05-15 drh Adjust some requirement marks.  No changes to code.
2020-05-15 dan Update test file e_fkey.test to account for the fact that new columns with REFERENCE clauses and non-NULL default values may now be added using ALTER TABLE if the table is empty.
2020-05-15 dan Fix SQLITE_OMIT_VIRTUALTABLE testfixture builds.
2020-05-15 dan Test script changes to account for the fact that the "p5" column in the EXPLAIN output is now an integer, not a text values containing a 2-digit hex value.
2020-05-15 mistachkin Enhancements to long-path support in the Win32 VFS.
2020-05-15 drh Move some new test cases from fts3snippet.test into fts3snippet2.test.
2020-05-15 drh Add the SQLITE_ENABLE_FTS3_PARENTHESIS option to fuzzcheck.  Add a new test case that uses that option.
2020-05-14 drh Fix a null pointer deference that can occur on a strange matchinfo() query.
2020-05-14 drh Do not allow a virtual table to be renamed into the name of one of its shadows.
2020-05-13 drh Implement the IIF(x,y,z) SQL function that is short-hand for "CASE WHEN x THEN y ELSE z END".  For compatibility with SQL Server.
2020-05-13 drh Remove unused constant SQLITE_FUNC_COALESCE.
2020-05-13 dan Use AtomicStore() and AtomicLoad() in a few more places to avoid a theoretically undefined behaviour. This is not actually problem on any known hardware.
2020-05-11 drh New test case in test/fuzzdata8.db.
2020-05-11 dan Fix a problem handling constant integer expressions with collation sequences in PARTITION BY clauses.
2020-05-08 drh Release some restrictions on columns added by ALTER TABLE so that they only apply if the table contains one or more rows.
2020-05-08 drh Fix the count-optimization so that it honors the NOT INDEXED clause.
2020-05-08 drh New test cases added to test/fuzzdata8.db.
2020-05-08 drh Do not retry on a failed realloc() unless SQLITE_ENABLE_MEMORY_MANAGEMENT is available, meaning that the retry has some possibility of success.
(...)
2020-02-24 drh Disable the new analyzeG.test module if not building with STAT4.
2020-02-23 drh Fix a problem with ALTER TABLE for views that have a nested FROM clause. Ticket [f50af3e8a565776b].
2020-02-22 drh Do not activate the truthProb adjustment mechanism if the truth probability is less than the heuristic value, as there could be correlations unknown to stat4.  Also add additional tracing output to make truthProb adjustments more visible.
2020-02-22 dan Add new test file analyzeG.test, containing a test for the change on this branch.
2020-02-22 drh When stat4 information is available, try to use it to improve the truth probability of WHERE clause terms that do not participate in the index.
2020-02-22 drh In the OP_Column opcode, if the cursor is marked NullRow (due to being the right table of a LEFT JOIN that does not match) and the cursor is the table cursor for an OR-optimization with a covering index, then do not substitute the covering index cursor, since the covering index cursor does not have the NullRow flag set.  Ticket [aa4378693018aa99]
2020-02-20 dan Add test case for previous commit.
2020-02-20 drh Early-out on the INTERSECT query processing following an error.
2020-02-19 drh Fix a potential NULL pointer dereference following OOM.  Problem discovered by dbsqlfuzz.  Test case in TH3.
2020-02-18 drh Remove a NEVER() macro and add a test case to cause its argument to be true.
2020-02-18 drh Add the new sqlite3_create_filename() and sqlite3_free_filename() interfaces for use by Shims.  Use these interfaces inside the multiplexor.
2020-02-17 drh Convert invalid surrogates to 0xfffd when translating UTF.
2020-02-17 drh A better (smaller and faster) solution to ticket [4374860b29383380].
2020-02-17 drh Take care when checking the table of a TK_COLUMN expression node to see if the table is a virtual table to first ensure that the Expr.y.pTab pointer is not null due to generated column optimizations.  Ticket [4374860b29383380].
2020-02-16 drh Avoid an infinite recursion on an illegal recursive definition of an fts5vocab table.
2020-02-13 drh Fix problems in the constant propagation optimization that were introduced by check-in [1c3e5c20a9e6f501].  Fix for ticket [1dcb4d44964846ad]
2020-02-13 drh Disallow the skip-scan optimization in the absence of sqlite_stat1 data.
2020-02-13 drh Omit O_NOFOLLOW from the open() call when opening /dev/null, since /dev/null is a symlink on Solaris, we are told.
2020-02-13 drh Fix an incorrect assert() statement that was added yesterday. Tickets [41c1456a6e61c0e7] and [fb8c538a8f57ae2a].
2020-02-12 drh Increase the default upper bound on the number of parameters in a single SQL statement to 32766 (from 999).
2020-02-12 dan When determining whether an == or IS constraint in a WHERE clause makes an ORDER BY term redundant, consider the collation sequence used by the == or IS comparison, not the collation sequence of the comparison expression itself. Possible fix for [fb8c538a8f].
2020-02-10 drh Mark the sha1() extension function as SQLITE_DETERMINISTIC.
2020-02-10 drh Fix the build for when SQLITE_VDBE_COVERAGE is used.
2020-02-07 drh During byte-code generation, strive to avoid jumps that merely jump to the following instruction.
2020-02-07 drh Simplify the code by removing the unsupported and undocumented SQLITE_HAS_CODEC compile-time option
2020-02-06 drh There is no need to keep track of the number of changed rows or of the last-insert-rowid while running VACUUM.
2020-02-06 drh Unroll the comparison loop inside keywordCode() for to avoid unnecessary comparisions and thus help that routine run faster.
2020-02-06 drh Separate OP_IdxInsert and OP_SorterInsert into completely separate opcodes, helping each one to run a little faster.
2020-02-06 drh Remove dead code from the sqlite3_filename_database() function.
2020-02-06 dan Fix some fts3 problems found by usan.
2020-02-05 drh Small size reduction and performance improvement in the sqlite3VdbeMemFromBtree() interface used to pull content out of the b-tree and into an sqlite3_value object.
2020-02-04 dan Enable more detailed log messages in SQLITE_ENABLE_CORRUPT_PGNO builds if database corruption is encountered.
2020-02-04 drh Extend the OP_Copy-coalesce optimization fix of check-in [b36126c1889e323c] so that it is also correctly disabled by the CASE operator. Ticket [9d3666754ac37d5a].
2020-02-04 drh Fix a problem with the byte-code decompiler that was inserted by the enhancements at [4248980a356f659b]
2020-02-03 drh Cosmetic change to the xfer-optimization to put the OP_RowData opcode closer to the corresponding OP_Insert opcode.  This makes it slightly easier to read and understand the code.
2020-02-03 drh Increase the version number to 3.32.0.
2020-02-01 drh On an INSERT or UPDATE, perform affinity conversions on new data prior to running CHECK constraints.  Ticket [86ba67afafded936].
2020-02-01 drh Fix the comment display for the OP_Function opcode.  And at the same time, improve the comment generating logic to make use of the newer sqlite3_str_appendf() interface.
2020-02-01 drh Fix a problem in sqlite3CodecQueryParameters() that was introduced by the query parameter encoding changes for the 3.31.1 release.
2020-01-31 drh Fix a minor typo in a comment in the btreeinfo extension.
2020-01-29 dan Fix a problem with the processing of IN(...) constraints handled by virtual table implementations that do not set the "omit" flag when the virtual table column contains at least one NULL value.
2020-01-29 dan Add a test case for commit [ffd8bb93].
2020-01-29 drh Remove a NEVER() that is in fact reachable.  Test cases in dbsqlfuzz and TH3.
2020-01-29 drh Add new memory barriers during initialization.
2020-01-29 drh Modify a couple of FTS test cases so that they work on big-endian platforms.
2020-01-28 drh Faster decoding of 32-bit variable-length integers in cases were we do not need to know the number of bytes in the encoding.
2020-01-28 drh Small performance improvement to the key-comparision routine for strings.
2020-01-28 drh Reinstate the optimization of converting "a IN (C)" into "a=C" but only if C is a constant.  If the RHS is a table column, the complications of managing affinity and collations become too involved to mess with.
2020-01-28 dan Fix a 4 byte OOB read in test_multiplex.c.
2020-01-28 drh Minor change for compatibility with the s390 architecture.

Created with:
  roll-dep src/third_party/sqlite/src

Bug: 1087629
Change-Id: Ic27525b0b6d4011b77b096651a318358c5df14cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2222913
Auto-Submit: Darwin Huang <huangdarwin@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#773475}
2020-05-30 03:34:51 +00:00
6214d5b988 Revert "[Sheriff] Disable SQLDatabaseTest on Windows ASAN because they are flaky"
This reverts commit 146b9f1b1d.

Reason for revert: These tests were actually failing because death
tests weren't working on win-asan. That problem has been fixed as of
r771124. Also win-asan is not accurately named as it does not define
ADDRESS_SANITIZER.

Original change's description:
> [Sheriff] Disable SQLDatabaseTest on Windows ASAN because they are flaky
>
> Bug: 1027481
> Change-Id: I7fc1806eada39c58f3f6035736bf9d5c595fbb0b
> TBR: pwnall@chromium.org
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1946331
> Reviewed-by: Guido Urdaneta <guidou@chromium.org>
> Commit-Queue: Guido Urdaneta <guidou@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#720463}

TBR=guidou@chromium.org,gab@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1027481
Change-Id: I91ab2178d555e7ee852d7a8bf6bb5b0ca90f806d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2216358
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771889}
2020-05-26 18:28:23 +00:00
13d4d413de Remove/replace unnecessary logging.h includes in .cc files (sql)
CHECK, CHECK_EQ etc., and NOTREACHED/NOTIMPLEMENTED have moved
to the much smaller headers check.h, check_op.h, and notreached.h,
respectively.

This CL updates .cc files to use those headers instead when
possible, with the purpose of saving compile time.

(Split out from https://crrev.com/c/2164525 which also has
notes on how the change was generated.)

Bug: 1031540
Change-Id: I91305fe44026e637eaf7f2c543a9ad159e86e60a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2164812
Commit-Queue: Victor Costan <pwnall@chromium.org>
Auto-Submit: Hans Wennborg <hans@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762517}
2020-04-24 21:33:44 +00:00
0cfbeb3145 logging.h related include-what-you-use (sql/)
Fix code that was implicitly depending on logging.h or its
dependencies.

For example, code that uses DISALLOW_COPY_AND_ASSIGN should
include base/macros.h, but it currently happens to work if
it pulls in logging.h directly or through some dependency.

This is part of refactoring the codebase to use
check.h/check_op.h for the CHECK and CHECK_op macro
instead of logging.h.

Bug: 1031540
Change-Id: I5b5fadc562973216c2a7f81e8e0e9444821bdf08
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2156950
Auto-Submit: Hans Wennborg <hans@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760614}
2020-04-20 19:07:44 +00:00
6cb35c7015 Add trace events for database functions
Adding trace events for the database functions.

SQLite is suspected to have higher impact on IO than previously
expected. We are suspecting LockFile contention and Flush
contention.

Adding these trace events will help seeing the interaction
between these tasks and other tasks in chrome via slow-reports.

Bug: 1051180
Change-Id: Ife21c619bd8fafc6e892d6e9d45818d0813018c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2050167
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Reviewed-by: François Doray <fdoray@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#740745}
2020-02-12 18:09:48 +00:00
852532f442 Reformat remaining gn files.
`gn format` recently changed its formatting behavior
for deps, source, and a few other elements when they
are assigned (with =) single-element lists to be consistent
with the formatting of updates (with +=) with single-element.

Now that we've rolled in a GN binary with the change,
reformat all files so that people don't get presubmit
warnings due to this.

Most changes have landed by now via `git cl split`.
This is what remains after two weeks.

Bug: 1041419
Change-Id: Ia813d744e57e5647266a91d4f6c725bf921fb11c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2024471
Commit-Queue: Nico Weber <thakis@chromium.org>
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735958}
2020-01-28 18:17:22 +00:00
e7681c70c1 Add location to SQL ScopedBlockingCall
Lift the location into the InitScopedBlockingCall to allow
debugging slow cases with slow-reports.

Bug: 1027929
Change-Id: Ife752fab110d11fac07a0646e0bc2353e9396ff1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2003213
Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732638}
2020-01-17 00:51:20 +00:00
f070ffde7c SQL: Disallow implicit integer downconversion on BindInt
Calling sql::Statement::BindInt() with an int64_t argument silently
downconverted, potentially saving incorrect data to a database.
sql::Statement::BindInt64(int64_t) should be used instead.

Introduce an uncallable sql::Statement::BindInt(int64_t) overload to
fail the compile. This also catches calling BindInt with uint32_t. Fix
up various callers that were silently downconverting.

Bug: 908690
Change-Id: I1472ad5461c7e60bfc011def85a48bc9ca216734
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1935607
Commit-Queue: Joshua Bell <jsbell@chromium.org>
Reviewed-by: Becca Hughes <beccahughes@chromium.org>
Reviewed-by: Cathy Li <chili@chromium.org>
Reviewed-by: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723469}
2019-12-10 19:44:51 +00:00
146b9f1b1d [Sheriff] Disable SQLDatabaseTest on Windows ASAN because they are flaky
Bug: 1027481
Change-Id: I7fc1806eada39c58f3f6035736bf9d5c595fbb0b
TBR: pwnall@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1946331
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Commit-Queue: Guido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720463}
2019-12-02 13:36:40 +00:00
d7a640bd82 Add prefix to empty param tests.
googletest will no longer support empty prefix
for parameterized INSTANTIATE_TEST_SUITE_P.
Adding "All" prefix to existing empty prefix test suites.

This CL was uploaded by git cl split.

R=cmumford@google.com

Bug: 1023677
Change-Id: I46f40398e9043acf10da3eeee5608f019dc11b72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1926908
Auto-Submit: Ilia Samsonov <isamsonov@google.com>
Reviewed-by: Chris Mumford <cmumford@google.com>
Commit-Queue: Ilia Samsonov <isamsonov@google.com>
Cr-Commit-Position: refs/heads/master@{#717273}
2019-11-20 22:20:46 +00:00