CSC/ECE 517 Fall 2019 - M1950. Support Asynchronous Web Assembly Compilation

From Expertiza_Wiki
Revision as of 18:42, 28 October 2019 by Rrastog3 (talk | contribs)
Jump to navigation Jump to search

Servo is a prototype web browser engine written in the Rust language.Servo uses a variety of back-end implementations for drawing graphics depending on the operating system.One of such back-end is only compatible with Android right now, and we want to extend and refactor that back-end to enable on all Linux systems..

Introduction

Servo

ServoServo is an open source prototype web browser layout engine being developed by Mozilla, and it is written in Rust language. The main idea is to create a highly parallel environment, in which different components can be handled by fine grained, isolated tasks. The different components can be rendering, HTML parsing, etc.

Rust

Rust is an open source systems programming language developed by Mozilla. Servo is written in Rust. The main purpose behind it's design is to be thread safe and concurrent. The emphasis is also on speed, safety and control of memory layout.

Project Description

  • The project requirement initially stated that we build and Compile servo. Following are the steps for this:

Servo is built with Cargo, the Rust package manager. Mozilla's Mach tools are used to orchestrate the build and other tasks.

   git clone https://github.com/servo/servo
   cd servo
   ./mach build --dev
   ./mach run tests/html/about-mozilla.html
  • Next we had to create a rust JS::StreamConsumer wrapper that stores a pointer to the object and has methods for consumeChunk, streamEnd, streamError, and noteResponseURLs.
  • Then we had to create an extern "C" function in script_runtime.rs that matches ConsumeStreamCallback that initiates the streaming webassembly compilation then creates a wrapper for the stream consumer and stores it in the Response object
  • Similarly we had to create an extern "C" function in script_runtime.rs that matches ReportStreamErrorCallback and reports an error with the error! macro
  • The final step was to call InitStreamConsumerCallback in new_rt_and_cx with the two new functions as arguments

Design Pattern

Conclusion

References

1. https://doc.rust-lang.org/book
2. https://en.wikipedia.org/wiki/Rust_(programming_language)
3. https://en.wikipedia.org/wiki/Servo_(layout_engine)
4. https://github.com/servo/servo/wiki/Asynchronous-WebAssembly-compilation-project
6. http://rustbyexample.com/