0
Commit Graph

1793 Commits

Author SHA1 Message Date
Ayu Ishii
09f67035b2 Quota: Cleanup StorageType from QuotaClients
This change removes usages of StorageType in QuotaClient methods.
After StorageType::kSyncable deprecation, all other storage types
except kTemporary are deprecated. So we no longer need to specify
StorageType. Data that was previously associated with kSyncable
is now part of kTemporary.

Main part of this change is in quota_client.mojom and updates
all overrides and callers of impacted methods.

Bug: 40211051
Change-Id: I000a457346dd1e383c6252dfa22c75cfd3c6e721
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6368800
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1435031}
2025-03-19 12:47:33 -07:00
Evan Stade
7abc9ffece IndexedDB: remove BlobReader DWOC
After a lot of investigation, it's still not clear how to trigger this,
because it seems to require storing a File in IndexedDB that has unknown
size and/or modification date. I have not been able to construct such a
file without running into other errors that would prevent storing and
reading the file.

Bug: 393395443
Change-Id: I9b5eb531bb7c9e1338fdd70a6a16e578ef43d668
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6368285
Reviewed-by: Steve Becker <stevebe@microsoft.com>
Commit-Queue: Evan Stade <evanstade@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1434606}
2025-03-18 20:49:31 -07:00
Ayu Ishii
775cb04295 Quota: Cleanup StorageType from QuotaManagerImpl methods
This change removes usages of StorageType in QuotaManager methods.
After StorageType::kSyncable deprecation, all other storage types
except kTemporary are deprecated. So we no longer need to specify
StorageType. Data that was previously associated with kSyncable
is now part of kTemporary.

Main part of this change is in
storage/browser/quota/quota_manager_impl.cc. All other files
are either updating calls to QuotaManager or updates the
overridden functionality.

Further cleanup to remove usage in QuotaDatabase and QuotaClients
will be done in a follow-up.

Bug: 40211051
Change-Id: Id7232aa518bba8097559200fde2f330488dd2fa1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6350696
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Christian Dullweber <dullweber@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1434297}
2025-03-18 11:39:36 -07:00
Tom Sepez
a20bb6a8dc Mark unsafe libc calls in next batch of files
Iterative process to reduce the initial set of warnings. Use
UNSAFE_TODO() unless include rules preclude compiler_spcific.h,
in which case use the file-wide pragma.

Bug: 390223051
Change-Id: I0b4d6020dd30a5184ebd8178996d047205476d39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6362954
Reviewed-by: Alex Gough <ajgo@chromium.org>
Owners-Override: Alex Gough <ajgo@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1433839}
2025-03-17 16:02:20 -07:00
Evan Stade
b77419385b IDB: keep Index metadata in sync with db state
... for a specific error condition.

The bug is a result of indexes requiring keeping in-memory metadata
in sync with database state. When in-memory metadata is updated
(in this case, deleted), and then a subsequent database operation
fails, existing code restores the change to in-memory metadata (in this
case, re-adding it). But there was one error condition where the
metadata wasn't updated again. This addresses that branch.

This is a prospective fix for the linked bug, which has eluded
reproduction. A DWOC is also added which is intended to make the crash
non-fatal, but noisy, and if it never triggers we'll have some
indication that this prospective fix was effective.

(See also discussion on bug, in particular re: lack of new test
coverage.)

Bug: 398879932
Change-Id: I2a0954ea3979d9c70e7de23120fb0cfbbe8b36fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6354201
Commit-Queue: Abhishek Shanthkumar <abhishek.shanthkumar@microsoft.com>
Reviewed-by: Steve Becker <stevebe@microsoft.com>
Auto-Submit: Evan Stade <evanstade@microsoft.com>
Reviewed-by: Abhishek Shanthkumar <abhishek.shanthkumar@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1433404}
2025-03-17 02:24:23 -07:00
Evan Stade
84e05386c3 Update estade@chromium.org to new/active account
Most OWNERS entries are updated from estade@chromium.org to
evanstade@microsoft.com. These accounts are both owned by the same
human.  Committer affiliations are also updated in Blink (although
evanstade@microsoft.com is expected to be the only active account
going forward).

Change-Id: If047d2df9fb7d2b352ac6ce74017949331aa5c01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6348619
Owners-Override: Rick Byers <rbyers@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Commit-Queue: Evan Stade <evanstade@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1432449}
2025-03-13 16:42:46 -07:00
Tom Sepez
2197b668be Remove file-wide unsafe buffer suppression from content/ [3 of N]
-- Several files are already clean as either via previous changes or
   improvements to the compiler.

Bug: 342213636
Change-Id: I41b3d725dd75d6bbafa4e5fa9338e7d69b7673aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6341711
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: mmenke <mmenke@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1432391}
2025-03-13 14:53:59 -07:00
Garima Chadha
aef69ee52d IndexedDB: Fix flakiness in NotifyIndexedDB related tests
This change addresses the flakiness in the tests caused by improper
initialization of BucketLocator.

Key Points:

The expected count for various assertions of notify_list_changed_count
has been decreased. This adjustment is necessary because there are two
definitions in indexed_db_context_impl.cc that call
OnIndexedDBListChanged internally (OnFilesWritten and
DidForceCloseForDeleteBucketData).

When OnFilesWritten is called, incrementing the
notify_list_changed_count for each observer. During the Teardown phase
of IndexedDBTest, all observers are cleared.

Consequently, when DidForceCloseForDeleteBucketData is called, no
observers remain to trigger OnIndexedDBListChanged and increment the
count. Therefore, the expected count has been decreased in the new
implementation.

Bug: 41348374, 324111895
Change-Id: Idac145cfe04a79434b9e5d541511aaeb97386e0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6275787
Auto-Submit: Garima Chadha <garimachadha@microsoft.com>
Commit-Queue: Abhishek Shanthkumar <abhishek.shanthkumar@microsoft.com>
Reviewed-by: Steve Becker <stevebe@microsoft.com>
Reviewed-by: Abhishek Shanthkumar <abhishek.shanthkumar@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1432173}
2025-03-13 09:44:28 -07:00
Ayu Ishii
b8d256827e Quota: Cleanup some StorageType usage from QuotaManager
This change removes some usages of StorageType in QuotaManager.
After StorageType::kSyncable deprecation, all other storage types
except kTemporary are deprecated. So we no longer need to specify
StorageType. Further cleanup to remove usage in QuotaManager,
QuotaDatabase, etc. will follow.

Bug: 40211051
Change-Id: I8428a51ffc2a25781dacfffabae48de3032c6bf9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6336951
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1431654}
2025-03-12 11:44:50 -07:00
Vikram Pasupathy
61b8a86c5b cleanup: Add undef for macro right after use
As per style guide, add undef for macro after use.

Bug: 401393563
Change-Id: I14cb6665caa6640d24a846605d87882b4d342952
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6333579
Reviewed-by: Daniel Rubery <drubery@chromium.org>
Reviewed-by: Frank Liberato <liberato@chromium.org>
Reviewed-by: Kenneth MacKay <kmackay@chromium.org>
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Vikram Pasupathy <vpasupathy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1430431}
2025-03-10 12:58:19 -07:00
Aldo Culquicondor
0ad749c8f8 Forward declarations for MemoryRegion types in platform_handle.h
The compile-size bot reports a 455MB reduction.

Change-Id: I54e80ad1ceb6ae14e106da4f1c4d464cdaf99058
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6336187
Owners-Override: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Aldo Culquicondor <acondor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1430229}
2025-03-10 07:39:26 -07:00
Charlie Harrison
e07e86eb2c Add efficient helpers in SchemefulSite for samesite origin comparisons
Adds SchemefulSite::IsSameSite methods which can compute the same site
check efficiently (i.e. with fast early-return paths and no
allocations).

https://html.spec.whatwg.org/multipage/browsers.html#concept-site-same-site

We also upgrade some callers.

Bug: None
Change-Id: Idd969769ff5e54500a25461c87ece193614eaa77
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6321328
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: mmenke <mmenke@chromium.org>
Reviewed-by: Christian Biesinger <cbiesinger@chromium.org>
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Reviewed-by: Chris Fredrickson <cfredric@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1429192}
2025-03-06 14:54:13 -08:00
Ayu Ishii
baef7c60e6 Quota: Cleanup StorageType from QuotaManagerProxy::RegisterClient
This change removes StorageType param from
QuotaManagerProxy::RegisterClient. After
StorageType::kSyncable deprecation, all other storage types
except kTemporary are deprecated. So we no longer need to
specify StorageType.

As a side-effect there is also clean-up in
BrowsingDataQuotaHelper to no longer collect syncable usage.
No storage data is associated with Syncable type now and will
always return 0.

Further StorageType cleanup from QuotaManager/QuotaDatabase
will be done in a follow-up change.

Bug: 40211051
Change-Id: I70cb64c7b270def02d8b539a77498eba208b1e4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6309405
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Martin Šrámek <msramek@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1429075}
2025-03-06 11:41:24 -08:00
Dave Tapuska
af253cbe88 [ios blink] Disable the OperationOnCorruptedOpenDatabase tests
Unused function error was being generated on some builds.

Change-Id: I1f0e366d77fa33356d57c24f36dc9b549c22f1bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6317486
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1427234}
2025-03-03 10:47:13 -08:00
Dave Tapuska
24939cae8a [ios blink] Disable the OperationOnCorruptedOpenDatabase tests
The nested message loop on the IO thread does not unblock on
iOS so disable it for now.

Change-Id: I75b4c7a3896ab20d3fa498276f447c7070042777
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6314273
Reviewed-by: Rohit Rao <rohitrao@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1427112}
2025-03-03 07:19:22 -08:00
Ayu Ishii
6ecd458052 Quota: Cleanup StorageType in QuotaManagerProxy
This change removes some usages of StorageType in QuotaManagerProxy.
After StorageType::kSyncable deprecation, all other storage types
except kTemporary are deprecated. So we no longer need to specify
StorageType. Further cleanup to remove usage from QuotaManager,
QuotaDatabase, etc. will follow.

Bug: 40211051
Change-Id: Iba5caa5aefcc346cbcf9e7aac3f05ab33ca53d61
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6306646
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1426466}
2025-02-28 11:05:45 -08:00
Steve Becker
de36a5272a [IndexedDB] Cleanup unused IndexedDBContextImpl members
Remove unused class members from IndexedDBContextImpl.  Also removes
unused includes from indexed_db_context_impl.h.

Change-Id: Ib0e0f401b2a78b7d924e4d31a03509a35bb34181
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6293286
Commit-Queue: Steve Becker <stevebe@microsoft.com>
Reviewed-by: Rahul Singh <rahsin@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1423508}
2025-02-21 17:41:28 -08:00
Mingyu Lei
ca5ffc6416 Update Storage Owners
Add leimy@chromium.org to storage OWNERS files, this changes the same
set of files as http://crrev.com/c/6158152

Change-Id: I2d1fed0ea7869cb3b9315d46b51f80775939e607
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6279909
Commit-Queue: Fergal Daly <fergal@chromium.org>
Reviewed-by: Fergal Daly <fergal@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1421804}
2025-02-18 23:29:40 -08:00
Lei Zhang
52844bf425 Defining compile-time constants correctly in headers in //content
Follow the guidance in [1] and switch from "static constexpr" to
"inline constexpr".

[1] https://docs.google.com/document/d/1LVfOmlmry5rzbq6iiBSDmyAAvOxM1KpNqKUlyf0inCY/edit

NO_IFTTT=No functional change

Change-Id: I7f3ef419204f45d385767b52160399d1ab7ab883
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6267848
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1420613}
2025-02-14 10:59:37 -08:00
Tanuj Martolia
4422a53b46 IDB: Implement IndexedDB database clean up during an active session.
The previous database cleaner (tombstone sweeper and db compaction)
used to occur only during database connection closure. This caused a
variety of performance issue where the tombstones could pile up within
the session or would not be cleaned as the browser would also close
when the connection closed.

This CL introduces a clean up routine which can run while the database
connection is active. The routine consists of both tombstone sweeping
and compaction, and will be triggered (after a delay) any time a cursor
encounters enough tombstones while iterating.

The task for clean up will be postponed if there are any active
transactions. We will also trigger the run regardless of oncoming calls
when an upper limit of the time has passed since the last run.

Bug: 374691835
Change-Id: I4596514086ccb1e045f573d25095c3f3cd273de2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5948643
Reviewed-by: Abhishek Shanthkumar <abhishek.shanthkumar@microsoft.com>
Reviewed-by: Steve Becker <stevebe@microsoft.com>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Tanuj Martolia <tamartol@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1418535}
2025-02-11 02:23:46 -08:00
Garima Chadha
4c165d4ba7 IDB: Ensure proper cleanup of BlobJournal on transaction abort
Resolved disk space leaks by ensuring that StartJournalCleaningTimer()
is called during rollbacks. This triggers
CleanRecoveryJournalIgnoreReturn, effectively cleaning disk space
after transaction aborts.

Bug: 41460842
Change-Id: Ieb4a8a431cc1f124f489eef59ed67e104aeadd39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5904411
Commit-Queue: Garima Chadha <garimachadha@microsoft.com>
Auto-Submit: Garima Chadha <garimachadha@microsoft.com>
Reviewed-by: Abhishek Shanthkumar <abhishek.shanthkumar@microsoft.com>
Reviewed-by: Steve Becker <stevebe@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1418480}
2025-02-10 22:12:31 -08:00
Evan Stade
e0c5db7c5a IDB: Fix BlobReader lifetime issue.
The test case in the report fetches a blob from IDB and then creates
a new blob that contains that blob (as an array of length 1). Since
the IDB blob is wrapped in another blob, the blob registry effectively
adds a ref to the BlobDataItemReader connection. Then the javascript
blob which corresponds to the IDB blob is eventually garbage
collected*, which causes receivers_ to disconnect and then
`registry_blob_` to be unbound. Then the same blob is retrieved from
IDB again. BucketContext cleverly (or annoyingly) reuses the existing
BlobReader, but this time there's no placeholder registry blob left,
so when the page tries to create a nested blob yet again, the blob
registry errors out in a way that kills the tab process.

Fix this by re-establishing the placeholder blob when the new
mojo connection to the renderer is added. An alternative would be to
not reuse the BlobReader when serving different IDB queries.

*the issue reporter mentioned clicking "open file" 27 times, but the
key is just to do it a couple times then wait for GC to occur, then
one more time.

Bug: 392376370
Change-Id: Icaeac9bcbcda891a79f86c40469f1ab4e1d9b39c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6216397
Reviewed-by: Steve Becker <stevebe@microsoft.com>
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: Abhishek Shanthkumar <abhishek.shanthkumar@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1415908}
2025-02-04 16:30:27 -08:00
David Sanders
e08f4ba622 Remove unused includes of //base/auto_reset.h
Bug: 40318405
Change-Id: I15de488d3e212890676663be541bde4b4882487a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6219668
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414364}
2025-01-31 13:07:15 -08:00
AbdAlRahman Gad
c8503b3e75 use std::end instead of + std::size in indexed_db_leveldb_coding_unittest.cc
Bug: 392116519
Change-Id: Ib84877baa70d05a04f73207721b3aaf08f220774
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6198228
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1413367}
2025-01-30 01:28:49 -08:00
Tom Sepez
8726d30ed0 Suppress unsafe_libc_call warning for initial identified files.
See docs/unsafe_buffers.md for details. Enforcement is not yet
enabled, but this set of files are not in compliance with the
new warnings.

Bug: 390223051
Change-Id: I4e24c2141b9399f572678302c833947494098b29
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6187925
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412673}
2025-01-28 18:11:08 -08:00
Peter Kasting
1557e5fbe4 [cleanup] Replace base::ranges with std::ranges: content/
Done entirely with `git grep` and `sed` + `git cl format`, no
hand-editing.

Bug: 386918226
Change-Id: I8561612cb02c9d62c455836dba414ab402e40694
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6199140
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412009}
2025-01-27 17:14:08 -08:00
Evan Stade
37a57eab09 IDB: don't crash on BlobReader::CaptureSnapshot().
Crash stacks don't directly point at this method, but it seems that's a
result of code folding, i.e. some other function that also has a body
of just `NOTREACHED()` is in the crash stack. Thus, this seems like the
most likely culprit.

Still unclear from code inspection how this path would ever be triggered
but the new version should hopefully confirm the problematic function
and also not crash.

Bug: 390586616
Change-Id: I1b2883584aaac5c5b91c66945dfa5a7c2f300801
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6202351
Reviewed-by: Steve Becker <stevebe@microsoft.com>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1411813}
2025-01-27 12:18:41 -08:00
Ayu Ishii
f16762139b Update Storage Owners
This change updates storage code areas to new storage owners.

Change-Id: If00d3a225a98a821e8da4ad58f622ce3ecc3f47f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6158152
Reviewed-by: Fergal Daly <fergal@chromium.org>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1404489}
2025-01-09 16:03:43 -08:00
Evan Stade
8c6ddfd64a IDB: make lock management a little more efficient
Makes checking for blocked transactions a bit more efficient.

Bug: 384476946
Change-Id: I821e9acf2e3554393f7665ef713bb3537c92cc3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6133080
Reviewed-by: Abhishek Shanthkumar <abhishek.shanthkumar@microsoft.com>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1402454}
2025-01-06 09:41:10 -08:00
Evan Stade
1c9524c5d3 Reapply "IDB: direct reads for blobs"
This relands commit 60632268ea.

Difference to original: added support for AsDataPipeGetter and
extended blob-contenttype.any.js WPT to cover this case.

Original change's description:
> IDB: direct reads for blobs
>
> For the standard case of a page reading IDB data from the blob store,
> don't go through the blob registry on the i/o thread and instead
> connect the IDB bucket thread directly to the renderer.
>
> In some other (rarer) cases the blob registry is still used. This
> is accomplished by *additionally* registering a blob with
> BlobStorageContext using the same UUID, which is necessary for:
>
> * WriteBlobToFile(), which does lookup by UUID
> * loading data for a blob:// URL, i.e. mojom::Blob::Load, which is
>   thunked through to the registry blob because implementation is non-
>   trivial
>
> Bug: 373684390
> Change-Id: I9235f23303e4e6a05bf12a8acff32a5fb4e2a565
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6113789
> Commit-Queue: Evan Stade <estade@chromium.org>
> Reviewed-by: Steve Becker <stevebe@microsoft.com>
> Cr-Commit-Position: refs/heads/main@{#1400627}

Bug: 373684390
Change-Id: Ie555cf4b583b862d306c43e3e4be76e957ea6c5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6138579
Reviewed-by: Steve Becker <stevebe@microsoft.com>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1401872}
2025-01-03 10:11:28 -08:00
Evan Stade
64ff3634b7 Revert "IDB: direct reads for blobs"
This reverts commit 60632268ea.

Reason for revert: causing crashes (see crbug.com/386615753)

Original change's description:
> IDB: direct reads for blobs
>
> For the standard case of a page reading IDB data from the blob store,
> don't go through the blob registry on the i/o thread and instead
> connect the IDB bucket thread directly to the renderer.
>
> In some other (rarer) cases the blob registry is still used. This
> is accomplished by *additionally* registering a blob with
> BlobStorageContext using the same UUID, which is necessary for:
>
> * WriteBlobToFile(), which does lookup by UUID
> * loading data for a blob:// URL, i.e. mojom::Blob::Load, which is
>   thunked through to the registry blob because implementation is non-
>   trivial
>
> Bug: 373684390
> Change-Id: I9235f23303e4e6a05bf12a8acff32a5fb4e2a565
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6113789
> Commit-Queue: Evan Stade <estade@chromium.org>
> Reviewed-by: Steve Becker <stevebe@microsoft.com>
> Cr-Commit-Position: refs/heads/main@{#1400627}

Bug: 373684390,386615753
Change-Id: I8e7460b58c175d9cbd62e99845dd68c71ef6dd06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6132793
Auto-Submit: Evan Stade <estade@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1400977}
2024-12-30 11:41:28 -08:00
Evan Stade
60632268ea IDB: direct reads for blobs
For the standard case of a page reading IDB data from the blob store,
don't go through the blob registry on the i/o thread and instead
connect the IDB bucket thread directly to the renderer.

In some other (rarer) cases the blob registry is still used. This
is accomplished by *additionally* registering a blob with
BlobStorageContext using the same UUID, which is necessary for:

* WriteBlobToFile(), which does lookup by UUID
* loading data for a blob:// URL, i.e. mojom::Blob::Load, which is
  thunked through to the registry blob because implementation is non-
  trivial

Bug: 373684390
Change-Id: I9235f23303e4e6a05bf12a8acff32a5fb4e2a565
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6113789
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: Steve Becker <stevebe@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1400627}
2024-12-27 19:12:42 -08:00
Evan Stade
0571ed0164 IDB: refactor blob reading code
This CL moves the wrapper that reads files from disk on behalf of the
blob registry into its own file. No behavioral change is intended.

Bug: 373684390
Change-Id: Ib486c5c5cab180edc3ccb0d0df5d45c483352401
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5942488
Auto-Submit: Evan Stade <estade@chromium.org>
Reviewed-by: Steve Becker <stevebe@microsoft.com>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1400548}
2024-12-27 11:22:26 -08:00
Evan Stade
c4427686f6 IDB: clean up some details of BackingStore declarations
* remove unused `virtual` modifier
* tighten access modifiers

Bug: none
Change-Id: I1f432ef7fabd905b47c11031fc8ca7cad92640e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6110166
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: Steve Becker <stevebe@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1400068}
2024-12-24 10:01:15 -08:00
Evan Stade
22e7091615 IDB - log metrics to track down shutdown hangs
These metrics are intended to shed more light on some operations
that could be executing slowly, based on observed shutdown hangs.

Low-Coverage-Reason: temporary metrics for debugging
Bug: 384476946

Change-Id: I80f5227f320ba3652978e43aab51400b47ad756e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6120590
Reviewed-by: Brad Triebwasser <btriebw@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Owners-Override: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1399966}
2024-12-23 18:59:39 -08:00
Steve Becker
8b2604b0f9 [IndexedDB] Make OpenFileAndReadIntoPipe succeed when fewer bytes read
The following changed `content::indexed_db::OpenFileAndReadIntoPipe()`
behavior:

https://chromium-review.googlesource.com/c/chromium/src/+/5898304

Prior to the change, `OpenFileAndReadIntoPipe()` considered reading up
to N bytes as success.  After the change, `OpenFileAndReadIntoPipe()`
must read exactly N bytes to succeed.  When expecting more bytes,
`FileStreamReaderToDataPipe` reads the end of file instead, which is
handled differently than before.

Before:

After reading end of file, `FileStreamReaderToDataPipe::ReadMore()`
calls `OnComplete(result)`.  `result` is 0 since it is end of file.
0 is also the status code for `net::OK`, which causes the read to
succeed.

After:

`FileStreamReaderToDataPipe::ReadMore()` calls
`OnComplete(net::ERR_FAILED)` in response to reading end of file.

The fix restores the original behavior and adds unit test coverage.

Bug: 383157185
Change-Id: I0b976252331209d0453cbef14be5b1e3b24e8c90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6102095
Reviewed-by: Rahul Singh <rahsin@microsoft.com>
Commit-Queue: Steve Becker <stevebe@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1398772}
2024-12-19 11:59:39 -08:00
Patrick Monette
6cf4c37f9d [Tab Freezing] Proposal to track blocking IndexedDB transactions
Right now, tab freezing is based on the existence of an IndexedBD
connection. This is too conservative. Telemetry data shows that a
large number of tabs are opted-out of tab freezing because of
IndexedDB.

With this change, tabs are only opt-out if they are running
a IDB transaction that actually blocks another client. This is done
by refactoring the DisallowInactiveClient() functionality to also
handle frozen documents.

The existing ObservedFeatureType named kIndexedDBConnection is
renamed to kBlockingIndexedDBLock to track this scenario, which
is then used to opt-out the tab from freezing.

Bug: 362464956
Change-Id: If455789e900c232813d045b831e937a042a334c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5838043
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Owners-Override: Patrick Monette <pmonette@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1398627}
2024-12-19 09:11:12 -08:00
Georg Neis
35ff854b7e Remove Lacros leftovers from content/browser, part 2
Main changes:
- Replace IS_CHROMEOS_ASH with the equivalent IS_CHROMEOS
- Remove obsolete build flag includes/dependencies

Bug: b:354842935
AX-Relnotes: n/a.
Change-Id: I079b003a4664a7a3f7281905323611b6fc4fe3da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6090635
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1397108}
2024-12-16 18:02:08 -08:00
Evan Stade
0f6214f5fc IDB: remove expired TimeActive histograms
WebCore.IndexedDB.Transaction.*.TimeActive are expired and have been
superseded by  WebCore.IndexedDB.Transaction.*.TimeActive2

Bug: 376055331
Change-Id: I86dd3b5b0160253fc26c654979e2d28e7930c283
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6098470
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1396905}
2024-12-16 12:06:43 -08:00
Peter Kasting
e35c25c247 Make byte spans check for unique obj representations.
Bug: 382041497
Low-Coverage-Reason: LARGE_SCALE_REFACTOR no meaningful change in the relevant files
Change-Id: I06ab9d00e9405ede4664f1c12dad748ae9be5b1b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6092555
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1396409}
2024-12-14 14:31:26 -08:00
Mike Wasserman
7007d46b8e Revert "Make byte spans check for unique obj representations."
This reverts commit 6408cb7bad.

Reason for revert: Suspected for build failure:
https://ci.chromium.org/ui/p/chromium/builders/ci/chromeos-arm-generic-dbg/105802/blamelist
Step compile failed. Error logs are shown below:
[8013/49103] CXX obj/media/gpu/v4l2/v4l2/v4l2_mjpeg_decode_accelerator.o
../../build/cros_cache/chrome-sdk/symlinks/arm-generic+16124.0.0-1065359+target_toolchain/bin/armv7a-cros-linux-gnueabihf-clang++ -MMD -MF obj...(too long)
../../media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.cc:602:9: error: no matching function for call to 'byte_span_from_ref'
  602 |         base::byte_span_from_ref(base::allow_nonunique_obj, buffer), 0);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
../../base/containers/span.h:1562:16: note: candidate template ignored: constraints not satisfied [with T = struct v4l2_buffer]
 1562 | constexpr auto byte_span_from_ref(allow_nonunique_obj_t,
      |                ^


Original change's description:
> Make byte spans check for unique obj representations.
>
> Bug: 382041497
> Low-Coverage-Reason: LARGE_SCALE_REFACTOR no meaningful change in the relevant files
> Change-Id: Iea2e0397b770af3bfd95c05a9983f315c5bc47a7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6081833
> Owners-Override: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Commit-Queue: Peter Kasting <pkasting@chromium.org>
> Auto-Submit: Peter Kasting <pkasting@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1396262}

Bug: 382041497
Change-Id: I719601fbe366d5f7f1ed2621ae4f4de1c07e57c4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6094647
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Mike Wasserman <msw@google.com>
Commit-Queue: Mike Wasserman <msw@chromium.org>
Auto-Submit: Mike Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1396276}
2024-12-13 16:51:31 -08:00
Peter Kasting
6408cb7bad Make byte spans check for unique obj representations.
Bug: 382041497
Low-Coverage-Reason: LARGE_SCALE_REFACTOR no meaningful change in the relevant files
Change-Id: Iea2e0397b770af3bfd95c05a9983f315c5bc47a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6081833
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1396262}
2024-12-13 16:15:35 -08:00
Arthur Sonzogni
d5ce01f7ef C++11 std::array rewrite for memory safety [11/19]
Split from:
https://chromium-review.googlesource.com/c/chromium/src/+/6004959

Generated patch
---------------
- Tool: ./tool/clang/spanify/rewrite-multiple-platform.sh
- Platform: Linux.
- Filter: This includes 2400/4222 patches. I included the std::array
      ones and excluded build errors.

Google announcement:
--------------------
https://groups.google.com/a/google.com/g/chrome-memory-safety/c/RMiO4gaVLQA/m/Yz-3NCObAgAJ

Benchmarks:
----------
See design doc and
https://chromium-review.googlesource.com/c/chromium/src/+/6004959/21

Description
-----------
The consensus during the memory safety summit was to begin rewriting
relevant C-style arrays to C++11 std::array. It can be done immediately,
offers better developer ergonomics, and fix large chunks of the
-Wunsafe-buffer-usage errors in Chrome.

To clarify, this effort is complementary to the longer plan work with
enabling -fsanitize=array-bounds, and we plan to leverage both,
especially for protecting 3p code.

[Attached] is a document detailing the rationale, benefits, and
considerations for potential compile-time and performance impacts.

[Attached]:https://docs.google.com/document/d/1z5aBDg26lHmNDjXRCysElWKx7E4PAJXqykI_k7ondJI/edit?tab=t.0#heading=h.cqgo7wvp0kzt

NO_IFTTT=No need to update base/debug/stack_trace.h

Bug: 378069401
Change-Id: I6d36543c267f12c672cce00d75cf833fff238ebf
R: dcheng@chromium.org
AX-Relnotes: n/a.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6039265
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1395908}
2024-12-13 05:35:28 -08:00
Peter Kasting
18120b2254 Misc. cleanup for span constructor usage, part 1
Audited explicit calls to fixed-extent span constructor  (it + count)
and changed to less verbose forms. Also did some other misc. cleanup
locally in a few places.

Bug: none
Change-Id: I40fb6bc6e21739636ea21d588bc83f9555f9c850
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6090580
Reviewed-by: Lei Zhang <thestig@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1395560}
2024-12-12 12:16:17 -08:00
Nico Weber
59ded6fb48 Fix -Wunused-private-field warnings with new clang in Win/no-dcheck builds
Bug: 383016423
Change-Id: I5c294ba704476528f1f110ad4176beffc8667f0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6089610
Commit-Queue: Arthur Eubanks <aeubanks@google.com>
Reviewed-by: Arthur Eubanks <aeubanks@google.com>
Auto-Submit: Nico Weber <thakis@chromium.org>
Owners-Override: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1394914}
2024-12-11 09:47:24 -08:00
Peter Kasting
53094fb84d Use string/string_view more, and more directly, in encoding.
No functional change, just more idiomatic and hopefully readable.

Bug: none
Change-Id: If06f50dffad4277fafcf2f4fdd433d9d0ce745d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6079324
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Nathan Memmott <memmott@chromium.org>
Reviewed-by: Nathan Memmott <memmott@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1393754}
2024-12-09 18:07:44 +00:00
Peter Kasting
8eba25cb99 Remove usage of base::make_span(): content/browser/ part 1
Replace with span() CTAD use, or more targeted helpers.

Bug: 341907909
Low-Coverage-Reason: LARGE_SCALE_REFACTOR no meaningful functional change
Change-Id: I2635aeabe0b7eb4e8411b4579d922fccb0283784
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6059467
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1389916}
2024-11-29 22:30:10 +00:00
Tanuj Martolia
72e24c400c IDB: Remove sequence checker reference from backing store.
Sequence checker is not required any more for the backing store.
BackingStore is created, destroyed and accessed, universally on the
same thread. Cleaning up all the references in backing_store.

Bug: 379003882
Change-Id: Id8dbc420639fe40a05c99c3c5d98f028782cad9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6023256
Reviewed-by: Abhishek Shanthkumar <abhishek.shanthkumar@microsoft.com>
Reviewed-by: Evan Stade <estade@chromium.org>
Commit-Queue: Tanuj Martolia <tamartol@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1384788}
2024-11-19 06:48:35 +00:00
Patrick Monette
d32aa3d9d7 [IndexedDB] Treat frozen clients as inactive
Before this CL, a client is inactive iff it is inside the BF cache.

To support freezing, IDBDatabase now listens for the
ContextLifecycleStateChanged notification, which invokes
DidBecomeInactive when the frame is frozen, just like when the
frame enters BFCache.

In addition, whenever a transaction ends, we check if any of the
remaining transactions are blocking other clients to determine if
the client is now eligible for freezing.

Bug: 362464956
Change-Id: I4d8092bef3189e4d42124c2cb169015570e5df96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5958727
Commit-Queue: Charlie Reis <creis@chromium.org>
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Reviewed-by: Evan Stade <estade@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Auto-Submit: Patrick Monette <pmonette@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1382575}
2024-11-13 21:12:31 +00:00
dpapad
cab7186055 IndexedDB Internals: Migrate from jstemplate to Lit templates.
This is part of the effort to fully remove the obsolete
third_party/jstemplate dependency from the repository.

Bug: 40433145
Change-Id: Ied9806fa9812bdc0ea115c73c3489ea657d79215
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6006524
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: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1381440}
2024-11-11 22:42:21 +00:00