Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / components / mus / public / cpp / lib / view_surface.cc
blobf5d9a26abc5ccd2741bfb6a9f2d586f650b0c3d4
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"
10 namespace mus {
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_);
23 if (!surface_)
24 return;
25 surface_->SubmitCompositorFrame(frame.Pass(), mojo::Closure());
28 ViewSurface::ViewSurface(
29 mojo::InterfacePtrInfo<mojo::Surface> surface_info,
30 mojo::InterfaceRequest<mojo::SurfaceClient> client_request)
31 : client_(nullptr),
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) {
39 if (!client_)
40 return;
41 client_->OnResourcesReturned(this, resources.Pass());
44 } // namespace mus