| Index: components/view_manager/public/cpp/lib/view_surface.cc
|
| diff --git a/components/view_manager/public/cpp/lib/view_surface.cc b/components/view_manager/public/cpp/lib/view_surface.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..17a0b23b6545cefd7a3594cbe06ff86cb4fa1083
|
| --- /dev/null
|
| +++ b/components/view_manager/public/cpp/lib/view_surface.cc
|
| @@ -0,0 +1,46 @@
|
| +// 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/view_surface.h"
|
| +
|
| +#include "components/view_manager/public/cpp/view_surface_client.h"
|
| +#include "mojo/converters/surfaces/surfaces_type_converters.h"
|
| +
|
| +namespace mojo {
|
| +
|
| +ViewSurface::~ViewSurface() {
|
| +}
|
| +
|
| +void ViewSurface::BindToThread() {
|
| + DCHECK(!bound_to_thread_);
|
| + bound_to_thread_ = true;
|
| + surface_.Bind(surface_info_.Pass());
|
| + client_binding_.Bind(client_request_.Pass());
|
| +}
|
| +
|
| +void ViewSurface::SubmitCompositorFrame(mojo::CompositorFramePtr frame) {
|
| + DCHECK(bound_to_thread_);
|
| + if (!surface_)
|
| + return;
|
| + surface_->SubmitCompositorFrame(frame.Pass(), mojo::Closure());
|
| +}
|
| +
|
| +ViewSurface::ViewSurface(
|
| + 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 ViewSurface::ReturnResources(
|
| + mojo::Array<mojo::ReturnedResourcePtr> resources) {
|
| + if (!client_)
|
| + return;
|
| + client_->OnResourcesReturned(this, resources.Pass());
|
| +}
|
| +
|
| +} // namespace mojo
|
|
|