testing/xvfb.py
def _get_display_from_weston(weston_proc_pid):
  """Retrieves $WAYLAND_DISPLAY set by Weston.

  Searches for the child "weston-desktop-shell" process, takes its
  environmental variables, and returns $WAYLAND_DISPLAY variable set
  by that process. If the variable is not set, tries up to 10 times
  and then gives up.

  Args:
    weston_proc_pid: The process of id of the main Weston process.

  Returns:
    the display set by Wayland, which clients can use to connect to.

  TODO(https://crbug.com/1060469): This is potentially error prone
  function. See the bug for further details.
  """

  # Try 100 times as it is not known when Weston spawn child desktop shell
  # process. The most seen so far is ~50 checks/~2.5 seconds, but startup
  # is usually almost instantaneous.
  for _ in range(100):
    # gives weston time to start or fail.
    time.sleep(.05)
    # Take the parent process.
    parent = psutil.Process(weston_proc_pid)
    if parent is None:
      break # The process is not found. Give up.

    # Traverse through all the children processes and find the
    # "weston-desktop-shell" process that sets local to process env variables
    # including the $WAYLAND_DISPLAY.
    children = parent.children(recursive=True)
    for process in children:
      if process.name() == "weston-desktop-shell":
        weston_proc_display = process.environ().get('WAYLAND_DISPLAY')
        # If display is set, Weston could start successfully and we can use
        # that display for Wayland connection in Chromium.
        if weston_proc_display is not None:
          return weston_proc_display
  return None
Retrieves $WAYLAND_DISPLAY set by Weston.

  Searches for the child "weston-desktop-shell" process, takes its
  environmental variables, and returns $WAYLAND_DISPLAY variable set
  by that process. If the variable is not set, tries up to 10 times
  and then gives up.

  Args:
    weston_proc_pid: The process of id of the main Weston process.

  Returns:
    the display set by Wayland, which clients can use to connect to.

  TODO(https://crbug.com/1060469): This is potentially error prone
  function. See the bug for further details.
  
Retrieves $WAYLAND_DISPLAY set by Weston.
Searches for the child "weston-desktop-shell" process, takes its
environmental variables, and returns $WAYLAND_DISPLAY variable set
by that process. If the variable is not set, tries up to 10 times
and then gives up.
Retrieves $WAYLAND_DISPLAY set by Weston . Searches for the child " weston - desktop - shell " process takes its environmental variables and returns $WAYLAND_DISPLAY variable set by that process . If the variable is not set tries up to 10 times and then gives up .
def _get_display_from_weston(weston_proc_pid):
  for _ in range(100):
    time.sleep(.05)
    parent = psutil.Process(weston_proc_pid)
    if parent is None:
      break 
    children = parent.children(recursive=True)
    for process in children:
      if process.name() == "weston-desktop-shell":
        weston_proc_display = process.environ().get('WAYLAND_DISPLAY')
        if weston_proc_display is not None:
          return weston_proc_display
  return None
def _get_display_from_weston ( weston_proc_pid ) : for _ in range ( 100 ) : time . sleep ( .05 ) parent = psutil . Process ( weston_proc_pid ) if parent is None : break children = parent . children ( recursive = True ) for process in children : if process . name ( ) == "weston-desktop-shell" : weston_proc_display = process . environ ( ) . get ( 'WAYLAND_DISPLAY' ) if weston_proc_display is not None : return weston_proc_display return None
Retrieves $WAYLAND_DISPLAY set by Weston.
Retrieves $WAYLAND_DISPLAY set by Weston .
"""Retrieves $WAYLAND_DISPLAY set by Weston.

  Searches for the child "weston-desktop-shell" process, takes its
  environmental variables, and returns $WAYLAND_DISPLAY variable set
  by that process. If the variable is not set, tries up to 10 times
  and then gives up.

  Args:
    weston_proc_pid: The process of id of the main Weston process.

  Returns:
    the display set by Wayland, which clients can use to connect to.

  TODO(https://crbug.com/1060469): This is potentially error prone
  function. See the bug for further details.
  """ # Try 100 times as it is not known when Weston spawn child desktop shell # process. The most seen so far is ~50 checks/~2.5 seconds, but startup # is usually almost instantaneous. # gives weston time to start or fail. # Take the parent process. # The process is not found. Give up. # Traverse through all the children processes and find the # "weston-desktop-shell" process that sets local to process env variables # including the $WAYLAND_DISPLAY. # If display is set, Weston could start successfully and we can use # that display for Wayland connection in Chromium.
the display set by Wayland, which clients can use to connect to.
the display set by Wayland which clients can use to connect to .
weston_proc_pid
The process of id of the main Weston process.
The process of id of the main Weston process .