Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change function signature to get type name via intrinsics #18361

Merged
merged 2 commits into from Sep 3, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

move name implementation as default implementation to the trait and r…

…emove overrides.
  • Loading branch information
toidiu
toidiu committed Sep 3, 2017
commit 99e4504f85afe0e9fa678796735c971295c8c709
@@ -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();
@@ -3030,8 +3030,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();
@@ -3085,8 +3083,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();
@@ -222,8 +222,6 @@ pub struct CancellableRunnable<T: Runnable + Send> {
}

impl<T: Runnable + Send> Runnable for CancellableRunnable<T> {
fn name(&self) -> &'static str { unsafe { intrinsics::type_name::<Self>() } }

fn is_cancelled(&self) -> bool {
self.cancelled.as_ref()
.map(|cancelled| cancelled.load(Ordering::SeqCst))
@@ -241,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(); }
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.