Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Commit 6e7a145

Browse files
committed
Remove dependency on heapsize_plugin (fixes #243)
1 parent 3d71ebc commit 6e7a145

File tree

9 files changed

+40
-28
lines changed

9 files changed

+40
-28
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ rust:
2121

2222
script:
2323
- cargo test
24-
- ([ $TRAVIS_RUST_VERSION != nightly ] || cargo test --features plugins)
24+
- cargo test --features heapsize
2525

2626
notifications:
2727
webhooks: http://build.servo.org:54856/travis

Cargo.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[package]
22

33
name = "layers"
4-
version = "0.5.2"
4+
version = "0.5.3"
55
authors = ["The Servo Project Developers"]
66
license = "MIT/Apache-2.0"
77

88
[features]
99
default = []
10-
plugins = ["heapsize", "heapsize_plugin"]
10+
plugins = ["heapsize"]
1111

1212
[dependencies]
1313
libc = "0.2"
@@ -21,10 +21,6 @@ servo-skia = "0.20130412.23"
2121
version = ">=0.2.2, <0.4"
2222
optional = true
2323

24-
[dependencies.heapsize_plugin]
25-
version = "0.1.2"
26-
optional = true
27-
2824
[target.x86_64-apple-darwin.dependencies]
2925
core-foundation = "0.2.0"
3026
cgl = "0.1"

src/color.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
// except according to those terms.
99

1010
#[derive(Copy, Clone, Debug)]
11-
#[cfg_attr(feature = "plugins", derive(HeapSizeOf))]
1211
pub struct Color {
1312
pub r: f32,
1413
pub g: f32,
1514
pub b: f32,
1615
pub a: f32,
1716
}
17+
18+
#[cfg(feature = "heapsize")]
19+
known_heap_size!(0, Color);

src/geometry.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@
1313
///
1414
/// This unit corresponds to the smallest addressable element of the display hardware.
1515
#[derive(Copy, Clone, RustcEncodable, Debug)]
16-
#[cfg_attr(feature = "plugins", derive(HeapSizeOf))]
1716
pub enum DevicePixel {}
1817

18+
#[cfg(feature = "heapsize")]
19+
known_heap_size!(0, DevicePixel);
20+
1921
/// One pixel in layer coordinate space.
2022
///
2123
/// This unit corresponds to a "pixel" in layer coordinate space, which after scaling and
2224
/// transformation becomes a device pixel.
2325
#[derive(Copy, Clone, RustcEncodable, Debug)]
24-
#[cfg_attr(feature = "plugins", derive(HeapSizeOf))]
2526
pub enum LayerPixel {}
2627

27-
28+
#[cfg(feature = "heapsize")]
29+
known_heap_size!(0, LayerPixel);

src/layers.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ use std::rc::Rc;
2222
use util::{project_rect_to_screen, ScreenRect};
2323

2424
#[derive(Clone, Copy, PartialEq, PartialOrd)]
25-
#[cfg_attr(feature = "plugins", derive(HeapSizeOf))]
2625
pub struct ContentAge {
2726
age: usize,
2827
}
2928

29+
#[cfg(feature = "heapsize")]
30+
known_heap_size!(0, ContentAge);
31+
3032
impl ContentAge {
3133
pub fn new() -> ContentAge {
3234
ContentAge {
@@ -39,7 +41,6 @@ impl ContentAge {
3941
}
4042
}
4143

42-
#[cfg_attr(feature = "plugins", derive(HeapSizeOf))]
4344
pub struct TransformState {
4445
/// Final, concatenated transform + perspective matrix for this layer
4546
pub final_transform: Matrix4D<f32>,
@@ -54,6 +55,9 @@ pub struct TransformState {
5455
pub has_transform: bool,
5556
}
5657

58+
#[cfg(feature = "heapsize")]
59+
known_heap_size!(0, TransformState);
60+
5761
impl TransformState {
5862
fn new() -> TransformState {
5963
TransformState {

src/lib.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,9 @@
1010
#![crate_name = "layers"]
1111
#![crate_type = "rlib"]
1212

13-
#![cfg_attr(feature = "plugins", feature(core_intrinsics))]
14-
#![cfg_attr(feature = "plugins", feature(custom_attribute))]
15-
#![cfg_attr(feature = "plugins", feature(custom_derive))]
16-
#![cfg_attr(feature = "plugins", feature(plugin))]
17-
18-
#![cfg_attr(feature = "plugins", plugin(heapsize_plugin))]
19-
2013
extern crate euclid;
21-
#[cfg(feature = "plugins")]
14+
#[cfg(feature = "heapsize")]
15+
#[macro_use]
2216
extern crate heapsize;
2317
extern crate libc;
2418
#[macro_use]

src/rendergl.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ use std::rc::Rc;
2626
use std::cmp::Ordering;
2727

2828
#[derive(Copy, Clone, Debug)]
29-
#[cfg_attr(feature = "plugins", derive(HeapSizeOf))]
3029
pub struct ColorVertex {
3130
x: f32,
3231
y: f32,
3332
}
3433

34+
#[cfg(feature = "heapsize")]
35+
known_heap_size!(0, ColorVertex);
36+
3537
impl ColorVertex {
3638
pub fn new(point: Point2D<f32>) -> ColorVertex {
3739
ColorVertex {
@@ -42,14 +44,16 @@ impl ColorVertex {
4244
}
4345

4446
#[derive(Copy, Clone, Debug)]
45-
#[cfg_attr(feature = "plugins", derive(HeapSizeOf))]
4647
pub struct TextureVertex {
4748
x: f32,
4849
y: f32,
4950
u: f32,
5051
v: f32,
5152
}
5253

54+
#[cfg(feature = "heapsize")]
55+
known_heap_size!(0, TextureVertex);
56+
5357
impl TextureVertex {
5458
pub fn new(point: Point2D<f32>, texture_coordinates: Point2D<f32>) -> TextureVertex {
5559
TextureVertex {

src/texturegl.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,35 @@ use gleam::gl;
1616
use gleam::gl::{GLenum, GLint, GLuint};
1717

1818
#[derive(Copy, Clone)]
19-
#[cfg_attr(feature = "plugins", derive(HeapSizeOf))]
2019
pub enum Format {
2120
ARGB32Format,
2221
RGB24Format
2322
}
2423

24+
#[cfg(feature = "heapsize")]
25+
known_heap_size!(0, Format);
26+
2527
#[derive(Copy, Clone)]
26-
#[cfg_attr(feature = "plugins", derive(HeapSizeOf))]
2728
pub enum FilterMode {
2829
Nearest,
2930
Linear
3031
}
3132

33+
#[cfg(feature = "heapsize")]
34+
known_heap_size!(0, FilterMode);
35+
3236
/// The texture target.
3337
#[derive(Copy, Clone)]
34-
#[cfg_attr(feature = "plugins", derive(HeapSizeOf))]
3538
pub enum TextureTarget {
3639
/// TEXTURE_2D.
3740
TextureTarget2D,
3841
/// TEXTURE_RECTANGLE_ARB, with the size included.
3942
TextureTargetRectangle,
4043
}
4144

45+
#[cfg(feature = "heapsize")]
46+
known_heap_size!(0, TextureTarget);
47+
4248
impl TextureTarget {
4349

4450
#[cfg(not(target_os = "android"))]
@@ -205,10 +211,12 @@ impl Texture {
205211

206212
/// Whether a texture should be flipped.
207213
#[derive(PartialEq, Copy, Clone)]
208-
#[cfg_attr(feature = "plugins", derive(HeapSizeOf))]
209214
pub enum Flip {
210215
/// The texture should not be flipped.
211216
NoFlip,
212217
/// The texture should be flipped vertically.
213218
VerticalFlip,
214219
}
220+
221+
#[cfg(feature = "heapsize")]
222+
known_heap_size!(0, Flip);

src/util.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ use std::f32;
1616
const W_CLIPPING_PLANE: f32 = 0.00001;
1717

1818
#[derive(Debug)]
19-
#[cfg_attr(feature = "plugins", derive(HeapSizeOf))]
2019
pub struct ScreenRect {
2120
pub rect: Rect<f32>,
2221
pub z_center: f32,
2322
}
2423

24+
#[cfg(feature = "heapsize")]
25+
known_heap_size!(0, ScreenRect);
26+
2527
pub fn convert_rgb32_to_rgb24(buffer: &[u8]) -> Vec<u8> {
2628
let mut i = 0;
2729
repeat(buffer.len() * 3 / 4).map(|j| {

0 commit comments

Comments
 (0)