
The CL cleans up issues within LazyContextId and how it's used. 1. LazyContextId currently stores the service worker scope for instances created for a service worker-based extension. Since we only ever register the extension's script at the root scope, there's no need to store this, since it can be inferred from the extension's ID. 2. ServiceWorkerTaskQueue::SequencedContextId is a std::pair containing a LazyContextId and a base::UnguessableToken that's generated when the queue tries to activate the service worker. This CL changes this to a struct with named fields for clarity. It also only stores the extension's ID and the BrowserContext from the LazyContextId, since that's all that's needed. 3. There are places where LazyContextId instances are created and the type of the instance (for and EventPage-based extension or a service worker-based extension) is inferred from the constructor used. Since the scope is no longer saved, there is no longer a need for unique constructors and the type cannot be inferred. This CL adds static member functions that are clearly named and create the expected type of LazyContextId. There is also an option to create one for an extension where the function determines the type of LazyContextId based on the extension. This is the safest and clearest way, so many call sites are migrated to use this static member function. Bug: None Change-Id: If40c9a7fa9fa0148bb2d1b0faa7f988a18dfe654 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5050418 Reviewed-by: Fabian Sommer <fabiansommer@chromium.org> Reviewed-by: Ben Reich <benreich@chromium.org> Reviewed-by: Trent Apted <tapted@chromium.org> Auto-Submit: David Bertoni <dbertoni@chromium.org> Commit-Queue: David Bertoni <dbertoni@chromium.org> Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org> Cr-Commit-Position: refs/heads/main@{#1236662}
Chromium
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone
! Instead,
follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.