| # Copyright 2012 The ChromiumOS Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| description "Chrome OS user interface" | |
| author "chromium-os-dev@chromium.org" | |
| # Note, the 'start on' line is modified by the chromeos-factoryinstall | |
| # ebuild. Please do not change it without also changing that | |
| # reference. | |
| # | |
| # This job's post-stop script depends on cryptohomed being running; | |
| # cryptohomed in turn depends on chapsd and dbus-daemon. This job's | |
| # stop condition uses a special stop job to keep those processes | |
| # from terminating until after this job has cleaned up. See the | |
| # pre-shutdown job for more details. | |
| # NB: Respawning is now handled by ui-respawn.conf, as the logic is | |
| # more complex than upstart was designed to handle. | |
| start on started boot-services and stopped cgroups and started lockbox-cache | |
| stop on starting pre-shutdown | |
| # OK to kill if absolutely needed. | |
| oom score -100 | |
| # Enables chrome to renice UI critical threads (higher priority), | |
| # background threads (lower priority), and to set the priority of | |
| # realtime threads to real time. The limit will be applied to | |
| # session_manager and all the spawned processes. | |
| limit nice 40 40 | |
| limit rtprio 10 10 | |
| # Extend the grace period given to the session_manager before upstart decides | |
| # it's gone unresponsive on job termination and must be killed. Chrome gets 3s | |
| # to shut down in most cases, and longer when collecting core dumps for | |
| # development, so give a cushion. | |
| kill timeout 20 # In seconds. | |
| # Uncomment line below to output to VT02 | |
| #console output | |
| # Directory where session manager logs are written and prefix of files there. | |
| env UI_LOG_DIR=/var/log/ui | |
| env UI_LOG_FILE=ui.LATEST | |
| # Directory where session manager sets up container roots | |
| env CONTAINER_ROOT_DIR=/run/containers | |
| # Directory for renderer freezer. | |
| env UI_FREEZER_CGROUP_DIR=/sys/fs/cgroup/freezer/ui | |
| env CHROME_FREEZER_CGROUP_DIR=/sys/fs/cgroup/freezer/ui/chrome_renderers | |
| env UI_CPU_CGROUP_DIR=/sys/fs/cgroup/cpu/ui | |
| # Validate filesystem. | |
| tmpfiles /usr/lib/tmpfiles.d/chromeos.conf | |
| pre-start exec /usr/share/cros/init/ui-pre-start | |
| # This may be used to wrap the Chrome executable within another command | |
| # instead of calling it directly. The flag's value will be split on whitespace | |
| # into an absolute path and arguments, after which session_manager will add | |
| # Chrome's arguments. For example: | |
| # | |
| # env CHROME_COMMAND_FLAG="--chrome-command=/usr/local/bin/strace /opt/google/chrome/chrome" | |
| # env CHROME_COMMAND_FLAG="--chrome-command=/usr/local/bin/gdbserver --no-startup-with-shell :1234 /opt/google/chrome/chrome" | |
| env CHROME_COMMAND_FLAG | |
| exec session_manager \ | |
| "${CHROME_COMMAND_FLAG}" \ | |
| >"${UI_LOG_DIR}/${UI_LOG_FILE}" 2>&1 | |
| # Assign session_manager and children(chrome) processes to the ui cgroup created | |
| # above. Default cpu.shares is 1024. Android processes will be adjusted against | |
| # 1024. | |
| post-start script | |
| echo $(status | cut -f 4 -d ' ') > "${UI_CPU_CGROUP_DIR}/tasks" | |
| echo $(status | cut -f 4 -d ' ') > "${UI_FREEZER_CGROUP_DIR}/cgroup.procs" | |
| end script | |
| post-stop exec /usr/share/cros/init/ui-post-stop |