aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/storage.rs
Commit message (Collapse)AuthorAgeFilesLines
* Move `ScriptToConstellationMsg` to `constellation_traits` (#36364)Martin Robinson2025-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is the last big change necessary to create the `constellation_traits` crate. This moves the data structure for messages that originate from the `ScriptThread` and are sent to the `Contellation` to `constellation_traits`, effectively splitting `script_traits` in half. Before, `script_traits` was responsible for exposing the API of both the `ScriptThread` and the `Constellation` to the rest of Servo. - Data structures that are used by `ScriptToConstellationMsg` are moved to `constellation_traits`. The dependency graph looks a bit like this: `script_layout_interface` depends on `script_traits` depends on `constellation_traits` depends on `embedder_traits`. - Data structures that are used in the embedding layer (`UntrustedNodeAddress`, `CompositorHitTestResult`, `TouchEventResult` and `AnimationState`) are moved to embedder_traits, to avoid a dependency cycle between `webrender_traits` and `constellation_traits`. - Types dealing with MessagePorts and serialization are moved to `constellation_traits::message_port`. Testing: This is covered by existing tests as it just moves types around. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* constellation: Rename messages sent to the `Constellation` (#36341)Martin Robinson2025-04-041-2/+4
| | | | | | | | | | | | | | | | | | | | Messages that are sent to the `Constellation` have pretty ambiguous names. This change does two renames: - `ConstellationMsg` → `EmbedderToConstellationMessage` - `ScriptMsg` → `ScriptToConstellationMessage` This naming reflects that the `Constellation` stands in between the embedding layer and the script layer and can receive messages from both. Soon both of these message types will live in `constellation_traits`, reflecting the idea that the `_traits` variant for a crate is responsible for exposing the API for that crate. Testing: No new tests are necessary here as this just renames two enums. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-2/+2
| | | | | | | | | | | | | * Use 2024 style edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Reformat all code Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Propagate `CanGc` arguments through callers in constructors (#35541)Auguste Baum2025-02-201-2/+6
| | | Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
* Move various reflector types and traits to script_bindings (#35279)Josh Matthews2025-02-041-1/+1
| | | | | | | | | | | | | * script: Move Reflector to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Extract global() helper from DomObject into new trait. Move DomObject and related traits to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Limit public exports. (#34915)Josh Matthews2025-01-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Restrict reexport visibility of DOM types. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Mass pub->pub(crate) conversion. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Hide existing dead code warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix unit tests. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * More formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Unsilence all main thread `TaskQueue` errors (#34849)Martin Robinson2025-01-071-6/+4
| | | | | | | | | | | | No longer hide errors while queueing tasks on the main thread. This requires creating two types of `TaskSource`s: one for the main thread and one that can be sent to other threads. This makes queueing a bit more efficient on the main thread and more importantly, no longer hides task queue errors. Fixes #25688. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* script: Move `TaskManager` to `GlobalScope` (#34827)Martin Robinson2025-01-041-21/+17
| | | | | | | | | | | | | | | | | | | | This is a simplification of the internal `TaskQueue` API that moves the `TaskManager` to the `GlobalScope` itself. In addition, the handling of cancellers is moved to the `TaskManager` as well. This means that no arguments other than the `task` are necessary for queueing tasks, which makes the API a lot easier to use and cleaner. `TaskSource` now also keeps a copy of the canceller with it, so that they always know the proper way to cancel any tasks queued on them. There is one complication here. The event loop `sender` for dedicated workers is constantly changing as it is set to `None` when not handling messages. This is because this sender keeps a handle to the main thread's `Worker` object, preventing garbage collection while any messages are still in flight or being handled. This change allows setting the `sender` on the `TaskManager` to `None` to allow proper garbabge collection. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: Eliminate code duplication in the task queue (#34798)Martin Robinson2025-01-011-1/+0
| | | | | | | | | | | | | | | | Instead of creating a type for each `TaskSource` variety have each `TaskSource` hold the same kind of sender (this was inconsistent before, but each sender was effectively the same trait object), a pipeline, and a `TaskSourceName`. This elminates the need to reimplement the same queuing code for every task source. In addition, have workers hold their own `TaskManager`. This allows just exposing the manager on the `GlobalScope`. Currently the `TaskCanceller` is different, but this will also be eliminated in a followup change. This is a the first step toward having a shared set of `Sender`s on `GlobalScope`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Add CanGc argument to reflect_dom_object (#34606)Domenico Rizzo2024-12-131-1/+5
| | | | | | | | | | | | | | | | | | | | | * applied mach fmt Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> Refinements Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> Modified reflect_dom_object signature and all its calls Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * fix function calls when parameter is passed up Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> --------- Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
* Generate a trait abstracting over all known DOM interfaces (#34357)Josh Matthews2024-11-241-1/+1
| | | | | | | | | | | | | | | | | * script: Generate trait for all DOM interfaces and parameterize generated Methods traits over it. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Update trait implementations with new generic type. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* cangc fixes in several files + event.rs + rtcpeerconnection.rs (#34002)chickenleaf2024-10-251-1/+1
| | | Signed-off-by: L Ashwin B <lashwinib@gmail.com>
* Various CanGc fixes in 8 files (#33893)chickenleaf2024-10-181-0/+2
| | | | | | | | | | | | | * Various CanGc fixes in 8 files Signed-off-by: L Ashwin B <lashwinib@gmail.com> * fixed merge conflicts and formatting Signed-off-by: L Ashwin B <lashwinib@gmail.com> --------- Signed-off-by: L Ashwin B <lashwinib@gmail.com>
* clippy: Fix redundant field names warnings (#31793)Oluwatobi Sofela2024-03-201-1/+1
|
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-7/+8
| | | | | * strict imports formatting * Reformat all imports
* No tracing of nop traceable fields (#29926)Samson2023-08-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add `no_trace` option to JSTraceable derive * NoTrace wrapper * Port some types to no_trace schematics * Fixing my unsafe mistakes (not tracing traceables) * Add docs & safety guards for no_trace Safety guards (trait shenanigans) guarantees safety usage of `no_trace` * Port canvas_traits to no_trace * Port servo_media to no_trace * Port net_traits to no_trace * Port style to no_trace * Port webgpu to no_trace * Port script_traits to no_trace * Port canvas_traits, devtools_traits, embedder_traits, profile_traits to no_trace * unrooted_must_root lint in seperate file * Add trace_in_no_trace_lint as script_plugin * Composable types in must_not_have_traceable * Introduced HashMapTracedValues wrapper * `HashMap<NoTrace<K>,V>`->`HashMapTracedValues<K,V>` * Port rest of servo's types to no_trace * Port html5ever, euclid, mime and http to no_trace * Port remaining externals to no_trace * Port webxr and Arc<Mutex<_>> * Fix spelling in notrace doc
* Add trait DomObjectWrap to provide WRAP functionYUAN LYU2020-03-201-6/+1
|
* Rustfmt has changed its default style :/Simon Sapin2018-12-281-15/+15
|
* Update MPL license to https (part 3)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* Unify the task source and task canceller APIAgustin Chiappe Berrini2018-11-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | I moved away from the `Window` struct all the logic to handle task sources, into a new struct called `TaskManager`. In a happy world, I'd be able to just have there two functions, of the types: ```rust fn task_source<T: TaskSource>(&self, name: TaskSourceName) -> Box<T> fn task_source_with_canceller<T: TaskSource>(&self, name: TaskSourceName) -> (Box<T>, TaskSourceCanceller) ``` And not so much duplicated code. However, because TaskSource can't be a trait object (because it has generic type parameters), that's not possible. Instead, I decided to reduce duplicated logic through macros. For reasons[1], I have to pass both the name of the function with canceller and the name of the function without, as I'm not able to concatenate them in the macro itself. I could probably use `concat_idents` to create both types already defined and reduce the amount of arguments by one, but that macro is nightly only. At the same time, not being able to declare macros inside `impl` forces me to pass `self` as an argument. All this makes this solution more verbose than it would be ideally. It does reduce duplication, but it doesn't reduce the size of the file. [1](https://github.com/rust-lang/rust/issues/29599)
* Reorder importsPyfisch2018-11-061-2/+2
|
* Format remaining filesPyfisch2018-11-061-5/+10
|
* Sort `use` statementsSimon Sapin2018-11-061-1/+1
|
* `cargo fix --edition`Simon Sapin2018-11-061-12/+12
|
* Format script componentchansuke2018-09-191-29/+68
|
* Implements profiler for blocked recvNakul Jindal2018-03-221-8/+9
|
* Fix commonmark Markdown warnings in docs, part 1Matt Brubeck2017-10-171-2/+2
| | | | | | | | Fixes warnings from rust-lang/rust#44229 when `--enable-commonmark` is passed to rustdoc. This is mostly a global find-and-replace for bare URIs on lines by themselves in doc comments.
* Remove use of unstable box syntax.Simon Sapin2017-10-161-1/+1
| | | | | | | | | | | | | | | | | | | | http://www.robohornet.org gives a score of 101.36 on master, and 102.68 with this PR. The latter is slightly better, but probably within noise level. So it looks like this PR does not affect DOM performance. This is expected since `Box::new` is defined as: ```rust impl<T> Box<T> { #[inline(always)] pub fn new(x: T) -> Box<T> { box x } } ``` With inlining, it should compile to the same as box syntax.
* Rename Root<T> to DomRoot<T>Anthony Ramine2017-09-261-2/+2
| | | | | | | In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>, where Root<T> will be able to handle all the things that need to be rooted that have a stable traceable address that doesn't move for the whole lifetime of the root. Stay tuned.
* Rename dom::bindings::js to dom::bindings::rootAnthony Ramine2017-09-261-1/+1
|
* Introduce TaskOnceAnthony Ramine2017-09-201-1/+1
| | | | | Having both TaskBox and TaskOnce allows us to remove the superfluous inner boxing from CancellableTask<T>.
* Use task! to send a storage notificationAnthony Ramine2017-09-181-31/+14
|
* Move Task to its own moduleAnthony Ramine2017-09-181-1/+1
|
* Rename Runnable to TaskAnthony Ramine2017-09-161-5/+5
| | | | | | | | | | | | The changes are: * `*Runnable` -> `*Task`; * `RunnableMsg` -> `Task`; * `RunnableWrapper` -> `TaskCanceller`; * `MainThreadRunnable` -> `MainThreadTask`; * `wrap_runnable` -> `wrap_task`; * `get_runnable_wrapper` -> `task_canceller`; * `handler` -> `run`; * `main_thread_handler` -> `run_with_script_thread`.
* Clean up Storage::queue_storage_eventAnthony Ramine2017-09-161-45/+44
| | | | | This moves the Runnable type directly in the method and makes it not use main_thread_handler, which is unneeded here anyway.
* move name implementation as default implementation to the trait and remove ↵toidiu2017-09-031-2/+0
| | | | overrides.
* make use of ScriptToConstellationChanPaul Rouget2017-08-151-3/+2
|
* Make #[dom_struct] a proc_macro attributeAnthony Ramine2017-02-241-0/+1
|
* Only expose Storage/StorageEvent in WindowJavier Rueda2017-02-091-3/+3
|
* Rename `Reflectable` to `DomObject`.Corey Farwell2016-12-081-1/+1
| | | | Fixes https://github.com/servo/servo/issues/8473.
* Urlmageddon: Use refcounted urls more often.Emilio Cobos Álvarez2016-11-171-5/+5
|
* Storage notifications routed via the constellation.Alan Jeffrey2016-11-151-19/+20
|
* Replace script thread root browsing context by a collection of documents.Alan Jeffrey2016-11-081-9/+10
|
* Remove intrinsic Root::r()Anthony Ramine2016-10-111-5/+3
|
* Rename Reflectable::global_scope to globalAnthony Ramine2016-10-061-4/+4
|
* Make TaskSource::queue take a &GlobalScopeAnthony Ramine2016-10-061-5/+6
|
* Introduce GlobalScope::resource_threadsAnthony Ramine2016-10-061-1/+1
|
* Introduce GlobalScope::as_windowAnthony Ramine2016-10-061-4/+2
|
* Introduce GlobalScope::get_urlAnthony Ramine2016-10-061-3/+1
|
* Introduce Reflectable::global_scopeAnthony Ramine2016-10-061-5/+3
|