Commit graph

58 commits

Author SHA1 Message Date
Ralph Giles
135bcacee4 Use the correct .png extension for the image placeholder.
This was changed to the mozilla broken image resource
without changing the filename, even though the file
type changed.
2015-11-13 11:45:09 -08:00
bors-servo
4848e37e2e Auto merge of #7844 - Wafflespeanut:requests, r=jdm
Cancelable network requests!

fixes #4974

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7844)
<!-- Reviewable:end -->
2015-11-12 18:59:58 +05:30
Ravi Shankar
10f5584f78 Implement cancellation listener for cancelling network requests 2015-11-12 14:02:59 +05:30
rohan.prinja
51012d17c1 replace use of load_whole_resource in net/image_cache_task.rs with File::open
don't ignore read_to_end's return value
2015-11-10 00:09:17 +09:00
Abhishek Kumar
b7de946205 Check in for task 1,4 and 5
Adding pipelineID to httpresponse message, clearner code for task1

Commit for Refactored task

Unit tests

Removing extra whitespaces.

Removing extra whitespaces.

Removing tabs whitespaces

Making Code tidier.

Style issues Fix

Test-tidy Fixes
2015-11-05 00:17:24 -05:00
David Rajchenbach-Teller
b7f59691ec Rework image_cache_task to avoid using url as key during the loading of an image.
A `url` can be very large, in particular if it is a data: url, so using it as a key for lookups whenever we load a few bytes is not a very good idea. This patch introduces an intermediate `LoadKey` (internally, an u64) that makes hashmap lookups faster. Somewhere along the way, we also get rid of a few calls to `url.clone()`.
2015-10-14 08:08:31 +02:00
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
João Oliveira
067a22a868 Replace uses of for foo in bar.iter(),
and `for foo in bar.iter_mut(), and for foo in bar.into_iter()
(continuation of #7197)
2015-08-18 01:46:11 +01:00
João Oliveira
9c11781880 replace .len() == 0 with is_empty()
closes #7198
2015-08-14 04:00:33 +01:00
Patrick Walton
2aa5174246 script: Make the resource task communication use IPC channels. 2015-07-31 11:28:09 -07:00
Patrick Walton
44d13f7fd4 net: Use a thread for each AsyncResponseTarget to avoid having to send
trait objects across process boundaries.
2015-07-31 11:27:49 -07:00
Patrick Walton
9c9d7dc93b net: Make most of the resource task messages serializable. 2015-07-31 11:27:49 -07:00
Patrick Walton
82b53d83ff script: Make the ImageCacheTask use IPC.
This necessitated getting rid of the boxed trait object that was being
be passed between the script task and the image cache task.
2015-07-26 23:07:44 -07:00
Manish Goregaokar
c73eaefc47 Audit and reduce unstable usage in net
Reasons behind existing unstable features:

std_misc:

 - `Handle` usage (API will be replaced and is perhaps broken)

path_ext:

 - Checking if a file exists. This is doable from the File directly, but slightly longer

core:

 - `FnBox`

alloc:

 - `boxed::into_raw()` (naming)
2015-06-10 00:15:09 +05:30
Corey Farwell
8e3f4bba85 Reduce max line length from 150 to 120 characters
Part of https://github.com/servo/servo/issues/6041
2015-05-24 00:01:49 -04:00
Patrick Walton
7e7675c1dc net: Don't load the placeholder image for background images, only for
image fragments.

This also changes the way the placeholder is handled in the image cache
task to decode it up front instead of each time an image fails to load,
both because it was more convenient to implement that way and because
it saves CPU cycles to do so.

This matches the behavior of Gecko and WebKit. It improves the look of
our cached copy of Wikipedia.
2015-05-20 12:00:33 -07:00
bors-servo
892a740426 Auto merge of #5985 - zmike:embedding-woodenbikeshed, r=larsbergstrom
Some small changes.

@larsbergstrom or whoever cares the most at this exact moment.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5985)
<!-- Reviewable:end -->
2015-05-08 15:03:52 -05:00
Adenilson Cavalcanti
2aa95f6928 This was done already on #5783, maybe was reintroduced by mistake. 2015-05-08 11:39:02 -07:00
Mike Blumenkrantz
f588c0be73 image_cache_task::new_image_cache_task() should not panic when placeholder fails to load
now we just print a message and continue
2015-05-08 12:54:06 -04:00
Himaja
01eb31ae8a 1. Add an Option<Pipeline_id> field to the LoadData struct, and a corresponding parameter to LoadData::new()
2. Change addEvent in the NetworkEventActor to add_request and add_response
2015-05-05 12:31:40 -04:00
Ms2ger
6a55ae06d7 Remove some as_slice calls. 2015-04-24 17:44:47 +02:00
Glenn Watson
d8aef7208e Refactored image cache task - details below.
* Simpler image cache API for clients to use.
 * Significantly fewer threads.
   * One thread for image cache task (multiplexes commands, decoder threads and async resource requests).
   * 4 threads for decoder worker tasks.
 * Removed ReflowEvent hacks in script and layout tasks.
   * Image elements pass a Trusted<T> to image cache, which is used to dirty nodes via script task. Previous use of Untrusted addresses was unsafe.
   * Image requests such as background-image on layout / paint threads trigger repaint only rather than full reflow.
 * Add reflow batching for when multiple images load quickly.
   * Reduces the number of paints loading wikipedia from ~95 to ~35.
 * Reasonably simple to add proper prefetch support in a follow up PR.
 * Async loaded images always construct Image fragments now, instead of generic.
   * Image fragments support the image not being present.
 * Simpler implementation of synchronous image loading for reftests.
 * Removed image holder.
 * image.onload support.
 * image NaturalWidth and NaturalHeight support.
 * Updated WPT expectations.
2015-04-23 09:40:24 +10:00
Adenilson Cavalcanti
0f5b5a5cd4 Using FF broken image icon.
Got it from:
https://mxr.mozilla.org/mozilla-central/source/layout/generic/broken-image.png
2015-04-21 16:04:28 -07:00
Aneesh Agrawal
395e8a5981 Make minor syntax simplification to address review. 2015-04-13 17:23:03 -04:00
Aneesh Agrawal
5b593a3d32 Switch Arc<Box<Image>> to Arc<Image> for perf boost.
Image used to be a trait, but no longer is, so boxing it is no longer
necessary.
2015-04-10 18:59:02 -04:00
Aneesh Agrawal
a1d7456307 Remove compositor dependency on net crate.
Move the ImageCacheTaskClient trait and impl to net_traits. Fixes #5551.
2015-04-10 06:11:31 -04:00
Simon Sapin
d88770e09f Move net::{data_loader,image_cache_task} unit tests into the unit_tests crate. 2015-04-08 01:07:50 +02:00
Josh Matthews
4a78da1158 Fix unit tests. 2015-04-07 13:25:16 -04:00
Gilles Leblanc
ba36a108c1 Split out shared networking code into net_traits crate
Fixes #4476
2015-04-03 13:38:10 -04:00
Adenilson Cavalcanti
cdebb3ca54 Load a placeholder when a url to an image is broken.
I decided to use the old Netscape broken image link icon (later we may
replace the image asset for something more trendier). The ref test will
expect that a failed load should display the rippy image.

ImageCacheTask users can define if a placeholder image should be loaded
at start up or not. This enables both the new behavior (e.g. always
return an image even for broken urls) as also the previous one.
2015-03-30 10:02:54 -07:00
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
Ms2ger
ba87666cdb Update some code that's feature-gated under core. 2015-03-21 18:44:39 +01:00
Ms2ger
5f15eb5fbf Upgrade rustc to d3c49d2140fc65e8bb7d7cf25bfe74dda6ce5ecf/rustc-1.0.0-dev. 2015-03-18 13:18:31 -04:00
Ankit Agrawal
c8de895094 Add profiling to image decoding.
This extracts some independently useful parts of
<https://github.com/servo/servo/pull/4215>.
2015-02-28 18:35:48 +01:00
Josh Matthews
14df9f8a70 Differentiate between HTTP and non-HTTP APIs for cookie operations. Fix some incorrect cookie removal operation logic. Order the returned cookies according to the spec. Make cookie unit tests pass. 2015-02-04 13:35:05 +00:00
Shamir Khodzha
3239aeacdc cookies and cookies storage implementation 2015-02-04 13:34:06 +00:00
Alexandru Cojocaru
685fee02a0 add unwrap to send/recv calls 2015-02-03 16:05:13 +01:00
Ms2ger
505159a464 Import the util crate as util rather than servo_util.
This used to conflict with the util crate from the standard library, which
has long since been removed.

The import in layout has not been changed because of a conflict with the
util mod there.
2015-01-29 12:16:41 +01:00
Josh Matthews
95fc29fa0d Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev. 2015-01-28 10:16:49 +10:00
Ms2ger
808315926c Pass a String to spawn_named.
IntoString has been removed from Rust, and named() will take a String, so
there is no good reason to do otherwise here.
2015-01-21 11:23:19 +01:00
Ms2ger
16c7060bc8 Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19. 2015-01-08 09:58:46 -05:00
Ms2ger
d3e226239e Don't qualify Ok/Err in image_cache_task. 2015-01-04 11:59:23 +01:00
Ms2ger
b51e83819d Fix obsolete format traits.
They are to be removed from the language in the next rust upgrade.
2015-01-02 19:04:18 +01:00
Tetsuharu OHZEKI
07b1c0e652 net: Remove glob imports added in #4405 2014-12-19 00:47:09 +09:00
Ms2ger
466faac2a5 Update rustc to revision 3dcd2157403163789aaf21a9ab3c4d30a7c6494d. 2014-12-17 15:19:45 -05:00
Joseph Crail
c254d195ad Fix spelling mistakes in comments. 2014-12-11 23:56:29 -05:00
Kshitij Parajuli
f5e9ae17cf Shared Sniffer Task
- Added TargetedLoadResponse and ResponseSenders
- LoadData constructor contains the next consumer which means
  SnifferManager doesn't need the next consumer to start
- New SnifferTask is created at new resource_task creation
- Update Unit Tests
2014-11-28 12:35:49 -05:00
Jack Moffitt
d1b433a3b3 Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8a 2014-11-13 11:17:43 +10:00