forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FrameSinkMnagerClientBinding Class
FrameSinkManagerClientBinding holds the mojo connection between FrameSinkManager and FrameSinkManagerClient. It is owned by WindowServer. Service::OnStart creates a FrameSinkManagerClientBinding object before passing it to the WindowServer. FrameSinkManagerClientBinding hides the mojo interface pointer from WindowServer and allows us to unit test WindowServer. Unit tests will be implemented in a separate CL. Bug: 698026 Change-Id: I2dfa634709186ca3b5e64be9ecf6040fa9e9826d Reviewed-on: https://chromium-review.googlesource.com/521823 Reviewed-by: Scott Violet <sky@chromium.org> Reviewed-by: Fady Samuel <fsamuel@chromium.org> Commit-Queue: Xingyu Zhang <staraz@chromium.org> Cr-Commit-Position: refs/heads/master@{#477018}
- Loading branch information
Showing
7 changed files
with
152 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "services/ui/ws/frame_sink_manager_client_binding.h" | ||
|
||
#include "services/ui/ws/gpu_host.h" | ||
|
||
namespace ui { | ||
namespace ws { | ||
|
||
FrameSinkManagerClientBinding::FrameSinkManagerClientBinding( | ||
cc::mojom::FrameSinkManagerClient* frame_sink_manager_client, | ||
GpuHost* gpu_host) | ||
: frame_sink_manager_client_binding_(frame_sink_manager_client) { | ||
gpu_host->CreateFrameSinkManager( | ||
mojo::MakeRequest(&frame_sink_manager_), | ||
frame_sink_manager_client_binding_.CreateInterfacePtrAndBind()); | ||
} | ||
|
||
FrameSinkManagerClientBinding::~FrameSinkManagerClientBinding() = default; | ||
|
||
void FrameSinkManagerClientBinding::CreateRootCompositorFrameSink( | ||
const cc::FrameSinkId& frame_sink_id, | ||
gpu::SurfaceHandle surface_handle, | ||
cc::mojom::MojoCompositorFrameSinkAssociatedRequest request, | ||
cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | ||
cc::mojom::MojoCompositorFrameSinkClientPtr client, | ||
cc::mojom::DisplayPrivateAssociatedRequest display_private_request) { | ||
frame_sink_manager_->CreateRootCompositorFrameSink( | ||
frame_sink_id, surface_handle, std::move(request), | ||
std::move(private_request), std::move(client), | ||
std::move(display_private_request)); | ||
} | ||
|
||
void FrameSinkManagerClientBinding::CreateCompositorFrameSink( | ||
const cc::FrameSinkId& frame_sink_id, | ||
cc::mojom::MojoCompositorFrameSinkRequest request, | ||
cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | ||
cc::mojom::MojoCompositorFrameSinkClientPtr client) { | ||
frame_sink_manager_->CreateCompositorFrameSink( | ||
frame_sink_id, std::move(request), std::move(private_request), | ||
std::move(client)); | ||
} | ||
|
||
void FrameSinkManagerClientBinding::RegisterFrameSinkHierarchy( | ||
const cc::FrameSinkId& parent_frame_sink_id, | ||
const cc::FrameSinkId& child_frame_sink_id) { | ||
frame_sink_manager_->RegisterFrameSinkHierarchy(parent_frame_sink_id, | ||
child_frame_sink_id); | ||
} | ||
|
||
void FrameSinkManagerClientBinding::UnregisterFrameSinkHierarchy( | ||
const cc::FrameSinkId& parent_frame_sink_id, | ||
const cc::FrameSinkId& child_frame_sink_id) { | ||
frame_sink_manager_->UnregisterFrameSinkHierarchy(parent_frame_sink_id, | ||
child_frame_sink_id); | ||
} | ||
|
||
void FrameSinkManagerClientBinding::DropTemporaryReference( | ||
const cc::SurfaceId& surface_id) { | ||
frame_sink_manager_->DropTemporaryReference(surface_id); | ||
} | ||
|
||
} // namespace ws | ||
} // namespace ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef SERVICES_UI_WS_FRAME_SINK_MANAGER_CLIENT_BINDING_H_ | ||
#define SERVICES_UI_WS_FRAME_SINK_MANAGER_CLIENT_BINDING_H_ | ||
|
||
#include "base/macros.h" | ||
#include "cc/ipc/frame_sink_manager.mojom.h" | ||
#include "mojo/public/cpp/bindings/binding.h" | ||
|
||
namespace ui { | ||
namespace ws { | ||
|
||
class GpuHost; | ||
class WindowServer; | ||
|
||
// FrameSinkManagerClientBinding manages the binding between a WindowServer and | ||
// its FrameSinkManager. FrameSinkManagerClientBinding exists so that a mock | ||
// implementation of FrameSinkManager can be injected for tests. WindowServer | ||
// owns its associated FrameSinkManagerClientBinding. | ||
class FrameSinkManagerClientBinding : public cc::mojom::FrameSinkManager { | ||
public: | ||
FrameSinkManagerClientBinding( | ||
cc::mojom::FrameSinkManagerClient* frame_sink_manager_client, | ||
GpuHost* gpu_host); | ||
~FrameSinkManagerClientBinding() override; | ||
|
||
private: | ||
// cc::mojom::FrameSinkManager: | ||
void CreateRootCompositorFrameSink( | ||
const cc::FrameSinkId& frame_sink_id, | ||
gpu::SurfaceHandle surface_handle, | ||
cc::mojom::MojoCompositorFrameSinkAssociatedRequest request, | ||
cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | ||
cc::mojom::MojoCompositorFrameSinkClientPtr client, | ||
cc::mojom::DisplayPrivateAssociatedRequest display_private_request) | ||
override; | ||
void CreateCompositorFrameSink( | ||
const cc::FrameSinkId& frame_sink_id, | ||
cc::mojom::MojoCompositorFrameSinkRequest request, | ||
cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | ||
cc::mojom::MojoCompositorFrameSinkClientPtr client) override; | ||
void RegisterFrameSinkHierarchy( | ||
const cc::FrameSinkId& parent_frame_sink_id, | ||
const cc::FrameSinkId& child_frame_sink_id) override; | ||
void UnregisterFrameSinkHierarchy( | ||
const cc::FrameSinkId& parent_frame_sink_id, | ||
const cc::FrameSinkId& child_frame_sink_id) override; | ||
void DropTemporaryReference(const cc::SurfaceId& surface_id) override; | ||
|
||
mojo::Binding<cc::mojom::FrameSinkManagerClient> | ||
frame_sink_manager_client_binding_; | ||
cc::mojom::FrameSinkManagerPtr frame_sink_manager_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(FrameSinkManagerClientBinding); | ||
}; | ||
|
||
} // namespace ws | ||
} // namespace ui | ||
|
||
#endif // SERVICES_UI_WS_FRAME_SINK_MANAGER_CLIENT_BINDING_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters