зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #18361 - change function signature to get type name via intrinsics (from toidiu:ak-18354); r=emilio
<!-- Please describe your changes on the following line: --> change function signature to get type name via intrinsics --- <!-- 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] These changes fix #18354 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because stated in the PR that it was not required <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 887b011288f832634eed634769b5d2ec48f0e24d --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 15e173afe75d74728204397ee807e97233bef897
This commit is contained in:
Родитель
39fcf97cf0
Коммит
d8b57ef9d7
|
@ -4015,8 +4015,6 @@ impl DocumentProgressHandler {
|
|||
}
|
||||
|
||||
impl Runnable for DocumentProgressHandler {
|
||||
fn name(&self) -> &'static str { "DocumentProgressHandler" }
|
||||
|
||||
fn handler(self: Box<DocumentProgressHandler>) {
|
||||
let document = self.addr.root();
|
||||
let window = document.window();
|
||||
|
|
|
@ -3035,8 +3035,6 @@ impl ElementPerformFullscreenEnter {
|
|||
}
|
||||
|
||||
impl Runnable for ElementPerformFullscreenEnter {
|
||||
fn name(&self) -> &'static str { "ElementPerformFullscreenEnter" }
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
fn handler(self: Box<ElementPerformFullscreenEnter>) {
|
||||
let element = self.element.root();
|
||||
|
@ -3090,8 +3088,6 @@ impl ElementPerformFullscreenExit {
|
|||
}
|
||||
|
||||
impl Runnable for ElementPerformFullscreenExit {
|
||||
fn name(&self) -> &'static str { "ElementPerformFullscreenExit" }
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
fn handler(self: Box<ElementPerformFullscreenExit>) {
|
||||
let element = self.element.root();
|
||||
|
|
|
@ -389,8 +389,6 @@ pub struct EventRunnable {
|
|||
}
|
||||
|
||||
impl Runnable for EventRunnable {
|
||||
fn name(&self) -> &'static str { "EventRunnable" }
|
||||
|
||||
fn handler(self: Box<EventRunnable>) {
|
||||
let target = self.target.root();
|
||||
let bubbles = self.bubbles;
|
||||
|
@ -406,8 +404,6 @@ pub struct SimpleEventRunnable {
|
|||
}
|
||||
|
||||
impl Runnable for SimpleEventRunnable {
|
||||
fn name(&self) -> &'static str { "SimpleEventRunnable" }
|
||||
|
||||
fn handler(self: Box<SimpleEventRunnable>) {
|
||||
let target = self.target.root();
|
||||
target.fire_event(self.name);
|
||||
|
|
|
@ -474,8 +474,6 @@ pub struct AnnounceConnectionRunnable {
|
|||
}
|
||||
|
||||
impl Runnable for AnnounceConnectionRunnable {
|
||||
fn name(&self) -> &'static str { "EventSource AnnounceConnectionRunnable" }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#announce-the-connection
|
||||
fn handler(self: Box<AnnounceConnectionRunnable>) {
|
||||
let event_source = self.event_source.root();
|
||||
|
@ -491,8 +489,6 @@ pub struct FailConnectionRunnable {
|
|||
}
|
||||
|
||||
impl Runnable for FailConnectionRunnable {
|
||||
fn name(&self) -> &'static str { "EventSource FailConnectionRunnable" }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#fail-the-connection
|
||||
fn handler(self: Box<FailConnectionRunnable>) {
|
||||
let event_source = self.event_source.root();
|
||||
|
@ -509,8 +505,6 @@ pub struct ReestablishConnectionRunnable {
|
|||
}
|
||||
|
||||
impl Runnable for ReestablishConnectionRunnable {
|
||||
fn name(&self) -> &'static str { "EventSource ReestablishConnectionRunnable" }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#reestablish-the-connection
|
||||
fn handler(self: Box<ReestablishConnectionRunnable>) {
|
||||
let event_source = self.event_source.root();
|
||||
|
@ -568,8 +562,6 @@ pub struct DispatchEventRunnable {
|
|||
}
|
||||
|
||||
impl Runnable for DispatchEventRunnable {
|
||||
fn name(&self) -> &'static str { "EventSource DispatchEventRunnable" }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dispatchMessage
|
||||
fn handler(self: Box<DispatchEventRunnable>) {
|
||||
let event_source = self.event_source.root();
|
||||
|
|
|
@ -89,8 +89,6 @@ pub struct DetailsNotificationRunnable {
|
|||
}
|
||||
|
||||
impl Runnable for DetailsNotificationRunnable {
|
||||
fn name(&self) -> &'static str { "DetailsNotificationRunnable" }
|
||||
|
||||
fn handler(self: Box<DetailsNotificationRunnable>) {
|
||||
let target = self.element.root();
|
||||
if target.check_toggle_count(self.toggle_number) {
|
||||
|
|
|
@ -1116,8 +1116,6 @@ struct PlannedNavigation {
|
|||
}
|
||||
|
||||
impl Runnable for PlannedNavigation {
|
||||
fn name(&self) -> &'static str { "PlannedNavigation" }
|
||||
|
||||
fn handler(self: Box<PlannedNavigation>) {
|
||||
if self.generation_id == self.form.root().generation_id.get() {
|
||||
let script_chan = self.script_chan.clone();
|
||||
|
|
|
@ -117,8 +117,6 @@ impl ImageResponseHandlerRunnable {
|
|||
}
|
||||
|
||||
impl Runnable for ImageResponseHandlerRunnable {
|
||||
fn name(&self) -> &'static str { "ImageResponseHandlerRunnable" }
|
||||
|
||||
fn handler(self: Box<Self>) {
|
||||
let element = self.element.root();
|
||||
// Ignore any image response for a previous request that has been discarded.
|
||||
|
|
|
@ -835,8 +835,6 @@ impl FireSimpleEventTask {
|
|||
}
|
||||
|
||||
impl Runnable for FireSimpleEventTask {
|
||||
fn name(&self) -> &'static str { "FireSimpleEventTask" }
|
||||
|
||||
fn handler(self: Box<FireSimpleEventTask>) {
|
||||
let elem = self.elem.root();
|
||||
elem.fire_simple_event(self.type_);
|
||||
|
@ -856,8 +854,6 @@ impl DedicatedMediaSourceFailureTask {
|
|||
}
|
||||
|
||||
impl Runnable for DedicatedMediaSourceFailureTask {
|
||||
fn name(&self) -> &'static str { "DedicatedMediaSourceFailureTask" }
|
||||
|
||||
fn handler(self: Box<DedicatedMediaSourceFailureTask>) {
|
||||
self.elem.root().dedicated_media_source_failure();
|
||||
}
|
||||
|
|
|
@ -213,8 +213,6 @@ impl NotifyPerformanceObserverRunnable {
|
|||
}
|
||||
|
||||
impl Runnable for NotifyPerformanceObserverRunnable {
|
||||
fn name(&self) -> &'static str { "NotifyPerformanceObserverRunnable" }
|
||||
|
||||
fn main_thread_handler(self: Box<NotifyPerformanceObserverRunnable>,
|
||||
_: &ScriptThread) {
|
||||
self.owner.root().notify_observers();
|
||||
|
|
|
@ -187,8 +187,6 @@ impl StorageEventRunnable {
|
|||
}
|
||||
|
||||
impl Runnable for StorageEventRunnable {
|
||||
fn name(&self) -> &'static str { "StorageEventRunnable" }
|
||||
|
||||
fn main_thread_handler(self: Box<StorageEventRunnable>, _: &ScriptThread) {
|
||||
let this = *self;
|
||||
let storage = this.element.root();
|
||||
|
|
|
@ -614,8 +614,6 @@ struct NotifyDisplayRAF {
|
|||
}
|
||||
|
||||
impl Runnable for NotifyDisplayRAF {
|
||||
fn name(&self) -> &'static str { "NotifyDisplayRAF" }
|
||||
|
||||
fn handler(self: Box<Self>) {
|
||||
let display = self.address.root();
|
||||
display.handle_raf(&self.sender);
|
||||
|
|
|
@ -394,8 +394,6 @@ struct ConnectionEstablishedTask {
|
|||
}
|
||||
|
||||
impl Runnable for ConnectionEstablishedTask {
|
||||
fn name(&self) -> &'static str { "ConnectionEstablishedTask" }
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#feedback-from-the-protocol:concept-websocket-established
|
||||
fn handler(self: Box<Self>) {
|
||||
let ws = self.address.root();
|
||||
|
@ -426,8 +424,6 @@ impl Runnable for BufferedAmountTask {
|
|||
// To be compliant with standards, we need to reset bufferedAmount only when the event loop
|
||||
// reaches step 1. In our implementation, the bytes will already have been sent on a background
|
||||
// thread.
|
||||
fn name(&self) -> &'static str { "BufferedAmountTask" }
|
||||
|
||||
fn handler(self: Box<Self>) {
|
||||
let ws = self.address.root();
|
||||
|
||||
|
@ -444,8 +440,6 @@ struct CloseTask {
|
|||
}
|
||||
|
||||
impl Runnable for CloseTask {
|
||||
fn name(&self) -> &'static str { "CloseTask" }
|
||||
|
||||
fn handler(self: Box<Self>) {
|
||||
let ws = self.address.root();
|
||||
|
||||
|
@ -486,8 +480,6 @@ struct MessageReceivedTask {
|
|||
}
|
||||
|
||||
impl Runnable for MessageReceivedTask {
|
||||
fn name(&self) -> &'static str { "MessageReceivedTask" }
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn handler(self: Box<Self>) {
|
||||
let ws = self.address.root();
|
||||
|
|
|
@ -102,6 +102,7 @@ use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl};
|
|||
use std::cell::Cell;
|
||||
use std::collections::{hash_map, HashMap, HashSet};
|
||||
use std::default::Default;
|
||||
use std::intrinsics;
|
||||
use std::ops::Deref;
|
||||
use std::option::Option;
|
||||
use std::ptr;
|
||||
|
@ -221,8 +222,6 @@ pub struct CancellableRunnable<T: Runnable + Send> {
|
|||
}
|
||||
|
||||
impl<T: Runnable + Send> Runnable for CancellableRunnable<T> {
|
||||
fn name(&self) -> &'static str { self.inner.name() }
|
||||
|
||||
fn is_cancelled(&self) -> bool {
|
||||
self.cancelled.as_ref()
|
||||
.map(|cancelled| cancelled.load(Ordering::SeqCst))
|
||||
|
@ -240,7 +239,7 @@ impl<T: Runnable + Send> Runnable for CancellableRunnable<T> {
|
|||
|
||||
pub trait Runnable {
|
||||
fn is_cancelled(&self) -> bool { false }
|
||||
fn name(&self) -> &'static str { "generic runnable" }
|
||||
fn name(&self) -> &'static str { unsafe { intrinsics::type_name::<Self>() } }
|
||||
fn handler(self: Box<Self>) {}
|
||||
fn main_thread_handler(self: Box<Self>, _script_thread: &ScriptThread) { self.handler(); }
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче