aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-06-29 15:37:42 -0500
committerGitHub <noreply@github.com>2016-06-29 15:37:42 -0500
commitdcc4697dde3ba8af32e233b302a16bea76af378a (patch)
tree4535acd94332eebc65897cb0b2cbbb5342342c48
parent77a0e269674fc09f4f8b37c4f91e05f2f2d3d6bd (diff)
parent5a576e873e34eca47446850d41d5a33048a6ad21 (diff)
downloadservo-dcc4697dde3ba8af32e233b302a16bea76af378a.tar.gz
servo-dcc4697dde3ba8af32e233b302a16bea76af378a.zip
Auto merge of #11930 - nox:die-util-die, r=SimonSapin
Remove some util stuff <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11930) <!-- Reviewable:end -->
-rw-r--r--components/compositing/delayed_composition.rs15
-rw-r--r--components/layout/construct.rs5
-rw-r--r--components/layout/lib.rs1
-rw-r--r--components/layout/linked_list.rs (renamed from components/util/linked_list.rs)0
-rw-r--r--components/layout/text.rs2
-rw-r--r--components/profile/mem.rs2
-rw-r--r--components/profile/time.rs17
-rw-r--r--components/util/lib.rs2
-rw-r--r--components/util/time.rs31
9 files changed, 34 insertions, 41 deletions
diff --git a/components/compositing/delayed_composition.rs b/components/compositing/delayed_composition.rs
index c2ae4b86fa9..36c0306011a 100644
--- a/components/compositing/delayed_composition.rs
+++ b/components/compositing/delayed_composition.rs
@@ -10,8 +10,9 @@
use compositor_thread::{CompositorProxy, Msg};
use std::sync::mpsc::{Receiver, Sender, channel};
use std::thread::{self, Builder};
+use std::time::Duration;
+use std::u32;
use time;
-use util::time::duration_from_nanoseconds;
/// The amount of time in nanoseconds that we give to the painting thread to paint. When this
/// expires, we give up and composite anyway.
@@ -92,3 +93,15 @@ impl DelayedCompositionTimer {
}
}
+fn duration_from_nanoseconds(nanos: u64) -> Duration {
+ pub const NANOS_PER_SEC: u32 = 1_000_000_000;
+
+ // Get number of seconds.
+ let secs = nanos / NANOS_PER_SEC as u64;
+
+ // Get number of extra nanoseconds. This should always fit in a u32, but check anyway.
+ let subsec_nanos = nanos % NANOS_PER_SEC as u64;
+ assert!(subsec_nanos <= u32::MAX as u64);
+
+ Duration::new(secs, subsec_nanos as u32)
+}
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index c7dcf0126c3..2b1b2f49cdc 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -30,6 +30,7 @@ use fragment::{InlineBlockFragmentInfo, SpecificFragmentInfo, UnscannedTextFragm
use gfx::display_list::OpaqueNode;
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFlow, InlineFragmentNodeFlags};
use inline::{InlineFragmentNodeInfo, LAST_FRAGMENT_OF_ELEMENT};
+use linked_list::prepend_from;
use list_item::{ListItemFlow, ListStyleTypeContent};
use multicol::{MulticolFlow, MulticolColumnFlow};
use parallel;
@@ -57,7 +58,6 @@ use table_wrapper::TableWrapperFlow;
use text::TextRunScanner;
use traversal::PostorderNodeMutTraversal;
use url::Url;
-use util::linked_list;
use util::opts;
use wrapper::{TextContent, ThreadSafeLayoutNodeHelpers};
@@ -1805,8 +1805,7 @@ pub fn strip_ignorable_whitespace_from_start(this: &mut LinkedList<Fragment>) {
}
}
}
- linked_list::prepend_from(this,
- &mut leading_fragments_consisting_of_solely_bidi_control_characters);
+ prepend_from(this, &mut leading_fragments_consisting_of_solely_bidi_control_characters);
}
/// Strips ignorable whitespace from the end of a list of fragments.
diff --git a/components/layout/lib.rs b/components/layout/lib.rs
index e747993dd84..f05b21c3628 100644
--- a/components/layout/lib.rs
+++ b/components/layout/lib.rs
@@ -75,6 +75,7 @@ mod fragment;
mod generated_content;
pub mod incremental;
mod inline;
+mod linked_list;
mod list_item;
mod model;
mod multicol;
diff --git a/components/util/linked_list.rs b/components/layout/linked_list.rs
index 5114f02c0e4..5114f02c0e4 100644
--- a/components/util/linked_list.rs
+++ b/components/layout/linked_list.rs
diff --git a/components/layout/text.rs b/components/layout/text.rs
index 472ef9fcd50..250ad9d5e73 100644
--- a/components/layout/text.rs
+++ b/components/layout/text.rs
@@ -16,6 +16,7 @@ use gfx::text::glyph::ByteIndex;
use gfx::text::text_run::TextRun;
use gfx::text::util::{self, CompressionMode};
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragments, LAST_FRAGMENT_OF_ELEMENT};
+use linked_list::split_off_head;
use range::Range;
use std::borrow::ToOwned;
use std::collections::LinkedList;
@@ -28,7 +29,6 @@ use style::properties::style_structs::ServoFont;
use style::properties::{ComputedValues, ServoComputedValues};
use unicode_bidi::{is_rtl, process_text};
use unicode_script::{get_script, Script};
-use util::linked_list::split_off_head;
/// Returns the concatenated text of a list of unscanned text fragments.
fn text(fragments: &LinkedList<Fragment>) -> String {
diff --git a/components/profile/mem.rs b/components/profile/mem.rs
index 297584891c2..d1d2ca26b20 100644
--- a/components/profile/mem.rs
+++ b/components/profile/mem.rs
@@ -12,8 +12,8 @@ use std::borrow::ToOwned;
use std::cmp::Ordering;
use std::collections::HashMap;
use std::thread;
+use time::duration_from_seconds;
use util::thread::spawn_named;
-use util::time::duration_from_seconds;
pub struct Profiler {
/// The port through which messages are received.
diff --git a/components/profile/time.rs b/components/profile/time.rs
index 9c310fe9270..9c9debdb738 100644
--- a/components/profile/time.rs
+++ b/components/profile/time.rs
@@ -19,12 +19,11 @@ use std::io::{self, Write};
use std::path;
use std::path::Path;
use std::time::Duration;
-use std::{thread, f64};
+use std::{f64, thread, u32, u64};
use std_time::precise_time_ns;
use trace_dump::TraceDump;
use util::opts::OutputOptions;
use util::thread::spawn_named;
-use util::time::duration_from_seconds;
pub trait Formattable {
fn format(&self, output: &Option<OutputOptions>) -> String;
@@ -408,3 +407,17 @@ fn enforce_range<T>(min: T, max: T, value: T) -> T where T: Ord {
},
}
}
+
+pub fn duration_from_seconds(secs: f64) -> Duration {
+ pub const NANOS_PER_SEC: u32 = 1_000_000_000;
+
+ // Get number of seconds and check that it fits in a u64.
+ let whole_secs = secs.trunc();
+ assert!(whole_secs >= 0.0 && whole_secs <= u64::MAX as f64);
+
+ // Get number of nanoseconds. This should always fit in a u32, but check anyway.
+ let nanos = (secs.fract() * (NANOS_PER_SEC as f64)).trunc();
+ assert!(nanos >= 0.0 && nanos <= u32::MAX as f64);
+
+ Duration::new(whole_secs as u64, nanos as u32)
+}
diff --git a/components/util/lib.rs b/components/util/lib.rs
index ff1a18ab712..eb71fdf41f1 100644
--- a/components/util/lib.rs
+++ b/components/util/lib.rs
@@ -39,7 +39,6 @@ pub mod cache;
#[allow(unsafe_code)] pub mod debug_utils;
pub mod geometry;
#[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod ipc;
-#[cfg(feature = "servo")] pub mod linked_list;
#[allow(unsafe_code)] pub mod opts;
#[cfg(feature = "servo")] pub mod panicking;
pub mod prefs;
@@ -49,7 +48,6 @@ pub mod str;
pub mod thread;
pub mod thread_state;
pub mod tid;
-#[cfg(feature = "servo")] pub mod time;
pub mod vec;
#[allow(unsafe_code)] pub mod workqueue;
diff --git a/components/util/time.rs b/components/util/time.rs
deleted file mode 100644
index 4a751c95ee1..00000000000
--- a/components/util/time.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-use std::time::Duration;
-use std::{u32, u64};
-
-pub const NANOS_PER_SEC: u32 = 1_000_000_000;
-
-pub fn duration_from_seconds(secs: f64) -> Duration {
- // Get number of seconds and check that it fits in a u64.
- let whole_secs = secs.trunc();
- assert!(whole_secs >= 0.0 && whole_secs <= u64::MAX as f64);
-
- // Get number of nanoseconds. This should always fit in a u32, but check anyway.
- let nanos = (secs.fract() * (NANOS_PER_SEC as f64)).trunc();
- assert!(nanos >= 0.0 && nanos <= u32::MAX as f64);
-
- Duration::new(whole_secs as u64, nanos as u32)
-}
-
-pub fn duration_from_nanoseconds(nanos: u64) -> Duration {
- // Get number of seconds.
- let secs = nanos / NANOS_PER_SEC as u64;
-
- // Get number of extra nanoseconds. This should always fit in a u32, but check anyway.
- let subsec_nanos = nanos % NANOS_PER_SEC as u64;
- assert!(subsec_nanos <= u32::MAX as u64);
-
- Duration::new(secs, subsec_nanos as u32)
-}