Kevin Marshall | f88e5601 | 2018-09-26 17:25:20 | [diff] [blame] | 1 | # Chromium web_runner |
| 2 | This directory contains the web_runner implementation. Web_runner enables |
| 3 | Fuchsia applications to embed Chrome frames for rendering web content. |
| 4 | |
| 5 | |
| 6 | ### Building and deploying web_runner |
| 7 | When you build web_runner, Chromium will automatically generate scripts for |
| 8 | you that will automatically provision a device with Fuchsia and then install |
| 9 | `web_runner` and its dependencies. |
| 10 | |
| 11 | To build and run web_runner, follow these steps: |
| 12 | |
| 13 | 0. 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 | |
| 19 | 1. Build web_runner. |
| 20 | |
| 21 | ``` |
| 22 | $ autoninja -C out/Debug webrunner |
| 23 | ``` |
| 24 | |
| 25 | 2. 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 | |
| 44 | 3. Run "tiles" on the device. |
| 45 | |
| 46 | ``` |
| 47 | $ run tiles& |
| 48 | ``` |
| 49 | |
| 50 | 4. 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 | |
| 53 | 5. Launch a webpage. |
| 54 | |
| 55 | ``` |
| 56 | $ tiles_ctl add https://www.chromium.org/ |
| 57 | ``` |
| 58 | |
| 59 | 6. Press the OS key to switch back to graphical view. The browser window should |
| 60 | be displayed and ready to use. |
| 61 | |
| 62 | 7. 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 | |
| 76 | 1. Press the Windows key to return to the terminal. |
| 77 | |
| 78 | 2. 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 Graham | 3ac5549 | 2018-10-19 22:29:30 | [diff] [blame] | 86 | ### Debugging |
| 87 | |
| 88 | Rudimentary debugging is now possible with zxdb which is included in the SDK. |
| 89 | It is still early and fairly manual to set up. After following the steps above: |
| 90 | |
| 91 | 1. On device, run `sysinfo` to see your device's IP address. |
| 92 | |
| 93 | 1. On device, run `debug_agent --port=2345`. |
| 94 | |
| 95 | 1. On the host, run |
| 96 | |
| 97 | ``` |
| 98 | third_party/fuchsia_sdk/sdk/tools/zxdb -s out/Debug/exe.unstripped -s out/Debug/lib.unstripped |
| 99 | ``` |
| 100 | |
| 101 | 1. In zxdb, `connect <ip-from-sysinfo-above> 2345`. |
| 102 | |
| 103 | 1. On the host, run `ps` and find the pid of the process you want to debug, e.g. |
| 104 | `web_runner`. |
| 105 | |
| 106 | 1. In zxdb, `attach <pid>`. You should be able to attach to multiple processes. |
| 107 | |
| 108 | 1. In zxdb, `b ComponentControllerImpl::CreateForRequest` to set a breakpoint. |
| 109 | |
| 110 | 1. 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 | |
| 113 | At 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 | |
| 152 | https://fuchsia.googlesource.com/garnet/+/master/docs/debugger.md#diagnosing-symbol-problems |
| 153 | maybe be a useful reference if you do not see symbols. That page also has |
| 154 | general help on using the debugger. |