| Index: components/view_manager/public/cpp/lib/surface.cc
|
| diff --git a/components/view_manager/public/cpp/lib/surface.cc b/components/view_manager/public/cpp/lib/surface.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..22e6b4528a236035ed0d6a54f9c81c18723d78b2
|
| --- /dev/null
|
| +++ b/components/view_manager/public/cpp/lib/surface.cc
|
| @@ -0,0 +1,43 @@
|
| +// Copyright 2015 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 "components/view_manager/public/cpp/surface.h"
|
| +
|
| +#include "components/view_manager/public/cpp/surface_client.h"
|
| +#include "mojo/converters/surfaces/surfaces_type_converters.h"
|
| +
|
| +namespace uip {
|
| +
|
| +Surface::~Surface() {
|
| +}
|
| +
|
| +void Surface::BindToThread() {
|
| + DCHECK(!bound_to_thread_);
|
| + bound_to_thread_ = true;
|
| + surface_.Bind(surface_info_.Pass());
|
| + client_binding_.Bind(client_request_.Pass());
|
| +}
|
| +
|
| +void Surface::SubmitCompositorFrame(mojo::CompositorFramePtr frame) {
|
| + DCHECK(bound_to_thread_);
|
| + surface_->SubmitCompositorFrame(frame.Pass(), mojo::Closure());
|
| +}
|
| +
|
| +Surface::Surface(mojo::InterfacePtrInfo<mojo::Surface> surface_info,
|
| + mojo::InterfaceRequest<mojo::SurfaceClient> client_request)
|
| + : client_(nullptr),
|
| + surface_info_(surface_info.Pass()),
|
| + client_request_(client_request.Pass()),
|
| + client_binding_(this),
|
| + bound_to_thread_(false) {
|
| +}
|
| +
|
| +void Surface::ReturnResources(
|
| + mojo::Array<mojo::ReturnedResourcePtr> resources) {
|
| + if (!client_)
|
| + return;
|
| + client_->OnResourcesReturned(this, resources.Pass());
|
| +}
|
| +
|
| +} // namespace uip
|
|
|