Eliminate servo_util::atom

We only needed this for Encodable, and now we use JSTraceable instead.
This commit is contained in:
Keegan McAllister 2014-09-29 17:59:47 -07:00
parent 4be0a07585
commit 6429750b33
39 changed files with 77 additions and 74 deletions

7
Cargo.lock generated
View file

@ -287,6 +287,8 @@ dependencies = [
"plugins 0.0.1",
"script 0.0.1",
"script_traits 0.0.1",
"string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"style 0.0.1",
"url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)",
"util 0.0.1",
@ -397,6 +399,8 @@ dependencies = [
"net 0.0.1",
"plugins 0.0.1",
"script_traits 0.0.1",
"string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"style 0.0.1",
"url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)",
"util 0.0.1",
@ -462,6 +466,8 @@ dependencies = [
"plugins 0.0.1",
"url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)",
"util 0.0.1",
"string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
]
[[package]]
@ -483,6 +489,7 @@ dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure#b357751c04a89a87e6ef1f0cebe5f20957dd112d)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom#90add8d65273c8a46aa16d73959e29a51d0c282d)",
"string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"task_info 0.0.1",
"url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)",
]

View file

@ -39,3 +39,9 @@ git = "https://github.com/servo/rust-geom"
[dependencies.url]
git = "https://github.com/servo/rust-url"
[dependencies.string_cache]
git = "https://github.com/servo/string-cache"
[dependencies.string_cache_macros]
git = "https://github.com/servo/string-cache"

View file

@ -11,7 +11,6 @@ use util::{LayoutDataAccess, LayoutDataWrapper};
use wrapper::{LayoutElement, LayoutNode, PostorderNodeMutTraversal, ThreadSafeLayoutNode, TLayoutNode};
use script::dom::node::{TextNodeTypeId};
use servo_util::atom::Atom;
use servo_util::bloom::BloomFilter;
use servo_util::cache::{Cache, LRUCache, SimpleHashCache};
use servo_util::namespace::Null;
@ -24,6 +23,7 @@ use style;
use style::{After, Before, ComputedValues, DeclarationBlock, Stylist, TElement, TNode};
use style::cascade;
use sync::Arc;
use string_cache::Atom;
pub struct ApplicableDeclarations {
pub normal: SmallVec16<DeclarationBlock>,

View file

@ -28,6 +28,9 @@ extern crate "net" as servo_net;
extern crate "msg" as servo_msg;
#[phase(plugin, link)]
extern crate "util" as servo_util;
extern crate string_cache;
#[phase(plugin)]
extern crate string_cache_macros;
extern crate collections;
extern crate encoding;

View file

@ -48,7 +48,6 @@ use script::dom::node::{LayoutNodeHelpers, RawLayoutNodeHelpers, SharedLayoutDat
use script::dom::text::Text;
use script::layout_interface::LayoutChan;
use servo_msg::constellation_msg::{PipelineId, SubpageId};
use servo_util::atom::Atom;
use servo_util::namespace::Namespace;
use servo_util::namespace;
use servo_util::str::is_whitespace;
@ -59,6 +58,7 @@ use style::computed_values::{content, display, white_space};
use style::{AnyNamespace, AttrSelector, PropertyDeclarationBlock, SpecificNamespace, TElement};
use style::{TNode};
use url::Url;
use string_cache::Atom;
/// Allows some convenience methods on generic layout nodes.
pub trait TLayoutNode {

View file

@ -60,3 +60,9 @@ git = "https://github.com/servo/rust-url"
[dependencies.uuid]
git = "https://github.com/rust-lang/uuid"
[dependencies.string_cache]
git = "https://github.com/servo/string-cache"
[dependencies.string_cache_macros]
git = "https://github.com/servo/string-cache"

View file

@ -15,13 +15,13 @@ use dom::window::Window;
use dom::virtualmethods::vtable_for;
use devtools_traits::AttrInfo;
use servo_util::atom::Atom;
use servo_util::namespace;
use servo_util::namespace::Namespace;
use servo_util::str::{DOMString, split_html_space_chars};
use std::cell::{Ref, RefCell};
use std::mem;
use std::slice::Items;
use string_cache::Atom;
pub enum AttrSettingType {
FirstSetAttr,

View file

@ -35,7 +35,6 @@ use std::rc::Rc;
use std::cell::{Cell, RefCell};
use url::Url;
use servo_util::atom::Atom;
use servo_util::namespace::Namespace;
use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData};
use net::image_cache_task::ImageCacheTask;
@ -43,6 +42,7 @@ use script_traits::ScriptControlChan;
use std::collections::hashmap::HashMap;
use collections::hash::Hash;
use style::PropertyDeclarationBlock;
use string_cache::Atom;
impl<T: Reflectable> JSTraceable for JS<T> {
fn trace(&self, trc: *mut JSTracer) {

View file

@ -55,10 +55,10 @@ use dom::window::{Window, WindowHelpers};
use html::hubbub_html_parser::build_element_from_tag;
use hubbub::hubbub::{QuirksMode, NoQuirks, LimitedQuirks, FullQuirks};
use layout_interface::{DocumentDamageLevel, ContentChangedDocumentDamage};
use servo_util::atom::Atom;
use servo_util::namespace;
use servo_util::namespace::{Namespace, Null};
use servo_util::str::{DOMString, split_html_space_chars};
use string_cache::Atom;
use std::collections::hashmap::HashMap;
use std::ascii::StrAsciiExt;

View file

@ -12,9 +12,9 @@ use dom::bindings::utils::{Reflector, Reflectable, reflect_dom_object};
use dom::element::{Element, AttributeHandlers};
use dom::node::window_from_node;
use servo_util::atom::Atom;
use servo_util::namespace::Null;
use servo_util::str::{DOMString, HTML_SPACE_CHARACTERS};
use string_cache::Atom;
#[jstraceable]
#[must_root]

View file

@ -34,7 +34,6 @@ use layout_interface::MatchSelectorsDocumentDamage;
use devtools_traits::AttrInfo;
use style::{matches, parse_selector_list_from_str};
use style;
use servo_util::atom::Atom;
use servo_util::namespace;
use servo_util::namespace::{Namespace, Null};
use servo_util::str::DOMString;
@ -42,6 +41,7 @@ use servo_util::str::DOMString;
use std::ascii::StrAsciiExt;
use std::cell::{Cell, RefCell};
use std::mem;
use string_cache::Atom;
#[jstraceable]
#[must_root]

View file

@ -17,8 +17,8 @@ use dom::htmlelement::HTMLElement;
use dom::node::{Node, ElementNodeTypeId, window_from_node};
use dom::virtualmethods::VirtualMethods;
use servo_util::atom::Atom;
use servo_util::str::DOMString;
use string_cache::Atom;
#[jstraceable]
#[must_root]

View file

@ -16,8 +16,8 @@ use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId, wind
use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods;
use servo_util::atom::Atom;
use servo_util::str::DOMString;
use string_cache::Atom;
#[jstraceable]
#[must_root]

View file

@ -18,8 +18,8 @@ use dom::htmlelement::HTMLElement;
use dom::node::{Node, ElementNodeTypeId, window_from_node};
use dom::virtualmethods::VirtualMethods;
use servo_util::atom::Atom;
use servo_util::str::{DOMString, parse_unsigned_integer};
use string_cache::Atom;
use geom::size::Size2D;

View file

@ -12,11 +12,11 @@ use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::element::{Element, AttributeHandlers, ElementHelpers};
use dom::node::{Node, NodeHelpers};
use dom::window::Window;
use servo_util::atom::Atom;
use servo_util::namespace::Namespace;
use servo_util::str::{DOMString, split_html_space_chars};
use std::ascii::StrAsciiExt;
use string_cache::Atom;
pub trait CollectionFilter : JSTraceable {
fn filter(&self, elem: JSRef<Element>, root: JSRef<Node>) -> bool;

View file

@ -17,9 +17,9 @@ use dom::eventtarget::{EventTarget, EventTargetHelpers, NodeTargetTypeId};
use dom::node::{Node, ElementNodeTypeId, window_from_node};
use dom::virtualmethods::VirtualMethods;
use servo_util::atom::Atom;
use servo_util::namespace;
use servo_util::str::DOMString;
use string_cache::Atom;
#[jstraceable]
#[must_root]

View file

@ -18,8 +18,8 @@ use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId, wind
use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods;
use servo_util::atom::Atom;
use servo_util::str::{DOMString, StaticStringVec};
use string_cache::Atom;
#[jstraceable]
#[must_root]

View file

@ -23,9 +23,9 @@ use page::IterablePage;
use servo_msg::constellation_msg::{PipelineId, SubpageId};
use servo_msg::constellation_msg::{IFrameSandboxed, IFrameUnsandboxed};
use servo_msg::constellation_msg::{ConstellationChan, LoadIframeUrlMsg};
use servo_util::atom::Atom;
use servo_util::namespace::Null;
use servo_util::str::DOMString;
use string_cache::Atom;
use std::ascii::StrAsciiExt;
use std::cell::Cell;

View file

@ -17,9 +17,9 @@ use dom::htmlelement::HTMLElement;
use dom::node::{Node, ElementNodeTypeId, NodeHelpers, window_from_node};
use dom::virtualmethods::VirtualMethods;
use servo_net::image_cache_task;
use servo_util::atom::Atom;
use servo_util::geometry::to_px;
use servo_util::str::DOMString;
use string_cache::Atom;
use url::{Url, UrlParser};

View file

@ -15,8 +15,8 @@ use dom::htmlelement::HTMLElement;
use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId};
use dom::virtualmethods::VirtualMethods;
use servo_util::atom::Atom;
use servo_util::str::DOMString;
use string_cache::Atom;
#[jstraceable]
#[must_root]

View file

@ -15,12 +15,12 @@ use dom::htmlelement::HTMLElement;
use dom::node::{Node, NodeHelpers, ElementNodeTypeId, window_from_node};
use dom::virtualmethods::VirtualMethods;
use layout_interface::{LayoutChan, LoadStylesheetMsg};
use servo_util::atom::Atom;
use servo_util::str::{DOMString, HTML_SPACE_CHARACTERS};
use servo_util::namespace::Null;
use std::ascii::StrAsciiExt;
use url::UrlParser;
use string_cache::Atom;
#[jstraceable]
#[must_root]

View file

@ -20,9 +20,9 @@ use dom::virtualmethods::VirtualMethods;
use servo_net::image_cache_task;
use servo_net::image_cache_task::ImageCacheTask;
use servo_util::atom::Atom;
use servo_util::namespace::Null;
use servo_util::str::DOMString;
use string_cache::Atom;
use url::Url;

View file

@ -15,8 +15,8 @@ use dom::htmlelement::HTMLElement;
use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId};
use dom::virtualmethods::VirtualMethods;
use servo_util::atom::Atom;
use servo_util::str::DOMString;
use string_cache::Atom;
#[jstraceable]
#[must_root]

View file

@ -19,9 +19,9 @@ use dom::htmlelement::HTMLElement;
use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId};
use dom::virtualmethods::VirtualMethods;
use servo_util::atom::Atom;
use servo_util::namespace;
use servo_util::str::{DOMString, split_html_space_chars};
use string_cache::Atom;
#[jstraceable]
#[must_root]

View file

@ -18,8 +18,8 @@ use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId, wind
use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods;
use servo_util::atom::Atom;
use servo_util::str::DOMString;
use string_cache::Atom;
#[jstraceable]
#[must_root]

View file

@ -18,8 +18,8 @@ use dom::node::{TextNodeTypeId, NodeHelpers};
use dom::processinginstruction::ProcessingInstruction;
use dom::text::Text;
use servo_util::atom::Atom;
use servo_util::namespace;
use string_cache::Atom;
#[allow(unrooted_must_root)]
pub fn serialize(iterator: &mut NodeIterator) -> String {

View file

@ -15,8 +15,8 @@ use dom::htmlelement::HTMLElement;
use dom::node::{DisabledStateHelpers, Node, NodeHelpers, ElementNodeTypeId};
use dom::virtualmethods::VirtualMethods;
use servo_util::atom::Atom;
use servo_util::str::DOMString;
use string_cache::Atom;
#[jstraceable]
#[must_root]

View file

@ -57,8 +57,8 @@ use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltextareaelement::HTMLTextAreaElement;
use dom::node::{Node, NodeHelpers, ElementNodeTypeId};
use servo_util::atom::Atom;
use servo_util::str::DOMString;
use string_cache::Atom;
/// Trait to allow DOM nodes to opt-in to overriding (or adding to) common
/// behaviours. Replicates the effect of C++ virtual methods.

View file

@ -25,7 +25,6 @@ use encoding::types::{Encoding, DecodeReplace};
use hubbub::hubbub;
use hubbub::hubbub::{NullNs, HtmlNs, MathMlNs, SvgNs, XLinkNs, XmlNs, XmlNsNs};
use servo_net::resource_task::{Load, LoadData, Payload, Done, ResourceTask, load_whole_resource};
use servo_util::atom::Atom;
use servo_util::namespace;
use servo_util::namespace::{Namespace, Null};
use servo_util::str::DOMString;
@ -37,6 +36,7 @@ use std::comm::{channel, Sender, Receiver};
use url::{Url, UrlParser};
use http::headers::HeaderEnum;
use time;
use string_cache::Atom;
macro_rules! handle_element(
($document: expr,

View file

@ -42,6 +42,9 @@ extern crate sync;
extern crate "msg" as servo_msg;
extern crate url;
extern crate uuid;
extern crate string_cache;
#[phase(plugin)]
extern crate string_cache_macros;
pub mod cors;

View file

@ -29,3 +29,9 @@ git = "https://github.com/lifthrasiir/rust-encoding"
[dependencies.lazy_static]
git = "https://github.com/Kimundi/lazy-static.rs"
[dependencies.string_cache]
git = "https://github.com/servo/string-cache"
[dependencies.string_cache_macros]
git = "https://github.com/servo/string-cache"

View file

@ -22,6 +22,11 @@ extern crate url;
extern crate cssparser;
extern crate encoding;
extern crate string_cache;
#[phase(plugin)]
extern crate string_cache_macros;
#[phase(plugin)]
extern crate lazy_static;

View file

@ -6,8 +6,8 @@
//! style.
use selectors::AttrSelector;
use servo_util::atom::Atom;
use servo_util::namespace::Namespace;
use string_cache::Atom;
pub trait TNode<'a, E: TElement<'a>> : Clone {

View file

@ -9,11 +9,11 @@ use sync::Arc;
use url::Url;
use servo_util::atom::Atom;
use servo_util::bloom::BloomFilter;
use servo_util::namespace;
use servo_util::smallvec::VecLike;
use servo_util::sort;
use string_cache::Atom;
use media_queries::{Device, Screen};
use node::{TElement, TNode};
@ -997,7 +997,6 @@ impl<K: Eq + Hash, V> FindPush<K, V> for HashMap<K, Vec<V>> {
#[cfg(test)]
mod tests {
use servo_util::atom::Atom;
use sync::Arc;
use super::{DeclarationBlock, Rule, SelectorMap};
use selectors::LocalName;

View file

@ -9,9 +9,9 @@ use sync::Arc;
use cssparser::ast::*;
use cssparser::{tokenize, parse_nth};
use servo_util::atom::Atom;
use servo_util::namespace::Namespace;
use servo_util::namespace;
use string_cache::Atom;
use namespaces::NamespaceMap;
@ -575,7 +575,6 @@ fn skip_whitespace<I: Iterator<ComponentValue>>(iter: &mut Iter<I>) -> bool {
mod tests {
use sync::Arc;
use cssparser;
use servo_util::atom::Atom;
use servo_util::namespace;
use namespaces::NamespaceMap;
use super::*;

View file

@ -19,5 +19,8 @@ path = "../../support/rust-task_info"
[dependencies.string_cache]
git = "https://github.com/servo/string-cache"
[dependencies.string_cache_macros]
git = "https://github.com/servo/string-cache"
[dependencies.url]
git = "https://github.com/servo/rust-url"

View file

@ -1,43 +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/. */
//! Provides a wrapper around the Atom type in the string cache
//! crate. It's needed so that it can implement the Encodable
//! trait which is required by Servo.
use serialize::{Encoder, Encodable};
use std::fmt;
use std::hash::Hash;
use string_cache::atom;
#[deriving(Clone, Eq, Hash, PartialEq)]
pub struct Atom {
atom: atom::Atom,
}
impl Atom {
#[inline(always)]
pub fn from_slice(slice: &str) -> Atom {
Atom {
atom: atom::Atom::from_slice(slice)
}
}
#[inline(always)]
pub fn as_slice<'t>(&'t self) -> &'t str {
self.atom.as_slice()
}
}
impl fmt::Show for Atom {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:s}", self.atom.as_slice())
}
}
impl<E, S: Encoder<E>> Encodable<S, E> for Atom {
fn encode(&self, _s: &mut S) -> Result<(), E> {
Ok(())
}
}

View file

@ -29,7 +29,9 @@ extern crate "time" as std_time;
extern crate string_cache;
extern crate url;
pub mod atom;
#[phase(plugin)]
extern crate string_cache_macros;
pub mod bloom;
pub mod cache;
pub mod debug_utils;

7
ports/cef/Cargo.lock generated
View file

@ -299,6 +299,8 @@ dependencies = [
"plugins 0.0.1",
"script 0.0.1",
"script_traits 0.0.1",
"string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"style 0.0.1",
"url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)",
"util 0.0.1",
@ -409,6 +411,8 @@ dependencies = [
"net 0.0.1",
"plugins 0.0.1",
"script_traits 0.0.1",
"string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"style 0.0.1",
"url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)",
"util 0.0.1",
@ -486,6 +490,8 @@ dependencies = [
"geom 0.1.0 (git+https://github.com/servo/rust-geom#90add8d65273c8a46aa16d73959e29a51d0c282d)",
"lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs#e62a65372f1dd9019e37eb9381d819edff80e360)",
"plugins 0.0.1",
"string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)",
"util 0.0.1",
]
@ -509,6 +515,7 @@ dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure#b357751c04a89a87e6ef1f0cebe5f20957dd112d)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom#90add8d65273c8a46aa16d73959e29a51d0c282d)",
"string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
"task_info 0.0.1",
"url 0.1.0 (git+https://github.com/servo/rust-url#29f70a47230c2aa736e263977247c786e0b2c243)",
]