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

style: sync changes from mozilla-central #23503

Merged
merged 17 commits into from Jun 4, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

style: Rejigger a bit rust features so that rusttests still link.

We cannot compile with just feature(gecko + debug_assertions), since that's how
debug rusttests get compiled and they don't have the refcount logging stuff.

We were getting away with it for the pre-existing usage of the style crate,
because it wasn't used during any test and presumably the linker didn't
complain. But servo_arc is definitely used in tests.

Differential Revision: https://phabricator.services.mozilla.com/D32691
  • Loading branch information
emilio committed Jun 4, 2019
commit 3652a0f1e1babfdb3906803b9a081d7e42e8b2d8
@@ -12,7 +12,7 @@ path = "lib.rs"

[features]
servo = ["serde"]
gecko = []
gecko_refcount_logging = []

[dependencies]
nodrop = {version = "0.1.8"}
@@ -177,7 +177,7 @@ impl<T> Arc<T> {
data,
}));

#[cfg(all(feature = "gecko", debug_assertions))]
#[cfg(feature = "gecko_refcount_logging")]
unsafe {
// FIXME(emilio): Would be so amazing to have
// std::intrinsics::type_name() around, so that we could also report
@@ -312,7 +312,7 @@ impl<T: ?Sized> Arc<T> {

#[inline(always)]
fn record_drop(&self) {
#[cfg(all(feature = "gecko", debug_assertions))]
#[cfg(feature = "gecko_refcount_logging")]
unsafe {
NS_LogDtor(self.ptr() as *const _, b"ServoArc\0".as_ptr() as *const _, 8);
}
@@ -348,7 +348,7 @@ impl<T: ?Sized> Arc<T> {
}
}

#[cfg(all(feature = "gecko", debug_assertions))]
#[cfg(feature = "gecko_refcount_logging")]
extern "C" {
fn NS_LogCtor(aPtr: *const std::os::raw::c_void, aTypeName: *const std::os::raw::c_char, aSize: u32);
fn NS_LogDtor(aPtr: *const std::os::raw::c_void, aTypeName: *const std::os::raw::c_char, aSize: u32);
@@ -745,7 +745,7 @@ impl<H, T> Arc<HeaderSlice<H, [T]>> {
);
}

#[cfg(all(feature = "gecko", debug_assertions))]
#[cfg(feature = "gecko_refcount_logging")]
unsafe {
if !is_static {
// FIXME(emilio): Would be so amazing to have
@@ -22,6 +22,7 @@ servo = ["serde", "style_traits/servo", "servo_atoms", "servo_config", "html5eve
"cssparser/serde", "encoding_rs", "malloc_size_of/servo", "arrayvec/use_union",
"servo_url", "string_cache", "crossbeam-channel", "to_shmem/servo", "servo_arc/servo"]
gecko_debug = []
gecko_refcount_logging = []
gecko_profiler = []

[dependencies]
@@ -755,7 +755,7 @@ unsafe impl Sync for RuleTree {}
unsafe impl Send for RuleTree {}

// On Gecko builds, hook into the leak checking machinery.
#[cfg(all(feature = "gecko", debug_assertions))]
#[cfg(feature = "gecko_refcount_logging")]
mod gecko_leak_checking {
use super::RuleNode;
use std::mem::size_of;
@@ -788,13 +788,13 @@ mod gecko_leak_checking {

#[inline(always)]
fn log_new(_ptr: *const RuleNode) {
#[cfg(all(feature = "gecko", debug_assertions))]
#[cfg(feature = "gecko_refcount_logging")]
gecko_leak_checking::log_ctor(_ptr);
}

#[inline(always)]
fn log_drop(_ptr: *const RuleNode) {
#[cfg(all(feature = "gecko", debug_assertions))]
#[cfg(feature = "gecko_refcount_logging")]
gecko_leak_checking::log_dtor(_ptr);
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.