Commit graph

122 commits

Author SHA1 Message Date
Nicholas Nethercote
ce36e574f4 Rename lots of profiling-related things.
------------------------------------------------------------------------
BEFORE                              AFTER
------------------------------------------------------------------------
util::memory                        util::mem
- heap_size_of                      - heap_size_of (unchanged)
- SizeOf                            - HeapSizeOf
  - size_of_excluding_self            - heap_size_of_children

prof::mem                           prof::mem
- MemoryProfilerChan                - ProfilerChan
- MemoryReport                      - Report
- MemoryReportsChan                 - ReportsChan
- MemoryReporter                    - Reporter
- MemoryProfilerMsg                 - ProfilerMsg
  - {R,UnR}egisterMemoryReporter      - {R,UnR}egisterReporter
- MemoryProfiler                    - Prof
- ReportsForest                     - ReportsForest (unchanged)
- ReportsTree                       - ReportsTree   (unchanged)
- SystemMemoryReporter              - SystemReporter

prof::time                          prof::time
- TimeProfilerChan                  - ProfilerChan
- TimerMetadata                     - TimerMetadata (unchanged)
- Formatable                        - Formattable [spelling!]
- TimeProfilerMsg                   - ProfilerMsg
- TimeProfilerCategory              - ProfilerCategory
- TimeProfilerBuckets               - ProfilerBuckets
- TimeProfiler                      - Profiler
- TimerMetadataFrameType            - TimerMetadataFrameType (unchanged)
- TimerMetadataReflowType           - TimerMetadataReflowType (unchanged)
- ProfilerMetadata                  - ProfilerMetadata (unchanged)

In a few places both prof::time and prof::mem are used, and so
module-qualification is needed to avoid overlap, e.g. time::Profiler and
mem::Profiler. Likewise with std::mem and prof::mem. This is not a big
deal.
2015-03-25 16:00:23 -07:00
Nicholas Nethercote
52447ccd9b Move profiler code from util into a new crate profile.
- Most of util::memory has been moved into profile::mem, though the
  `SizeOf` trait and related things remain in util::memory. The
  `SystemMemoryReporter` code is now in a submodule
  profile::mem::system_reporter.

- util::time has been moved entirely into profile::time.
2015-03-24 02:09:31 -07:00
Nicholas Nethercote
fe3e93225b Print trees in the memory profiler's output.
Memory reports are much nicer to read when grouped into trees, which requires giving each report a path instead of a name.

Sample output:
```
Begin memory reports
|
|    2.51 MiB -- pages
|       2.51 MiB -- url(file:///home/njn/moz/servo/../servo-static-suite/wikipedia/Guardians%20of%20the%20Galaxy%20(film)%20-%20Wikipedia,%20the%20free%20encyclopedia.html)
|          2.51 MiB -- display-list
|
|  238.89 MiB -- resident-according-to-smaps
|     188.31 MiB -- anonymous (rw-p)
|      27.29 MiB -- /home/njn/moz/servo/components/servo/target/debug/servo (r-xp)
|       7.82 MiB -- other
|       6.65 MiB -- [heap] (rw-p)
|       3.55 MiB -- /usr/lib/x86_64-linux-gnu/dri/i965_dri.so (r-xp)
|       1.42 MiB -- /lib/x86_64-linux-gnu/libc-2.19.so (r-xp)
|       1.13 MiB -- /home/njn/moz/servo/components/servo/target/debug/servo (r--p)
|       0.74 MiB -- /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0 (r-xp)
|       0.73 MiB -- /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20 (r-xp)
|       0.65 MiB -- /lib/x86_64-linux-gnu/libm-2.19.so (r-xp)
|       0.60 MiB -- /lib/x86_64-linux-gnu/libglib-2.0.so.0.4200.1 (r-xp)
|
|   71.08 MiB -- jemalloc-heap-active
|   59.11 MiB -- jemalloc-heap-allocated
|  180.00 MiB -- jemalloc-heap-mapped
|  232.87 MiB -- resident
|   54.43 MiB -- system-heap-allocated
| 3130.11 MiB -- vsize
|
End memory reports
```
2015-03-23 15:17:04 -07:00
Manish Goregaokar
3479d3fa7f Replace unsafe_blocks by unsafe_code. 2015-03-21 10:27:32 +01:00
Ms2ger
5f15eb5fbf Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev. 2015-03-18 13:18:31 -04:00
Patrick Walton
d10627a2b3 layout: Implement 2D CSS transforms per CSS-TRANSFORMS § 5, 6, 7, and 8. 2015-03-17 11:30:55 -07:00
Nicholas Nethercote
ece2711185 Add memory reporting infrastructure and use it to measure the display list.
This changeset implements the beginnings of fine-grained measurement of
Servo's data structures.

- It adds a new `SizeOf` trait, which is used to measure the memory used
  by heap data structures, and implements it for some std types: Box,
  String, Option, Arc, Vec, and DList.

- It adds a new `MemoryReporter` trait which is used to report memory
  measurements from other threads to the memory profiler. Reporters are
  registered and unregistered with the memory profiler, and the memory
  profiler makes measurement requests of reporters when necessary.

- It plumbs a MemoryProfilerChan through to the layout task so it can
  register a memory reporter.

- It implements the `SizeOf` trait for `DisplayList` and associated
  types, and adds a memory reporter that uses it.

The display list hits 14.77 MiB when viewing
tests/html/perf-rainbow.html, and 2.51 MiB when viewing the Guardians of
the Galaxy Wikipedia page from servo-static-suite. Example output:

  0.29: display-list::http://www.reddit.com/
  0.00: display-list::http://static.adzerk.net/reddit/ads.html?sr=-reddit.com,loggedout&bust2#http://www.reddit.com
  0.00: display-list::http://www.reddit.com/static/createadframe.html

There are a number of FIXME comments indicating sub-optimal things. This
is a big enough change for now that doing them as follow-ups seems best.
2015-03-16 18:12:26 -07:00
Nicholas Nethercote
5865d5f717 Rename LayoutTask::handle_script_request.
Because it handles requests from tasks other than the Script Task.
2015-03-16 18:05:36 -07:00
Jack Moffitt
237150fa49 Fix memory leak in flow tree by adding weak refs.
Cycles were being created in the flow tree since absolutely positioned
descendants had pointers to their containing blocks. This adds
WeakFlowRef (based on Weak<T>) and makes these backpointers weak
references. This also harmonizes our custom Arc<T>, FlowRef, to be
consistent with the upstream implementation.

Fixes #4915.
2015-03-16 12:53:16 -06:00
Mikko Perttunen
e7a06cd241 Consider media attribute on link and style tags
Don't add a stylesheet if the current device does not match the media
query specified in a link or style tag.
2015-03-16 17:19:26 +02:00
bors-servo
a50807051b auto merge of #5180 : luniv/servo/viewport-length-cached-values-invalidation, r=SimonSapin
When a viewport is resized, the computed values for a style containing viewport percentage length units become stale. However, there's no way for those styles to be invalidated after a resize. As a solution, this commit invalidates the computed values cache after a resize has occurred, which is probably over-kill.

A better solution would probably be to track under what conditions computed values remain valid, and invalidate them as indicated.
2015-03-13 09:36:50 -06:00
Patrick Walton
f9cdd05d58 layout: Implement ordered lists, CSS counters, and quotes per CSS 2.1
§ 12.3-12.5.

Only simple alphabetic and numeric counter styles are supported. (This
is most of them though.)

Although this PR adds a sequential pass to layout, I verified that on
pages that contain a reasonable number of ordered lists (Reddit
`/r/rust`), the time spent in generated content resolution is dwarfed by
the time spent in the parallelizable parts of layout. So I don't expect
this to negatively affect our parallelism expect perhaps in pathological
cases.
2015-03-09 17:13:45 -07:00
James Gilbertson
fafc357308 Fix broken viewport percentage length units after a viewport resize.
When a viewport is resized, the computed values for a style containing viewport percentage length units become stale. However, there's no way for those styles to be invalidated after a resize. As a solution, this commit invalidates the computed values cache after a resize has occurred, which is probably over-kill.

A better solution would probably be to track under what conditions computed values remain valid, and invalidate them as indicated.
2015-03-08 13:06:27 -06:00
Dan Fox
559ff68b31 Get rid of servo_util 2015-03-05 17:42:05 +00:00
Dan Fox
19686acdec Merge in servo/master 2015-03-05 17:34:18 +00:00
Glenn Watson
86baef2cc0 Remove compositor layers when iframes are removed from doc or display:none. 2015-03-04 07:51:46 +10:00
Dan Fox
3441b2c329 layout/layout_data.rs -> layout/data.rs 2015-03-03 19:59:38 +00:00
Dan Fox
3f9032c1a1 Re-alphabetise imports 2015-03-03 18:16:50 +00:00
Dan Fox
dd0df4e9c5 Rename util.rs -> layout_data.rs 2015-03-03 18:12:06 +00:00
Dan Fox
564d12435a Move ToGfxColor to display_list_builder.rs 2015-03-03 17:59:44 +00:00
Dan Fox
b424de2092 Extract OpaqueNodeMethods to own file 2015-03-03 17:49:10 +00:00
Glenn Watson
611fd7a846 Reap layout data whenever a node is removed from the tree.
Also introduce a clear() function to layout data which will be used to clear items such as compositor layouts.

Clear the layout data when a node becomes display:none.
2015-03-03 07:12:51 +10:00
Adenilson Cavalcanti
b9e9d7471d Implements a DisplayList dumper.
This patch will iterate through the DisplayList after the reflow
is done and print its elements (as also any sub-lists associated
to a child node stacking context).

It adds a new CLI parameter to trigger the function to dump the display list
to console (i.e. servo --debug dump-display-list url).

Using both display list and flow tree information is helpful to debug
rendering issues.
2015-02-25 19:10:05 -08:00
Glenn Watson
7aacf90161 Fixes background-color calculation for iframes. Fixes #1248 2015-02-16 08:16:18 +10:00
Ms2ger
a09a912178 Import net as net rather than servo_net. 2015-02-10 12:55:24 +01:00
Ms2ger
b2fcc2397e Import msg as msg rather than servo_msg. 2015-02-10 11:40:36 +01:00
Ms2ger
7c6b03abfe Opt-in rather than opt-out to unsafe blocks in layout. 2015-02-08 20:03:27 +01:00
Adenilson Cavalcanti
3088b8fc30 Using the new equality operator in LayoutTask. 2015-02-03 18:14:42 -08:00
Adenilson Cavalcanti
ffa23088ff Using the new transparent_black() in the proper places. 2015-02-03 18:08:30 -08:00
Martin Robinson
8855a25780 Revert "Using Color equality operators to streamline code" 2015-02-03 15:07:30 -08:00
Martin Robinson
728f723753 Merge pull request #4825 from Adenilson/usingColorOperators01
Using Color equality operators to streamline code
2015-02-03 11:12:44 -08:00
Adenilson Cavalcanti
cc404aba1a Using Color equality operators to streamline code in
PaintContext and LayoutTask.
2015-02-03 11:03:09 -08:00
Alexandru Cojocaru
685fee02a0 add unwrap to send/recv calls 2015-02-03 16:05:13 +01:00
Adenilson Cavalcanti
417ffca937 Implements 2 helper functions for Color type (white() and black())
and uses it in layout_task.rs.
2015-02-02 10:52:17 -08:00
Tetsuharu OHZEKI
9f57fa17d0 Add LayoutJS<Node>::from_trusted_node_address() 2015-02-01 01:54:38 +09:00
Tetsuharu OHZEKI
6b1e2bd11c Use LayoutJS<T> in layout crate. 2015-02-01 01:54:37 +09:00
Simon Sapin
d13d36f57f End the libstyle 'pub use' madness. 2015-01-30 15:08:29 +01:00
Manish Goregaokar
b68b7e87c8 self import 2015-01-28 13:46:00 +05:30
Josh Matthews
95fc29fa0d Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev. 2015-01-28 10:16:49 +10:00
Josh Matthews
d2f0aac5ce Make UntrustedNodeAddress a newtype.
This will allow us to make it Send after the Rust upgrade.
2015-01-24 11:40:21 +01:00
Ms2ger
13c7cf928a Stop calling deref() and deref_mut() explicitly. 2015-01-22 16:04:21 +01:00
Ms2ger
01ed338746 Move to to_owned rather than into_string.
into_string has been removed from Rust.
2015-01-20 14:49:07 +01:00
Patrick Walton
97d3443003 layout: Implement mix-blend-mode per COMPOSITING § 3.4.1.
`background-blend-mode` is not yet supported because we don't support
multiple backgrounds yet.
2015-01-12 08:02:41 -08:00
Patrick Walton
15d60d7ea4 layout: Implement filter per CSS-FILTERS § 5.
`blur` and `drop-shadow` are not yet supported, because the
`text-shadow` PR makes some fundamental changes to blur rendering that
are needed first.
2015-01-09 07:26:13 -08:00
Patrick Walton
899c9429d0 layout: Implement pointer-events: none per SVG 1.1 § 16.6.
SVG-only values are not yet supported.
2015-01-08 08:32:26 -08:00
Ms2ger
16c7060bc8 Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19. 2015-01-08 09:58:46 -05:00
Ms2ger
c4e44b568a Remove the unused native argument from spawn_named_with_send_on_failure. 2015-01-05 08:58:00 +01:00
Patrick Walton
bf540d590a layout: Explicitly thread border box dimensions and relative offsets
through display list building.

The old `flow_origin` concept was ill-defined (sometimes the border box
plus the flow origin, sometimes including horizontal margins and
sometimes not, sometimes including relative position and sometimes not),
leading to brittleness and test failures. This commit reworks the logic
to always pass border box origins in during display list building.
2015-01-04 17:43:05 -08:00
Patrick Walton
5ea2c6dcfd layout: Paint stacking contexts' overflow areas properly.
This was making `box-shadow` not show up in many cases, in particular,
but the effects were not limited to that.
2015-01-04 17:41:59 -08:00
bors-servo
ba8cf6b0e6 auto merge of #4542 : servo/servo/pre-rustup_20141221, r=saneyuki
In particular, this contains changes to qualify enums where rust will require it, and to stop using some features that will be removed.
2015-01-04 12:39:47 -07:00