diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-08-13 13:16:14 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-08-13 13:16:14 -0600 |
commit | a03616f379c255cc6c9b6e1d04dd7d98bd9926ce (patch) | |
tree | 0081f3c1bb513706b406a61fba0f73449cbc5ba4 /components/script/textinput.rs | |
parent | f3b7c5cb4b0fab20db51b7560c3b3bb2d115be69 (diff) | |
parent | 45145108daa6af7e834a7c23530857c504b54b9c (diff) | |
download | servo-a03616f379c255cc6c9b6e1d04dd7d98bd9926ce.tar.gz servo-a03616f379c255cc6c9b6e1d04dd7d98bd9926ce.zip |
Auto merge of #7097 - boghison:memtypes, r=jdm
Measure heap memory usage for more types. Fixes #6951
Also adds HeapSizeOf implementations/derive for some types. I've used "Cannot calculate Heap size" as a reason everywhere, because my imagination is rather limited. If you'd like me to change this message for specific types, please write something like this: "Trusted - Cannot calculate Heap size for Trusted" so that it would be easier for me to replace them through a script :)
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7097)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/textinput.rs')
-rw-r--r-- | components/script/textinput.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/components/script/textinput.rs b/components/script/textinput.rs index a88f2bf491a..31fc7dc2e25 100644 --- a/components/script/textinput.rs +++ b/components/script/textinput.rs @@ -8,6 +8,7 @@ use clipboard_provider::ClipboardProvider; use dom::keyboardevent::{KeyboardEvent, KeyboardEventHelpers, key_value}; use msg::constellation_msg::{SHIFT, CONTROL, ALT, SUPER}; use msg::constellation_msg::{Key, KeyModifiers}; +use util::mem::HeapSizeOf; use util::str::{DOMString, slice_chars}; use std::borrow::ToOwned; @@ -21,7 +22,7 @@ pub enum Selection { NotSelected } -#[derive(JSTraceable, Copy, Clone)] +#[derive(JSTraceable, Copy, Clone, HeapSizeOf)] pub struct TextPoint { /// 0-based line number pub line: usize, @@ -30,7 +31,7 @@ pub struct TextPoint { } /// Encapsulated state for handling keyboard input in a single or multiline text input control. -#[derive(JSTraceable)] +#[derive(JSTraceable, HeapSizeOf)] pub struct TextInput<T: ClipboardProvider> { /// Current text input content, split across lines without trailing '\n' lines: Vec<DOMString>, @@ -40,6 +41,7 @@ pub struct TextInput<T: ClipboardProvider> { selection_begin: Option<TextPoint>, /// Is this a multiline input? multiline: bool, + #[ignore_heap_size_of = "Can't easily measure this generic type"] clipboard_provider: T, } |