| OLD | NEW |
| 1 # Optimizing Chrome Web UIs | 1 # Optimizing Chrome Web UIs |
| 2 | 2 |
| 3 ## How do I do it? | 3 ## How do I do it? |
| 4 | 4 |
| 5 In order to build with a fast configuration, try setting these options in your | 5 In order to build with a fast configuration, try setting these options in your |
| 6 GN args: | 6 GN args: |
| 7 | 7 |
| 8 ``` | 8 ``` |
| 9 use_vulcanize = true | 9 use_vulcanize = true |
| 10 is_debug = false | 10 is_debug = false |
| 11 ``` | 11 ``` |
| 12 | 12 |
| 13 If you make local changes, you likely need to re-run: | |
| 14 | |
| 15 ``` | |
| 16 $ chrome/browser/resources/vulcanize.py | |
| 17 ``` | |
| 18 | |
| 19 And rebuild Chrome to see effects. vulcanize.py will result in local changes to | |
| 20 *crisper* and *vulcanized* files that you must currently check in. | |
| 21 | |
| 22 *NOTE: Vuclanize is being integrated directly into | |
| 23 [GN/Ninja](https://crbug.com/673825), so this workflow is likely to change | |
| 24 soon.* | |
| 25 | |
| 26 ## How is the code optimized? | 13 ## How is the code optimized? |
| 27 | 14 |
| 28 ### Resource combination | 15 ### Resource combination |
| 29 | 16 |
| 30 [HTML imports](https://www.html5rocks.com/en/tutorials/webcomponents/imports/) | 17 [HTML imports](https://www.html5rocks.com/en/tutorials/webcomponents/imports/) |
| 31 are a swell technology, but can be used is slow ways. Each import may also | 18 are a swell technology, but can be used is slow ways. Each import may also |
| 32 contain additional imports, which must be satisfied before certain things can | 19 contain additional imports, which must be satisfied before certain things can |
| 33 continue (i.e. script execution may be paused). | 20 continue (i.e. script execution may be paused). |
| 34 | 21 |
| 35 ```html | 22 ```html |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 117 |
| 131 To mark a WebUI's resources compressed, you'll need to do something like: | 118 To mark a WebUI's resources compressed, you'll need to do something like: |
| 132 | 119 |
| 133 ```c++ | 120 ```c++ |
| 134 WebUIDataSource* data_source = WebUIDataSource::Create(...); | 121 WebUIDataSource* data_source = WebUIDataSource::Create(...); |
| 135 data_source->SetDefaultResource(IDR_MY_PAGE); | 122 data_source->SetDefaultResource(IDR_MY_PAGE); |
| 136 std::unordered_set<std::string> exclusions; | 123 std::unordered_set<std::string> exclusions; |
| 137 exclusions.insert("strings.js"); // if required | 124 exclusions.insert("strings.js"); // if required |
| 138 data_source->UseGzip(exclusions); | 125 data_source->UseGzip(exclusions); |
| 139 ``` | 126 ``` |
| OLD | NEW |