Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing C libraries with Rust equivalents - student project #4215

Closed
wants to merge 29 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c4156d4
Initial commit for migrating to freetype-rs library from rust-freetype
ankit3005 Nov 29, 2014
66623ea
added constant to freetype_rs library ft_sfnt_os2
ankit3005 Nov 29, 2014
ff891d8
Changed freetyp-rs dependency to local fork on github
ankit3005 Nov 29, 2014
754a841
Changes to use DynamicImage type from the new rust image library
anishashetty Nov 30, 2014
254e9c9
fix in Cargo.lock after updating freetype-rs dependency
ankit3005 Nov 30, 2014
552cc7b
Replaced png::Image references with DynamicImage
ynandak Dec 1, 2014
f712870
Small fix in gfx/render_context.rs
ynandak Dec 1, 2014
dbd681a
Replaced certain instances of png::Image use - build successful
ynandak Dec 1, 2014
82d3720
Minor change to render_context.rs::draw_image()
ynandak Dec 2, 2014
61557e5
Added changes to accept ImageFormat
anishashetty Dec 2, 2014
d2d9a99
Changes to fix runtime data.len() assertion crash
ynandak Dec 3, 2014
1a0f513
Minor fix in render_context
ynandak Dec 3, 2014
1bca917
Changes to base.rs to resolve ImageFormat based on file extension
anishashetty Dec 3, 2014
0954f6d
Merge branch 'master' of https://github.com/ankit3005/servo
anishashetty Dec 3, 2014
8ce5e11
Updated RGB in draw_image()
ynandak Dec 3, 2014
169160a
net component compiles with profiler in place
ankit3005 Dec 3, 2014
91f719e
whitespace changes to clean up mach test-tidy
ankit3005 Dec 3, 2014
7f20adc
Minor cleanup. Removed unnecessary line
ankit3005 Dec 3, 2014
4c33555
Changed freetype-rs dependency from fork to upstream repo
ankit3005 Dec 3, 2014
b7b50f8
Changed freetype-rs version to old working commit
ankit3005 Dec 4, 2014
ba24947
Clean up commented code
ankit3005 Dec 4, 2014
3d518cd
Add profiling to image decoding
ankit3005 Dec 4, 2014
d6bb6b4
Code clean up. Removed unused functions and imports
ankit3005 Dec 4, 2014
ad709d6
minor cleanup
ankit3005 Dec 4, 2014
d1aaa2c
Remove a println statement
ankit3005 Dec 4, 2014
dfa0b92
Fixed image rendering. Now working as intended
ynandak Dec 4, 2014
85b5efc
Updated Cargo.lock
ynandak Dec 4, 2014
9e2b0c7
Removed debugging println!
ynandak Dec 4, 2014
768709a
whitespace changes to clean up test-tidy
ankit3005 Dec 4, 2014
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Add profiling to image decoding

  • Loading branch information
ankit3005 committed Dec 4, 2014
commit 3d518cd2237e2de5c18ee1bc85e937ca7c3c72b2
@@ -83,7 +83,7 @@ impl<E, S: Encoder<E>> Encodable<S, E> for ImageCacheTask {
type DecoderFactory = fn() -> (proc(&[u8]) : 'static -> Option<Image>);

impl ImageCacheTask {
pub fn new(resource_task: ResourceTask, task_pool: TaskPool, time_profiler_chan: Timer) -> ImageCacheTask {
pub fn new(resource_task: ResourceTask, task_pool: TaskPool, time_profiler_chan: Option<TimeProfilerChan>) -> ImageCacheTask {
let (chan, port) = channel();
let chan_clone = chan.clone();

@@ -96,7 +96,7 @@ impl ImageCacheTask {
wait_map: HashMap::new(),
need_exit: None,
task_pool: task_pool,
time_profiler_chan: None,
time_profiler_chan: time_profiler_chan,
};
cache.run();
});
@@ -106,11 +106,11 @@ impl ImageCacheTask {
}
}

pub fn new_sync(resource_task: ResourceTask, task_pool: TaskPool) -> ImageCacheTask {
pub fn new_sync(resource_task: ResourceTask, task_pool: TaskPool, time_profiler_chan: Option<TimeProfilerChan>) -> ImageCacheTask {
let (chan, port) = channel();

spawn_named("ImageCacheTask (sync)", proc() {
let inner_cache = ImageCacheTask::new(resource_task, task_pool);
let inner_cache = ImageCacheTask::new(resource_task, task_pool, time_profiler_chan);

loop {
let msg: Msg = port.recv();
@@ -591,7 +591,7 @@ mod tests {
fn should_exit_on_request() {
let mock_resource_task = mock_resource_task(box DoesNothing);

let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4));
let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4), None);

image_cache_task.exit();
mock_resource_task.send(resource_task::Exit);
@@ -602,7 +602,7 @@ mod tests {
fn should_fail_if_unprefetched_image_is_requested() {
let mock_resource_task = mock_resource_task(box DoesNothing);

let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4));
let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4), None);
let url = Url::parse("file:///").unwrap();

let (chan, port) = channel();
@@ -616,7 +616,7 @@ mod tests {

let mock_resource_task = mock_resource_task(box JustSendOK { url_requested_chan: url_requested_chan});

let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4));
let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4), None);
let url = Url::parse("file:///").unwrap();

image_cache_task.send(Prefetch(url));
@@ -631,7 +631,7 @@ mod tests {

let mock_resource_task = mock_resource_task(box JustSendOK { url_requested_chan: url_requested_chan});

let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4));
let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4), None);
let url = Url::parse("file:///").unwrap();

image_cache_task.send(Prefetch(url.clone()));
@@ -651,7 +651,7 @@ mod tests {

let mock_resource_task = mock_resource_task(box WaitSendTestImage{wait_port: wait_port});

let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4));
let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4), None);
let url = Url::parse("file:///").unwrap();

image_cache_task.send(Prefetch(url.clone()));
@@ -668,7 +668,7 @@ mod tests {
fn should_return_decoded_image_data_if_data_has_arrived() {
let mock_resource_task = mock_resource_task(box SendTestImage);

let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4));
let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4), None);
let url = Url::parse("file:///").unwrap();

let join_port = image_cache_task.wait_for_store();
@@ -694,7 +694,7 @@ mod tests {
fn should_return_decoded_image_data_for_multiple_requests() {
let mock_resource_task = mock_resource_task(box SendTestImage);

let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4));
let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4), None);
let url = Url::parse("file:///").unwrap();

let join_port = image_cache_task.wait_for_store();
@@ -747,7 +747,7 @@ mod tests {
}
});

let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4));
let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4), None);
let url = Url::parse("file:///").unwrap();

image_cache_task.send(Prefetch(url.clone()));
@@ -799,7 +799,7 @@ mod tests {
}
});

let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4));
let image_cache_task = ImageCacheTask::new(mock_resource_task.clone(), TaskPool::new(4), None);
let url = Url::parse("file:///").unwrap();

image_cache_task.send(Prefetch(url.clone()));
@@ -994,7 +994,7 @@ mod tests {
fn sync_cache_should_wait_for_images() {
let mock_resource_task = mock_resource_task(box SendTestImage);

let image_cache_task = ImageCacheTask::new_sync(mock_resource_task.clone(), TaskPool::new(4));
let image_cache_task = ImageCacheTask::new_sync(mock_resource_task.clone(), TaskPool::new(4), None);
let url = Url::parse("file:///").unwrap();

image_cache_task.send(Prefetch(url.clone()));
@@ -95,6 +95,7 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {

let opts_clone = opts.clone();
let time_profiler_chan_clone = time_profiler_chan.clone();
let time_profiler_chan_option: Option<servo_util::time::TimeProfilerChan> = Some(time_profiler_chan_clone.clone());

let (result_chan, result_port) = channel();
let compositor_proxy_for_constellation = compositor_proxy.clone_compositor_proxy();
@@ -108,9 +109,9 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
// image load or we risk emitting an output file missing the
// image.
let image_cache_task = if opts.output_file.is_some() {
ImageCacheTask::new_sync(resource_task.clone(), shared_task_pool)
ImageCacheTask::new_sync(resource_task.clone(), shared_task_pool, time_profiler_chan_option)
} else {
ImageCacheTask::new(resource_task.clone(), shared_task_pool)
ImageCacheTask::new(resource_task.clone(), shared_task_pool, time_profiler_chan_option)
};
let font_cache_task = FontCacheTask::new(resource_task.clone());
let constellation_chan = Constellation::<layout::layout_task::LayoutTask,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.