tree: 491a200bc85dd82abea62e9f414cedea0ad1c52f [path history] [tgz]
  1. accelerator.cc
  2. accelerator.h
  3. access_policy.h
  4. access_policy_delegate.h
  5. accessibility_manager.cc
  6. accessibility_manager.h
  7. async_event_dispatcher.h
  8. async_event_dispatcher_lookup.h
  9. BUILD.gn
  10. compositor_frame_sink_client_binding.cc
  11. compositor_frame_sink_client_binding.h
  12. cursor_location_manager.cc
  13. cursor_location_manager.h
  14. cursor_location_manager_unittest.cc
  15. cursor_state.cc
  16. cursor_state.h
  17. cursor_state_delegate.h
  18. cursor_state_unittest.cc
  19. cursor_unittest.cc
  20. debug_utils.cc
  21. debug_utils.h
  22. default_access_policy.cc
  23. default_access_policy.h
  24. DEPS
  25. display.cc
  26. display.h
  27. display_binding.cc
  28. display_binding.h
  29. display_creation_config.h
  30. display_manager.cc
  31. display_manager.h
  32. display_unittest.cc
  33. drag_controller.cc
  34. drag_controller.h
  35. drag_controller_unittest.cc
  36. drag_cursor_updater.h
  37. drag_source.h
  38. drag_target_connection.h
  39. event_dispatcher.h
  40. event_dispatcher_delegate.h
  41. event_dispatcher_impl.cc
  42. event_dispatcher_impl.h
  43. event_dispatcher_impl_test_api.cc
  44. event_dispatcher_impl_test_api.h
  45. event_injector.cc
  46. event_injector.h
  47. event_location.h
  48. event_matcher.cc
  49. event_matcher.h
  50. event_matcher_unittest.cc
  51. event_processor.cc
  52. event_processor.h
  53. event_processor_delegate.h
  54. event_processor_unittest.cc
  55. event_targeter.cc
  56. event_targeter.h
  57. event_targeter_delegate.h
  58. focus_controller.cc
  59. focus_controller.h
  60. focus_controller_observer.h
  61. focus_controller_unittest.cc
  62. frame_generator.cc
  63. frame_generator.h
  64. frame_generator_unittest.cc
  65. ids.h
  66. modal_window_controller.cc
  67. modal_window_controller.h
  68. modal_window_controller_unittest.cc
  69. operation.cc
  70. operation.h
  71. OWNERS
  72. platform_display.cc
  73. platform_display.h
  74. platform_display_default.cc
  75. platform_display_default.h
  76. platform_display_default_unittest.cc
  77. platform_display_delegate.h
  78. platform_display_factory.h
  79. platform_display_mirror.cc
  80. platform_display_mirror.h
  81. README.md
  82. server_window.cc
  83. server_window.h
  84. server_window_delegate.h
  85. server_window_drawn_tracker.cc
  86. server_window_drawn_tracker.h
  87. server_window_drawn_tracker_observer.h
  88. server_window_drawn_tracker_unittest.cc
  89. server_window_observer.h
  90. server_window_tracker.h
  91. test_change_tracker.cc
  92. test_change_tracker.h
  93. test_manifest.json
  94. test_server_window_delegate.cc
  95. test_server_window_delegate.h
  96. test_utils.cc
  97. test_utils.h
  98. threaded_image_cursors.cc
  99. threaded_image_cursors.h
  100. threaded_image_cursors_factory.h
  101. transient_windows_unittest.cc
  102. user_activity_monitor.cc
  103. user_activity_monitor.h
  104. user_activity_monitor_unittest.cc
  105. user_display_manager.cc
  106. user_display_manager.h
  107. user_display_manager_delegate.h
  108. user_display_manager_unittest.cc
  109. video_detector_impl.cc
  110. video_detector_impl.h
  111. window_coordinate_conversions.cc
  112. window_coordinate_conversions.h
  113. window_coordinate_conversions_unittest.cc
  114. window_finder.cc
  115. window_finder.h
  116. window_finder_unittest.cc
  117. window_manager_access_policy.cc
  118. window_manager_access_policy.h
  119. window_manager_client_unittest.cc
  120. window_manager_display_root.cc
  121. window_manager_display_root.h
  122. window_manager_state.cc
  123. window_manager_state.h
  124. window_manager_state_unittest.cc
  125. window_manager_window_tree_factory.cc
  126. window_manager_window_tree_factory.h
  127. window_manager_window_tree_factory_observer.h
  128. window_server.cc
  129. window_server.h
  130. window_server_delegate.cc
  131. window_server_delegate.h
  132. window_server_service_test_base.cc
  133. window_server_service_test_base.h
  134. window_server_test_base.cc
  135. window_server_test_base.h
  136. window_server_test_impl.cc
  137. window_server_test_impl.h
  138. window_tree.cc
  139. window_tree.h
  140. window_tree_binding.cc
  141. window_tree_binding.h
  142. window_tree_client_unittest.cc
  143. window_tree_factory.cc
  144. window_tree_factory.h
  145. window_tree_host_factory.cc
  146. window_tree_host_factory.h
  147. window_tree_unittest.cc
services/ui/ws/README.md

This directory contains the Window Service implementation.

Ids

Each client connected to the Window Service is assigned a unique id inside the Window Service. This id is a monotonically increasing uint32_t. This is often referred to as the client_id.

The Window Service uses a client_id of 1 for itself; 0 is not a valid client_id in the Window Service.

As clients do not know their id, they always supply 0 as the client id in the mojom related functions. Internally the Window Service maps 0 to the real client id.

Windows have a couple of different (related) ids.

ClientWindowId

ClientWindowId is a uint64_t pairing of a client_id and a window_id. The window_id is a uint32_t assigned by the client, and should be unique within that client's scope. When communicating with the Window Service, clients may use 0 as the client_id to refer to their own windows. The Window Service maps 0 to the real client_id. In Window Service code the id from the client is typically referred to as the transport_window_id. Mojom functions that receive the transport_window_id map it to a ClientWindowId. ClientWindowId is a real class that provides type safety.

When a client is embedded in an existing window, the embedded client is given visibility to a Window created by the embedder. In this case the Window Service supplies the ClientWindowId to the embedded client and uses the ClientWindowId at the time the Window was created (the ClientWindowId actually comes from the FrameSinkId, see below for details on FrameSinkId). In other words, both the embedder and embedded client use the same ClientWindowId for the Window. See discussion on FrameSinkId for more details.

For a client to establish an embed root, it first calls ScheduleEmbedForExistingClient(), so it can provide a window_id that is unique within its own scope. That client then passes the returned token to what will become its embedder to call EmbedUsingToken(). In this case, the embedder and embedded client do not use the same ClientWindowId for the Window.

ClientWindowId is globally unique, but a Window may have multiple ClientWindowIds associated with it.

TODO(sky): See http://crbug.com/817850 for making it so there is only one ClientWindowId per Window.

FrameSinkId

Each Window has a FrameSinkId that is needed for both hit-testing and embedding. The FrameSinkId is initialized to the ClientWindowId of the client creating the Window, but it changes during an embedding. In particular, when a client calls Embed() the FrameSinkId of the Window changes such that the client_id of the FrameSinkId matches the client_id of the client being embedded and the sink_id is set to 0. The embedder is informed of this by way of OnFrameSinkIdAllocated(). The embedded client is informed of the original FrameSinkId (the client_id of the FrameSinkId matches the embedder's client_id). In client code the embedded client ends up always using a client_id of 0 for the FrameSinkId. This works because Viz knows the real client_id and handles mapping 0 to the real client_id.

The FrameSinkId of top-level windows is set to the ClientWindowId from the client requesting the top-level (top-levels are created and owned by the Window Manager). The Window Manager is told the updated FrameSinkId when it is asked to create the top-level (WmCreateTopLevelWindow()).

The FrameSinkId of an embed root‘s Window is set to the ClientWindowId of the embed root’s Window from the embedded client.

LocalSurfaceId

The LocalSurfaceId (which contains unguessable) is necessary if the client wants to submit a compositor-frame for the Window (it wants to show something on screen), and not needed if the client only wants to submit a hit-test region. The LocalSurfaceId may be assigned when the bounds and/or device-scale-factor changes. The LocalSurfaceId can change at other times as well (perhaps to synchronize an effect with the embedded client). The LocalSurfaceId is intended to allow for smooth resizes and ensures at embed points the CompositorFrame from both clients match. Client code supplies a LocalSurfaceId for windows that have another client embedded in them as well as windows with a LayerTreeFrameSink. The LocalSurfaceId comes from the owner of the window. The embedded client is told of changes to the LocalSurfaceId by way of OnWindowBoundsChanged(). This is still very much a work in progress.

FrameSinkId is derived from the embedded client, where as LocalSurfaceId comes from the embedder.

Event Processing

One of the key operations of the Window Service is event processing. This includes maintaining state associated with the current input devices (such as the location of the mouse cursor) as well dispatching to the appropriate client. Event processing includes the following classes, see each for more details: . EventDispatcherImpl: events received from the platform are sent here first. If not already processing an event EventDispatcherImpl forwards the event to EventProcessor. If EventDispatcherImpl is processing an event it queues the event for later processing. . EventProcessor: maintains state related to event processing, passing the appropriate events and targets to EventDispatcher for dispatch. . AsyncEventDispatcher: dispatches an event to the client, notifying a callback when done. This interface is largely for testing with WindowTree providing the implementation. . EventTargeter: used by EventProcessor to determine the ServerWindow to send an event to. Targetting is potentially asynchronous.

EventDispatcherImpl and EventProcessor both have delegates that can impact targetting, as well as being notified during the lifecycle of processing.

EventInjector is not a core part of event processing. It allows remote clients to inject events for testing, remoting and similar use cases. Events injected via EventInjector end up going to EventProcessor.