Chromium Code Reviews| Index: services/ui/public/cpp/window_surface.cc |
| diff --git a/services/ui/public/cpp/window_surface.cc b/services/ui/public/cpp/window_surface.cc |
| index a9d19410930ea5d25dac43f6ecd147e5c01da8f2..b476d9ef8749f7148f33d0d213fb0167ac0de7cb 100644 |
| --- a/services/ui/public/cpp/window_surface.cc |
| +++ b/services/ui/public/cpp/window_surface.cc |
| @@ -12,10 +12,10 @@ namespace ui { |
| // static |
| std::unique_ptr<WindowSurface> WindowSurface::Create( |
| std::unique_ptr<WindowSurfaceBinding>* surface_binding) { |
| - mojom::SurfacePtr surface; |
| - mojom::SurfaceClientPtr surface_client; |
| - mojo::InterfaceRequest<mojom::SurfaceClient> surface_client_request = |
| - GetProxy(&surface_client); |
| + cc::mojom::MojoCompositorFrameSinkPtr surface; |
| + cc::mojom::MojoCompositorFrameSinkClientPtr surface_client; |
| + mojo::InterfaceRequest<cc::mojom::MojoCompositorFrameSinkClient> |
| + surface_client_request = GetProxy(&surface_client); |
| surface_binding->reset(new WindowSurfaceBinding( |
| GetProxy(&surface), surface_client.PassInterface())); |
| @@ -29,40 +29,50 @@ void WindowSurface::BindToThread() { |
| DCHECK(!thread_checker_); |
| thread_checker_.reset(new base::ThreadChecker()); |
| surface_.Bind(std::move(surface_info_)); |
| - client_binding_.reset(new mojo::Binding<mojom::SurfaceClient>( |
| - this, std::move(client_request_))); |
| + client_binding_.reset( |
| + new mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient>( |
| + this, std::move(client_request_))); |
| } |
| -void WindowSurface::SubmitCompositorFrame(cc::CompositorFrame frame, |
| - const base::Closure& callback) { |
| +void WindowSurface::SubmitCompositorFrame(cc::CompositorFrame frame) { |
| DCHECK(thread_checker_); |
| DCHECK(thread_checker_->CalledOnValidThread()); |
| if (!surface_) |
| return; |
| - surface_->SubmitCompositorFrame(std::move(frame), callback); |
| + surface_->SubmitCompositorFrame(std::move(frame)); |
| } |
| WindowSurface::WindowSurface( |
| - mojo::InterfacePtrInfo<mojom::Surface> surface_info, |
| - mojo::InterfaceRequest<mojom::SurfaceClient> client_request) |
| + mojo::InterfacePtrInfo<cc::mojom::MojoCompositorFrameSink> surface_info, |
| + mojo::InterfaceRequest<cc::mojom::MojoCompositorFrameSinkClient> |
| + client_request) |
| : client_(nullptr), |
| surface_info_(std::move(surface_info)), |
| client_request_(std::move(client_request)) {} |
| -void WindowSurface::ReturnResources( |
| +void WindowSurface::DidReceiveCompositorFrameAck() { |
| + DCHECK(thread_checker_); |
| + DCHECK(thread_checker_->CalledOnValidThread()); |
|
rjkroege
2016/10/20 21:33:18
What are the thread rules? Why doesn't the mojo bi
Fady Samuel
2016/10/20 23:04:10
In use-mus-in-renderer, we create a WindowSurface
|
| + if (!client_) |
| + return; |
| + client_->DidReceiveCompositorFrameAck(); |
| +} |
| + |
| +void WindowSurface::ReclaimResources( |
| const cc::ReturnedResourceArray& resources) { |
| DCHECK(thread_checker_); |
| DCHECK(thread_checker_->CalledOnValidThread()); |
| if (!client_) |
| return; |
| - client_->OnResourcesReturned(this, std::move(resources)); |
| + client_->ReclaimResources(std::move(resources)); |
| } |
| WindowSurfaceBinding::~WindowSurfaceBinding() {} |
| WindowSurfaceBinding::WindowSurfaceBinding( |
| - mojo::InterfaceRequest<mojom::Surface> surface_request, |
| - mojo::InterfacePtrInfo<mojom::SurfaceClient> surface_client) |
| + mojo::InterfaceRequest<cc::mojom::MojoCompositorFrameSink> surface_request, |
| + mojo::InterfacePtrInfo<cc::mojom::MojoCompositorFrameSinkClient> |
| + surface_client) |
| : surface_request_(std::move(surface_request)), |
| surface_client_(std::move(surface_client)) {} |