Firefox OS/MappedArrayBuffer: Difference between revisions

Jump to navigation Jump to search
Line 40: Line 40:


== How to use it? ==
== How to use it? ==
: You need to make the target files uncompressed and aligned when building a packaged app.  To do this, put a configuration file "metadata.json" in the gaia app directory to specify memory-mapped files.
: Below is an example of "metadata.json" for keyboard app:
  {
    "external": false,
    "zip": {
      "mmap_files": [
        "js/imes/latin/dictionaries/en_us.dict",
        "js/imes/jszhuyin/data/database.data"
      ] 
    }
  }
: After that, the files specified in "mmap_files" will be uncompressed and aligned to 4096 bytes in the zip package.
  $ unzip -v gaia/profile/webapps/keyboard.gaiamobile.org/application.zip | grep Stored
  1451390  Stored  1451390  0% 1970-01-01 08:00 3d22f787  js/imes/latin/dictionaries/en_us.dict
  4541832  Stored  4541832  0% 1970-01-01 08:00 426a7f8e  js/imes/jszhuyin/data/database.data
* For more information, please see:
** https://bugzilla.mozilla.org/show_bug.cgi?id=957497
** https://bugzilla.mozilla.org/show_bug.cgi?id=959047
Note: The current approach first makes specified files uncompressed, then re-organize the zip package to make uncompressed files to be 4096 bytes alignment.  This could introduce some overhead on zip package size, because some uncompressed files may not want to be read as memory-mapped, which need not and should not be made aligned.
: There is a follow up to align for individual files in the zip package https://bugzilla.mozilla.org/show_bug.cgi?id=961622.


== OOP support ==
== OOP support ==
148

edits

Navigation menu