1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "components/mus/public/cpp/view_surface.h"
7 #include "components/mus/public/cpp/view_surface_client.h"
8 #include "mojo/converters/surfaces/surfaces_type_converters.h"
12 ViewSurface::~ViewSurface() {}
14 void ViewSurface::BindToThread() {
15 DCHECK(!bound_to_thread_
);
16 bound_to_thread_
= true;
17 surface_
.Bind(surface_info_
.Pass());
18 client_binding_
.Bind(client_request_
.Pass());
21 void ViewSurface::SubmitCompositorFrame(mojo::CompositorFramePtr frame
) {
22 DCHECK(bound_to_thread_
);
25 surface_
->SubmitCompositorFrame(frame
.Pass(), mojo::Closure());
28 ViewSurface::ViewSurface(
29 mojo::InterfacePtrInfo
<mojo::Surface
> surface_info
,
30 mojo::InterfaceRequest
<mojo::SurfaceClient
> client_request
)
32 surface_info_(surface_info
.Pass()),
33 client_request_(client_request
.Pass()),
34 client_binding_(this),
35 bound_to_thread_(false) {}
37 void ViewSurface::ReturnResources(
38 mojo::Array
<mojo::ReturnedResourcePtr
> resources
) {
41 client_
->OnResourcesReturned(this, resources
.Pass());