OLD | NEW |
1 Mojo | 1 Mojo |
2 ==== | 2 ==== |
3 | 3 |
4 Mojo is an effort to extract a common platform out of Chrome's renderer and | 4 Mojo is an effort to extract a common platform out of Chrome's renderer and |
5 plugin processes that can support multiple types of sandboxed content, such as | 5 plugin processes that can support multiple types of sandboxed content, such as |
6 HTML, Pepper, or NaCl. | 6 HTML, Pepper, or NaCl. |
7 | 7 |
8 ## Set-up and code check-out | 8 ## Set-up and code check-out |
9 | 9 |
10 The instructions below only need to be done once. Note that a simple "git clone" | 10 The instructions below only need to be done once. Note that a simple "git clone" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 Because the dart analyzer is a bit slow, we don't run it unless the user | 205 Because the dart analyzer is a bit slow, we don't run it unless the user |
206 specifically asks for it. To run the dart analyzer against the list of dart | 206 specifically asks for it. To run the dart analyzer against the list of dart |
207 targets in the toplevel BUILD.gn file, run: | 207 targets in the toplevel BUILD.gn file, run: |
208 | 208 |
209 ``` | 209 ``` |
210 $ mojo/tools/mojob.py dartcheck | 210 $ mojo/tools/mojob.py dartcheck |
211 ``` | 211 ``` |
212 | 212 |
213 ## Run Mojo Shell | 213 ## Run Mojo Shell |
214 | 214 |
215 `mojo_shell.py` is a universal shell runner abstracting away the differences | 215 Devtools script `mojo_shell` is a universal shell runner abstracting away the |
216 between running on Linux and Android. Having built Mojo as described above, a | 216 differences between running on Linux and Android. Having built Mojo as |
217 demo app can be run as follows: | 217 described above, a demo app can be run as follows: |
218 | 218 |
219 ``` | 219 ``` |
220 mojo/tools/mojo_shell.py mojo:spinning_cube # Linux. | 220 mojo/devtools/common/mojo_shell mojo:spinning_cube # Linux. |
221 mojo/tools/mojo_shell.py mojo:spinning_cube --android # Android. | 221 mojo/devtools/common/mojo_shell mojo:spinning_cube --android # Android. |
222 ``` | 222 ``` |
223 | 223 |
224 Pass `--sky path_to_sky_file` to run a | 224 Pass `--sky path_to_sky_file` to run a |
225 [Sky](https://github.com/domokit/mojo/tree/master/sky) app on either platform: | 225 [Sky](https://github.com/domokit/mojo/tree/master/sky) app on either platform: |
226 ``` | 226 ``` |
227 mojo/tools/mojo_shell.py --sky sky/examples/raw/hello_world.dart | 227 mojo/devtools/common/mojo_shell --sky sky/examples/raw/hello_world.dart |
228 mojo/tools/mojo_shell.py --sky sky/examples/raw/hello_world.dart --android | 228 mojo/devtools/common/mojo_shell --sky sky/examples/raw/hello_world.dart --androi
d |
229 ``` | 229 ``` |
230 | 230 |
231 Passing the `-v` flag will increase the output verbosity. In particular, it will | 231 Passing the `-v` flag will increase the output verbosity. In particular, it will |
232 also print all arguments passed by `mojo_shell.py` to the shell binary. | 232 also print all arguments passed by `mojo_shell.py` to the shell binary. |
233 | 233 |
234 ### Chromoting | 234 ### Chromoting |
235 | 235 |
236 Some Mojo apps (Sky apps in particular) will need the --use-osmesa flag to run | 236 Some Mojo apps (Sky apps in particular) will need the --use-osmesa flag to run |
237 over [chromoting](https://support.google.com/chrome/answer/1649523?hl=en): | 237 over [chromoting](https://support.google.com/chrome/answer/1649523?hl=en): |
238 | 238 |
239 ``` | 239 ``` |
240 mojo/tools/mojo_shell.py --sky sky/examples/raw/hello_world.dart --use-osmesa | 240 mojo/tools/mojo_shell.py --sky sky/examples/raw/hello_world.dart --use-osmesa |
241 ``` | 241 ``` |
242 | 242 |
243 ### <a name="debugging"></a>Debugging, tracing, profiling | 243 ### <a name="debugging"></a>Debugging, tracing, profiling |
244 | 244 |
245 #### Tracing | 245 #### Tracing |
246 While the shell is running, the `debugger` script allows you to interactively | 246 While the shell is running, the `debugger` script allows you to interactively |
247 start | 247 start |
248 [tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool
) | 248 [tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool
) |
249 and retrieve the result: | 249 and retrieve the result: |
250 | 250 |
251 ``` | 251 ``` |
252 devtools/common/debugger tracing start | 252 mojo/devtools/common/debugger tracing start |
253 devtools/common/debugger tracing stop [result.json] | 253 mojo/devtools/common/debugger tracing stop [result.json] |
254 ``` | 254 ``` |
255 | 255 |
256 The trace file can be then loaded using the trace viewer in Chrome available at | 256 The trace file can be then loaded using the trace viewer in Chrome available at |
257 `about://tracing`. | 257 `about://tracing`. |
258 | 258 |
259 #### Android crash stacks | 259 #### Android crash stacks |
260 When Mojo shell crashes on Android ("Unfortunately, Mojo shell has stopped.") | 260 When Mojo shell crashes on Android ("Unfortunately, Mojo shell has stopped.") |
261 due to a crash in native code, `debugger` can be used to find and symbolize the | 261 due to a crash in native code, `debugger` can be used to find and symbolize the |
262 stack trace present in the device log: | 262 stack trace present in the device log: |
263 | 263 |
(...skipping 28 matching lines...) Expand all Loading... |
292 | 292 |
293 #### Device | 293 #### Device |
294 | 294 |
295 **The device has to be running Android 5.0 (Lollipop) or newer.** | 295 **The device has to be running Android 5.0 (Lollipop) or newer.** |
296 | 296 |
297 Many features useful for development (ie. streaming of the shell stdout when | 297 Many features useful for development (ie. streaming of the shell stdout when |
298 running shell on the device) will not work unless the device is rooted and | 298 running shell on the device) will not work unless the device is rooted and |
299 running a userdebug build. For Googlers, [follow the instructions at this | 299 running a userdebug build. For Googlers, [follow the instructions at this |
300 link](http://go/mojo-internal-build-instructions). | 300 link](http://go/mojo-internal-build-instructions). |
301 | 301 |
302 #### Aw, snap! | |
303 | |
304 If the shell crashes on the device, you won't see symbols. Use | |
305 `tools/android_stack_parser/stack` to map back to symbols, e.g.: | |
306 ``` | |
307 adb logcat | ./tools/android_stack_parser/stack | |
308 ``` | |
309 | |
310 ### Running manually on Linux | 302 ### Running manually on Linux |
311 | 303 |
312 If you wish to, you can also run the Linux Mojo shell directly with no wrappers: | 304 If you wish to, you can also run the Linux Mojo shell directly with no wrappers: |
313 ``` | 305 ``` |
314 ./out/Debug/mojo_shell mojo:spinning_cube | 306 ./out/Debug/mojo_shell mojo:spinning_cube |
315 ``` | 307 ``` |
OLD | NEW |