| Index: components/mus/ws/server_window_surface_manager.cc
|
| diff --git a/components/mus/ws/server_window_surface_manager.cc b/components/mus/ws/server_window_surface_manager.cc
|
| index 1699de41bc8006f97d94066f349ca176f0927731..1d90e17e427097529b00c1bc4f82a196d4fd6652 100644
|
| --- a/components/mus/ws/server_window_surface_manager.cc
|
| +++ b/components/mus/ws/server_window_surface_manager.cc
|
| @@ -34,8 +34,16 @@ void ServerWindowSurfaceManager::CreateSurface(
|
| mojom::SurfaceType surface_type,
|
| mojo::InterfaceRequest<mojom::Surface> request,
|
| mojom::SurfaceClientPtr client) {
|
| - type_to_surface_map_[surface_type] = make_scoped_ptr(new ServerWindowSurface(
|
| + scoped_ptr<ServerWindowSurface> surface(new ServerWindowSurface(
|
| this, surface_type, std::move(request), std::move(client)));
|
| + if (!HasAnySurface()) {
|
| + // Only one SurfaceFactoryClient can be registered per surface id namespace,
|
| + // so register the first one. Since all surfaces created by this manager
|
| + // represent the same window, the begin frame source can be shared by
|
| + // all surfaces created here.
|
| + surface->RegisterForBeginFrames();
|
| + }
|
| + type_to_surface_map_[surface_type] = std::move(surface);
|
| }
|
|
|
| ServerWindowSurface* ServerWindowSurfaceManager::GetDefaultSurface() {
|
| @@ -52,10 +60,19 @@ ServerWindowSurface* ServerWindowSurfaceManager::GetSurfaceByType(
|
| return iter == type_to_surface_map_.end() ? nullptr : iter->second.get();
|
| }
|
|
|
| -bool ServerWindowSurfaceManager::HasSurfaceOfType(mojom::SurfaceType type) {
|
| +bool ServerWindowSurfaceManager::HasSurfaceOfType(
|
| + mojom::SurfaceType type) const {
|
| return type_to_surface_map_.count(type) > 0;
|
| }
|
|
|
| +bool ServerWindowSurfaceManager::HasAnySurface() const {
|
| + return !GetDefaultSurface() && !GetUnderlaySurface();
|
| +}
|
| +
|
| +SurfaceManager* ServerWindowSurfaceManager::GetSurfaceManager() {
|
| + return window()->delegate()->GetSurfacesState()->manager();
|
| +}
|
| +
|
| bool ServerWindowSurfaceManager::IsSurfaceReadyAndNonEmpty(
|
| mojom::SurfaceType type) const {
|
| auto iter = type_to_surface_map_.find(type);
|
|
|