Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
commit e99e61a63fc801917bca695475fa0b2bf297d52f
Author: Patrick Walton <pcwalton@mimiga.net>
Date: Thu Mar 24 10:52:23 2016 -0700
Native allocator
diff --git a/components/profile/lib.rs b/components/profile/lib.rs
index 53b7fa0..3b33e1d 100644
--- a/components/profile/lib.rs
+++ b/components/profile/lib.rs
@@ -2,7 +2,6 @@
* 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/. */
-#![feature(alloc_jemalloc)]
#![feature(box_syntax)]
#![feature(iter_arith)]
#![feature(plugin)]
@@ -10,8 +9,6 @@
#![deny(unsafe_code)]
-#[cfg(not(target_os = "windows"))]
-extern crate alloc_jemalloc;
extern crate hbs_pow;
extern crate ipc_channel;
extern crate libc;
diff --git a/components/profile/mem.rs b/components/profile/mem.rs
index 398bcab..6ea598c 100644
--- a/components/profile/mem.rs
+++ b/components/profile/mem.rs
@@ -457,49 +457,6 @@ mod system_reporter {
None
}
- extern {
- #[cfg_attr(any(target_os = "macos", target_os = "android"), link_name = "je_mallctl")]
- fn mallctl(name: *const c_char, oldp: *mut c_void, oldlenp: *mut size_t,
- newp: *mut c_void, newlen: size_t) -> c_int;
- }
-
- #[cfg(not(target_os = "windows"))]
- fn jemalloc_stat(value_name: &str) -> Option<usize> {
- // Before we request the measurement of interest, we first send an "epoch"
- // request. Without that jemalloc gives cached statistics(!) which can be
- // highly inaccurate.
- let epoch_name = "epoch";
- let epoch_c_name = CString::new(epoch_name).unwrap();
- let mut epoch: u64 = 0;
- let epoch_ptr = &mut epoch as *mut _ as *mut c_void;
- let mut epoch_len = size_of::<u64>() as size_t;
-
- let value_c_name = CString::new(value_name).unwrap();
- let mut value: size_t = 0;
- let value_ptr = &mut value as *mut _ as *mut c_void;
- let mut value_len = size_of::<size_t>() as size_t;
-
- // Using the same values for the `old` and `new` parameters is enough
- // to get the statistics updated.
- let rv = unsafe {
- mallctl(epoch_c_name.as_ptr(), epoch_ptr, &mut epoch_len, epoch_ptr,
- epoch_len)
- };
- if rv != 0 {
- return None;
- }
-
- let rv = unsafe {
- mallctl(value_c_name.as_ptr(), value_ptr, &mut value_len, null_mut(), 0)
- };
- if rv != 0 {
- return None;
- }
-
- Some(value as usize)
- }
-
- #[cfg(target_os = "windows")]
fn jemalloc_stat(value_name: &str) -> Option<usize> {
None
}
diff --git a/components/script/dom/mouseevent.rs b/components/script/dom/mouseevent.rs
index 3acebff..2216bb6 100644
--- a/components/script/dom/mouseevent.rs
+++ b/components/script/dom/mouseevent.rs
@@ -34,6 +34,12 @@ pub struct MouseEvent {
related_target: MutNullableHeap<JS<EventTarget>>,
}
+impl Drop for MouseEvent {
+ fn drop(&mut self) {
+ println!("destroying MouseEvent");
+ }
+}
+
impl MouseEvent {
fn new_inherited() -> MouseEvent {
MouseEvent {
diff --git a/components/servo/main.rs b/components/servo/main.rs
index 8033110..f6f91e3 100644
--- a/components/servo/main.rs
+++ b/components/servo/main.rs
@@ -15,7 +15,7 @@
//!
//! [glutin]: https://github.com/tomaka/glutin
-#![feature(start)]
+#![feature(alloc_system, start)]
#[cfg(target_os = "android")]
#[macro_use]
@@ -31,6 +31,7 @@ extern crate log;
extern crate offscreen_gl_context;
// The Servo engine
extern crate servo;
+extern crate alloc_system;
use gleam::gl;
use offscreen_gl_context::{GLContext, NativeGLContext};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.