blob: e2a84e2805bb32a1b2eb9ec0968439a6b74e78aa [file] [log] [blame] [view]
Kevin Marshallf88e56012018-09-26 17:25:201# Chromium web_runner
2This directory contains the web_runner implementation. Web_runner enables
3Fuchsia applications to embed Chrome frames for rendering web content.
4
5
6### Building and deploying web_runner
7When you build web_runner, Chromium will automatically generate scripts for
8you that will automatically provision a device with Fuchsia and then install
9`web_runner` and its dependencies.
10
11To build and run web_runner, follow these steps:
12
130. Ensure that you have a device ready to boot into Fuchsia.
14
15 If you wish to have WebRunner manage the OS deployment process, then you
16 should have the device booting into
17 [Zedboot](https://fuchsia.googlesource.com/zircon/+/master/docs/targets/bootloader_setup.md).
18
191. Build web_runner.
20
21 ```
22 $ autoninja -C out/Debug webrunner
23 ```
24
252. Install web_runner.
26
27 * **For devices running Zedboot**
28
29 ```
30 $ out/Debug/bin/install_webrunner -d
31 ```
32
33 * **For devices already running Fuchsia**
34
35 You will need to add command line flags specifying the device's IP
36 address and the path to the `ssh_config` used by the device
37 (located at `FUCHSIA_OUT_DIR/ssh-keys/ssh_config`):
38
39 ```
40 $ out/Debug/bin/install_webrunner -d --ssh-config PATH_TO_SSH_CONFIG
41 --host DEVICE_IP
42 ```
43
443. Run "tiles" on the device.
45
46 ```
47 $ run tiles&
48 ```
49
504. Press the OS key on your device to switch back to terminal mode.
51 (Also known as the "Windows key" or "Super key" on many keyboards).
52
535. Launch a webpage.
54
55 ```
56 $ tiles_ctl add https://www.chromium.org/
57 ```
58
596. Press the OS key to switch back to graphical view. The browser window should
60 be displayed and ready to use.
61
627. You can deploy and run new versions of Chromium without needing to reboot.
63
64 First kill any running processes:
65
66 ```
67 $ killall chromium; killall web_runner
68 ```
69
70 Then repeat steps 1 through 6 from the installation instructions, excluding
71 step #3 (running Tiles).
72
73
74### Closing a webpage
75
761. Press the Windows key to return to the terminal.
77
782. Instruct tiles_ctl to remove the webpage's window tile. The tile's number is
79 reported by step 6, or it can be found by running `tiles_ctl list` and
80 noting the ID of the "url" entry.
81
82 ```shell
83 $ tiles_ctl remove TILE_NUMBER
84 ```
85
Scott Graham3ac55492018-10-19 22:29:3086### Debugging
87
88Rudimentary debugging is now possible with zxdb which is included in the SDK.
89It is still early and fairly manual to set up. After following the steps above:
90
911. On device, run `sysinfo` to see your device's IP address.
92
931. On device, run `debug_agent --port=2345`.
94
951. On the host, run
96
97```
98third_party/fuchsia_sdk/sdk/tools/zxdb -s out/Debug/exe.unstripped -s out/Debug/lib.unstripped
99```
100
1011. In zxdb, `connect <ip-from-sysinfo-above> 2345`.
102
1031. On the host, run `ps` and find the pid of the process you want to debug, e.g.
104 `web_runner`.
105
1061. In zxdb, `attach <pid>`. You should be able to attach to multiple processes.
107
1081. In zxdb, `b ComponentControllerImpl::CreateForRequest` to set a breakpoint.
109
1101. On device, do something to make your breakpoint be hit. In this case
111 `tiles_ctl add https://www.google.com/` should cause a new request.
112
113At this point, you should hit the breakpoint in zxdb.
114
115```
116[zxdb] l
117 25 fuchsia::sys::Package package,
118 26 fuchsia::sys::StartupInfo startup_info,
119 27 fidl::InterfaceRequest<fuchsia::sys::ComponentController>
120 28 controller_request) {
121 29 std::unique_ptr<ComponentControllerImpl> result{
122 ▶ 30 new ComponentControllerImpl(runner)};
123 31 if (!result->BindToRequest(std::move(package), std::move(startup_info),
124 32 std::move(controller_request))) {
125 33 return nullptr;
126 34 }
127 35 return result;
128 36 }
129 37
130 38 ComponentControllerImpl::ComponentControllerImpl(WebContentRunner* runner)
131 39 : runner_(runner), controller_binding_(this) {
132 40 DCHECK(runner);
133[zxdb] f
134▶ 0 webrunner::ComponentControllerImpl::CreateForRequest() • component_controller_impl.cc:30
135 1 webrunner::WebContentRunner::StartComponent() • web_content_runner.cc:34
136 2 fuchsia::sys::Runner_Stub::Dispatch_() • fidl.cc:1255
137 3 fidl::internal::StubController::OnMessage() • stub_controller.cc:38
138 4 fidl::internal::MessageReader::ReadAndDispatchMessage() • message_reader.cc:213
139 5 fidl::internal::MessageReader::OnHandleReady() • message_reader.cc:179
140 6 fidl::internal::MessageReader::CallHandler() • message_reader.cc:166
141 7 base::AsyncDispatcher::DispatchOrWaitUntil() • async_dispatcher.cc:183
142 8 base::MessagePumpFuchsia::HandleEvents() • message_pump_fuchsia.cc:236
143 9 base::MessagePumpFuchsia::Run() • message_pump_fuchsia.cc:282
144 10 base::MessageLoop::Run() + 0x22b (no line info)
145 11 base::RunLoop::Run() • run_loop.cc:102
146 12 main() • main.cc:74
147 13 0x472010320b8f
148 14 0x0
149[zxdb]
150```
151
152https://fuchsia.googlesource.com/garnet/+/master/docs/debugger.md#diagnosing-symbol-problems
153maybe be a useful reference if you do not see symbols. That page also has
154general help on using the debugger.