[go: nahoru, domu]

Hook up BeginFrameSource to SurfaceFactoryClient via SurfaceManager

SurfaceManager now maintains a dag of surface id namespaces.
Optionally, a single BeginFrameSource input can be attached to a single
namespace node.  Every namespace node also has a SurfaceFactoryClient.
This client is informed of a current BeginFrameSource, which is chosen
from any BeginFrameSource attached to it or a parent of that node.
Any children of that namespace also are able to use that source.

SurfaceManager is responsible for picking which source to use, of which
it currently just picks the first one until that source goes is removed
after which it arbitrarily picks another valid one.  In practice, this
means that a window moved to another display in ChromeOS will switch its
BeginFrameSource after the window is dropped onto the new window.

Because the users of this dag all have very different requirements, the
ordering of SurfaceFactoryClient registration, namespace hierarchy
registration, and BeginFrameSource attaching are not particularly
strict.  BeginFrameSources, SurfaceFactoryClients, and hierarchies can
be registered and unregistered in any order with respect to each other.

BUG=401331
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review URL: https://codereview.chromium.org/1673783004

Cr-Commit-Position: refs/heads/master@{#379988}
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 2ed2554..68b4e069 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -915,6 +915,7 @@
     "surfaces/surface_display_output_surface_unittest.cc",
     "surfaces/surface_factory_unittest.cc",
     "surfaces/surface_hittest_unittest.cc",
+    "surfaces/surface_manager_unittest.cc",
     "surfaces/surface_unittest.cc",
     "surfaces/surfaces_pixeltest.cc",