Commit graph

67 commits

Author SHA1 Message Date
Oluwatobi Sofela
2789e98876
clippy: Fix redundant field names warnings (#31793) 2024-03-20 23:05:29 +00:00
Rosemary Ajayi
058319aa0b
clippy: Fix some clippy problems in components/script (#31778)
* fix clippy problems in stylesheet

* fix clippy problems in task_manager

* fix clippy problems in task_queue

* fix clippy problems in task_queue

* fix clippy problems in file_reading

* fix clippy problems in dom_manipulation

* fix clippy problems in gamepad

* fix clippy problems in networking

* fix clippy problems in performance

* fix clippy problems in port_message

* fix clippy problems in port_message

* fix clippy problems in timer

* fix clippy problems in stylesheet

* fix clippy problems

* fix clippy problems

* fix clippy problems
2024-03-20 18:41:07 +00:00
Daniel Adams
c999d4546c
Implement non-XR Gamepad discovery and input (#31200)
* Create embedder event to send to constellation

* Handle gamepad message in constellation, send to script thread

* Handle GamepadEvent in script thread and dispatch event to document

* Add missing Clones, fix event

* Add gamepad task source

* Adjust GamepadIndex type, remove unused imports

* Add internal getter for gamepads list

* Update gamepad new methods

* Handle gamepad connect and disconnect events

* Proto will be none, no need for HandleObject

* Initialize buttons and axes to standard mapping

* Adjust update type index types

* Update GamepadButton update function

* Adjust Gamepad mapping comments to match spec, add update logic

* Amend comment

* Update button and axis inputs on Updated event

* Add GilRs as gamepad backend in servoshell

* Add spec links, queue gamepad updates on task source

* ./mach fmt

* Fix comment length

* Split out button init, update spec comments

* Move gamepad event handling from document to global

* Map and normalize axes/button values

* Use std::time for gamepad timestamp

* Adjust gamepad handling in event loop

* Move button press/touch check into map+normalize function

- Small change but is more in line with spec

* ./mach fmt

* Update comment spec links and warning messages

* Doc comments -> regular comments

* Add window event handlers for gamepad connect/disconnect

* Adjust gamepad disconnect behavior

* Add missing TODO's, adjust gamepad/gamepadbutton list methods and formatting

* Update button handling from gilrs, add comments

* Enable gamepad pref during WPT tests and update expectations

* Update WPT expectations in meta-legacy-layout
2024-02-17 18:42:31 +00:00
Martin Robinson
5c1723c983
rustdoc: Fix many rustdoc errors (#31147)
This fixes many rustdoc errors that occur due to raw URLs in rustdoc
comments as well as unescaped Rust code that should be in backticks.
2024-01-22 13:13:48 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
9514f670d1
No tracing of nop traceable fields (#29926)
* 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
2023-08-04 10:17:43 +00:00
Gregory Terzian
ed88a67cca remove unnecessary thread in filereader, add stream TODO 2019-12-10 14:55:22 +08:00
Gregory Terzian
50a7111eb6 impl timer-task-source, dedicated time-out mechanism for service-worker 2019-11-19 14:32:21 +08:00
Gregory Terzian
2f8932a6a1 continue messageport, transferable, postmessage options 2019-10-19 14:28:18 +08:00
Keith Yeung
c3b17c1201 begin messageport, transferable objects, impl
Accept transfer argument for StructuredCloneData::write

Allow structured clone reads to return a boolean

Add Transferable trait

Add basic skeletons to MessagePort

Implement transfer and transfer-receiving steps on MessagePort

Use transfer and transfer_receive in StructuredClone callbacks

Implement MessageChannel

Freeze the array object for the MessageEvent ports attribute

Implement transfer argument on window.postMessage

Use ReentrantMutex instead for MessagePortInternal

Accept origin as a parameter in dispatch_jsval

Fix BorrowMut crash with pending_port_message

Detach port on closure and check for detached during transfer

Enable webmessaging tests

fix webidl

fix
2019-10-19 14:12:22 +08:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Bastien Orivel
9a7eeb349a Update crossbeam-channel to 0.3 2018-11-18 19:33:19 +01:00
Agustin Chiappe Berrini
75eb94afca Unify the task source and task canceller API
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)
2018-11-14 06:36:44 -05:00
Agustin Chiappe Berrini
14bc8ab754 Implement TaskSource for HistoryTraversal
And remove the method in window that returns it, because it isn't used
so far.
2018-11-13 14:18:51 -05:00
Simon Sapin
2012be4a8b cargo fix --edition-idioms 2018-11-08 09:28:00 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Simon Sapin
76e59a46d3 Sort use statements 2018-11-06 15:26:02 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
CYBAI
42903412c7 Make first argument of DOMManipulationTaskSource as a Box<ScriptChan +
Send>

We don't have `window` for `workers`. So, if we use `global.as_window()`
to get the DOMManipulationTaskSource, it will make worker panic.
Instead, we should get the DOMManipulationTaskSource from each own
thread.

Ref: https://github.com/servo/servo/pull/20755#discussion_r193557746
2018-10-18 19:13:23 +08:00
chansuke
7b3cf27c69 Add task source for media element 2018-10-10 22:15:37 +09:00
chansuke
c37a345dc9 Format script component 2018-09-19 17:40:47 -04:00
Simon Sapin
2a996fbc8f Replace mpsc with crossbeam/servo channel, update ipc-channel
Co-authored-by: Gregory Terzian <gterzian@users.noreply.github.com>
2018-09-12 13:33:32 +08:00
Agustin Chiappe Berrini
5dd6e21c2e Add Websocket task source
According to the doc: https://html.spec.whatwg.org/multipage/web-sockets.html#network

The task source for all tasks queued in the websocket section are the
websocket task source, so this commit also updates those references to
use the appropriate one.
2018-09-08 17:01:27 -04:00
Agustin Chiappe Berrini
e286fdcc53 Add the TaskSourceName to CommonScriptMsg::Task
Update QueuedTaskConversion and the TaskQueue to use it
2018-09-04 09:17:11 -04:00
Gregory Terzian
baef63becd use remote-event task source in EventSource 2018-07-13 13:56:46 +08:00
Gregory Terzian
671627e97e introduce "per task source" ignoring of tasks 2018-07-10 13:42:28 +08:00
ddh
52b63def44 added pipelines to all task sources
changed task sources to accept pipeline ids
2017-10-25 14:25:58 +01:00
ddh
2ffbe53989 added time to interactive metrics, refactored metrics to use traits
changed task macro to take pipeline info
2017-10-24 21:02:56 +01:00
Simon Sapin
aa15dc269f Remove use of unstable box syntax.
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.
2017-10-16 17:16:20 +02:00
Anthony Ramine
6c9fb5ae7a Introduce TaskOnce
Having both TaskBox and TaskOnce allows us to remove the superfluous inner boxing
from CancellableTask<T>.
2017-09-20 10:37:09 +02:00
Anthony Ramine
52527d6f9d Rename Task to TaskBox 2017-09-20 10:07:29 +02:00
Anthony Ramine
f088b708c9 Make Task require Send 2017-09-20 09:40:53 +02:00
Anthony Ramine
99ff976e85 Use task! to notify performance observers 2017-09-18 10:54:11 +02:00
Anthony Ramine
46628fba05 Move Task to its own module 2017-09-18 02:47:04 +02:00
Anthony Ramine
8e78f18d2d Introduce MainThreadScriptMsg::DispatchJobQueue
This removes the last remaining use of Task::run_with_script_thread
2017-09-17 10:46:00 +02:00
Anthony Ramine
9a267e53fe Send AsyncJobHandler as a MainThreadTask 2017-09-16 15:43:33 +02:00
Anthony Ramine
4a39631eaf Remove FileReadingRunnable 2017-09-16 15:43:31 +02:00
Anthony Ramine
56117d3185 Rename Runnable to Task
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`.
2017-09-16 15:43:26 +02:00
Anthony Ramine
53d30d85b3 Reformat some task-related functions 2017-09-08 10:19:06 +02:00
Anthony Ramine
35a7252254 Kill UserInteractionTask
Just use a bare Runnable value.
2017-09-08 10:17:23 +02:00
Anthony Ramine
9252f2b8a2 Kill DOMManipulationTask
Just use a bare Runnable value.
2017-09-08 10:06:18 +02:00
Anthony Ramine
17a1dd9385 Kill Runnable::is_cancelled ⚔️ 2017-09-07 14:54:03 +02:00
Fernando Jiménez Moreno
fb843c251a Make Performance Timeline API work in Workers 2017-09-05 17:07:15 +02:00
Clément DAVID
c5fe235112 order derivable traits lists
Ignoring :
 - **generated**.rs
 - python/tidy/servo_tidy_tests/rust_tidy.rs
2017-08-23 21:38:44 +02:00
Fernando Jiménez Moreno
52348f1fcc Performance Timeline API 2017-08-17 11:48:34 +02:00
Alan Jeffrey
a47e94c8f6 Added Debug implementations. 2017-06-13 10:46:59 -05:00
Keith Yeung
72cb856e31 Properly implement TaskSource for NetworkingTaskSource 2016-11-11 14:50:42 -08:00
Simon Sapin
53b638c0e2 Update to string-cache 0.3 2016-11-03 16:23:05 +01:00
Anthony Ramine
44ca9f3d71 Make TaskSource::queue take a &GlobalScope 2016-10-06 21:35:52 +02:00
Anthony Ramine
514819f37a Introduce GlobalScope::get_runnable_wrapper 2016-10-06 21:35:51 +02:00