Commit graph

78 commits

Author SHA1 Message Date
Anthony Urena
ef0e93c9b1 Updates Bluetooth type to use BufferSource 2018-03-24 20:46:14 -04:00
Nakul Jindal
7d4e2b11e9 Implements profiler for blocked recv 2018-03-22 11:48:27 -07:00
Nicholas Nethercote
4506f0d30c Replace all uses of the heapsize crate with malloc_size_of.
Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`.
`malloc_size_of` is better -- it handles various cases that `heapsize` does not
-- so this patch changes Servo to use `malloc_size_of`.

This patch makes the following changes to the `malloc_size_of` crate.

- Adds `MallocSizeOf` trait implementations for numerous types, some built-in
  (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`).

- Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't
  support that operation.

- For `HashSet`/`HashMap`, falls back to a computed estimate when
  `enclosing_size_of_op` isn't available.

- Adds an extern "C" `malloc_size_of` function that does the actual heap
  measurement; this is based on the same functions from the `heapsize` crate.

This patch makes the following changes elsewhere.

- Converts all the uses of `heapsize` to instead use `malloc_size_of`.

- Disables the "heapsize"/"heap_size" feature for the external crates that
  provide it.

- Removes the `HeapSizeOf` implementation from `hashglobe`.

- Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of`
  doesn't derive those types, unlike `heapsize`.
2017-10-18 22:20:37 +11:00
Simon Sapin
a819cfb0fa Replace uses of libcore with libstd in components/script 2017-10-16 20:19:59 +02: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
f87c2a8d76 Rename Root<T> to DomRoot<T>
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.
2017-09-26 09:49:10 +02:00
Anthony Ramine
577370746e Rename DOMRefCell<T> to DomRefCell<T>
I don't want to do such a gratuitous rename, but with all the other types
now having "Dom" as part of their name, and especially with "DomOnceCell",
I feel like the other cell type that we already have should also follow
the convention. That argument loses weight though when we realise there
is still DOMString and other things.
2017-09-26 09:49:08 +02:00
Anthony Ramine
7be32fb237 Rename JS<T> to Dom<T> 2017-09-26 09:48:55 +02:00
Anthony Ramine
0e3c54c191 Rename dom::bindings::js to dom::bindings::root 2017-09-26 02:19:05 +02:00
Anthony Ramine
d246c5cf20 Remove JSContext argument from AsyncBluetoothListener::handle_response 2017-09-22 13:56:31 +02:00
Anthony Ramine
af2e83f378 Make Promise::reject_error sound 2017-09-22 02:15:22 +02:00
Anthony Ramine
5addc2dfa3 Make Promise::resolve_native actually sound
We shouldn't have to pass a raw JSContext pointer, and to enter the
promise's context's compartment by hand.
2017-09-21 16:00:48 +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
46628fba05 Move Task to its own module 2017-09-18 02:47:04 +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
7875fea6cf Use absolute paths in the event handlers macros 2017-09-01 11:54:09 +02:00
Simon Sapin
7af5a7fd54 Untry script 2017-06-18 13:21:49 +02:00
Anthony Ramine
31e9d81c0f Make #[dom_struct] a proc_macro attribute 2017-02-24 01:50:51 +01:00
Attila Dusnoki
2de91c7788 refactor extra permission data 2017-02-14 13:39:00 +01:00
Attila Dusnoki
d5cc10a636 Move extra permission data to window 2017-02-13 14:58:16 +01:00
Attila Dusnoki
b1d388a991 Fix BluetoothPermissionResult return state 2017-02-13 14:58:15 +01:00
Zakor Gyula
f7e86d2d0e Use rooted_vec instead of Vec<JS<T>> 2017-02-13 14:58:14 +01:00
Attila Dusnoki
4a62562b0f Add pref to ignore popup in testing 2017-02-13 14:58:13 +01:00
Zakor Gyula
3ec9f0bab9 Fix comments, and lesser modifications 2017-02-13 14:58:12 +01:00
Zakor Gyula
5287cd3bea Bluetooth Permission API integration 2017-02-13 14:58:06 +01:00
Attila Dusnoki
ca7aa6bff8 Implement GetAvailability for Bluetooth 2017-02-08 15:53:53 +01:00
Zakor Gyula
b52f9e483f Remove the 29 byte length restriction, when requesting bluetooth devices 2017-02-03 11:12:32 +01:00
Prudhvi Rampey
29340b7adf Cleaned up ripples due to MutJS to JS type change 2017-01-07 01:16:02 +05:30
bors-servo
23590f683a Auto merge of #14612 - szeged:connect-disconnect-update, r=jdm
Updating GATTServer's  Connect/Disconnect calls

<!-- Please describe your changes on the following line: -->
Added the missing [Step 5.2.3](https://github.com/servo/servo/compare/master...szeged:connect-disconnect-update#diff-1dbe29f87740f5aec93f37adbecace6cR213) to the `connect` function.
Updated the [disconnect](https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-disconnect) function to its current state in the specification, including the `clean_up_disconnected_device` and the `garbage_collect_the connection` functions.
Added new tests for checking the invalid state of JS objects after disconnection.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14612)
<!-- Reviewable:end -->
2016-12-22 06:51:16 -08:00
Zakor Gyula
6e02cb2eb9 refactor Connect/Disconnect calls 2016-12-22 15:49:29 +01:00
Ms2ger
7af7a10e7e Separate the async bluetooth handling from networking code.
They're not at all related, besides both being asynchronous. This change adds
a little extra code in response_async(), but makes this code more readable
and reduces the unnecessary indirection.

This change also makes the build system slightly more parallel, by dropping
the dependency on bluetooth_traits from net_traits.
2016-12-21 14:52:39 +01:00
Attila Dusnoki
b0103682fa Implement GetGATTChildren 2016-12-16 21:02:58 +01:00
Attila Dusnoki
748b78a6bf Replace AdvertisingData with AdvertisingEvent 2016-12-14 20:42:31 +01:00
Anthony Ramine
1327ebd52f Remove HeapGCValue
It could be used to have mutable JSVal fields without GC barriers.
With the removal of that trait, MutHeap and MutNullableHeap can respectively
be replaced by MutJS and MutNullableJS.
2016-12-12 10:47:54 -10:00
Corey Farwell
449f6337d4 Rename Reflectable to DomObject.
Fixes https://github.com/servo/servo/issues/8473.
2016-12-08 08:50:35 -10:00
Valentin Fokin
c33d89c92c Moved the AttributeInstanceMaps from bluetooth to bluetoothDevice. 2016-12-02 12:50:53 +01:00
Zakor Gyula
8dd100f74f Step annotations for WebBluetooth functions 2016-11-29 18:24:28 +01:00
Zakor Gyula
89c4219a36 Update requestDevice step annotations. 2016-11-29 18:24:25 +01:00
Zakor Gyula
315c57f948 Move convert_request_device_options into request_bluetooth_devices. 2016-11-29 16:20:56 +01:00
Attila Dusnoki
d9c7ffb5b3 Add event target for bluetooth 2016-11-28 10:49:49 +01:00
zakorgyula
1b1b07ef42 serviceData and manufacturerData support 2016-11-23 01:25:21 -08:00
Zakor Gyula
f98fbecfda Rename blacklist to blocklist 2016-11-17 15:23:14 +01:00
Zakor Gyula
dd4b0cf620 Simplify RequestDevice function in bluetooth.rs 2016-11-14 13:21:14 +01:00
Zakor Gyula
30f924d8f6 Fix a typo in dom/bluetooth.rs 2016-11-14 13:21:13 +01:00
Keith Yeung
72cb856e31 Properly implement TaskSource for NetworkingTaskSource 2016-11-11 14:50:42 -08:00
Attila Dusnoki
e7e7c74c9e Webbluetooth Async behaviour 2016-11-08 13:27:56 +01:00
zakorgyula
e8c1c98a77 Return the same JS object for the same Bluetooth item. 2016-11-04 15:36:57 +01:00
fokinv
d30bcbd339 Blacklisted items are removed when calling getServices/Characteristics/Descriptors. 2016-11-04 15:36:55 +01:00
fokinv
baa024e362 Return with NotFoundError when the requested deviceName/deviceNamePrefix is longer than 29 bytes. 2016-11-04 15:36:47 +01:00