mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
use HeapSizeOf plugin in gfx
This commit is contained in:
parent
f4bc92526a
commit
c1daf889af
5 changed files with 22 additions and 21 deletions
|
@ -1,3 +1,6 @@
|
|||
/* 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 syntax::ext::base::{Annotatable, ExtCtxt};
|
||||
use syntax::codemap::Span;
|
||||
|
@ -7,7 +10,8 @@ use syntax::attr::AttrMetaMethods;
|
|||
use syntax::ext::build::AstBuilder;
|
||||
use syntax::ext::deriving::generic::*;
|
||||
|
||||
pub fn expand_heapsize(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, item: Annotatable, push: &mut FnMut(Annotatable)) {
|
||||
pub fn expand_heapsize(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem,
|
||||
item: Annotatable, push: &mut FnMut(Annotatable)) {
|
||||
let trait_def = TraitDef {
|
||||
span: span,
|
||||
attributes: Vec::new(),
|
||||
|
@ -40,7 +44,7 @@ fn heapsize_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructu
|
|||
fields.iter().fold(cx.expr_usize(trait_span, 0),
|
||||
|acc, ref item| {
|
||||
if item.attrs.iter()
|
||||
.find(|ref a| a.check_name("ignore_heapsize"))
|
||||
.find(|ref a| a.check_name("ignore_heap_size"))
|
||||
.is_some() {
|
||||
acc
|
||||
} else {
|
||||
|
|
|
@ -8,9 +8,10 @@
|
|||
//!
|
||||
//! - `#[privatize]` : Forces all fields in a struct/enum to be private
|
||||
//! - `#[jstraceable]` : Auto-derives an implementation of `JSTraceable` for a struct in the script crate
|
||||
//! - `#[must_root]` : Prevents data of the marked type from being used on the stack. See the lints module for more details
|
||||
//! - `#[must_root]` : Prevents data of the marked type from being used on the stack.
|
||||
//! See the lints module for more details
|
||||
//! - `#[dom_struct]` : Implies `#[privatize]`,`#[jstraceable]`, and `#[must_root]`.
|
||||
//! Use this for structs that correspond to a DOM type
|
||||
//! Use this for structs that correspond to a DOM type
|
||||
|
||||
#![feature(plugin_registrar, quote, plugin, box_syntax, rustc_private, collections)]
|
||||
|
||||
|
@ -45,7 +46,6 @@ pub fn plugin_registrar(reg: &mut Registry) {
|
|||
reg.register_syntax_extension(intern("jstraceable"), MultiDecorator(box jstraceable::expand_jstraceable));
|
||||
reg.register_syntax_extension(intern("_generate_reflector"), MultiDecorator(box reflector::expand_reflector));
|
||||
reg.register_syntax_extension(intern("derive_HeapSizeOf"), MultiDecorator(box heapsize::expand_heapsize));
|
||||
reg.register_syntax_extension(intern("heapsize"), MultiDecorator(box heapsize::expand_heapsize));
|
||||
reg.register_macro("to_lower", casing::expand_lower);
|
||||
reg.register_macro("to_upper", casing::expand_upper);
|
||||
reg.register_lint_pass(box lints::transmute_type::TransmutePass as LintPassObject);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue