cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / components / view_manager / public / cpp / view_surface.h
blob6cf3aa27d1bd2f8de7701f8a492a13035e7584f6
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 #ifndef COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_SURFACE_H_
6 #define COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_SURFACE_H_
8 #include "base/observer_list.h"
9 #include "components/view_manager/public/interfaces/compositor_frame.mojom.h"
10 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
11 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h"
13 namespace mojo {
15 class ViewSurfaceClient;
16 class View;
18 // A ViewSurface is wrapper to simplify submitting CompositorFrames to Views,
19 // and receiving ReturnedResources.
20 class ViewSurface : public mojo::SurfaceClient {
21 public:
22 ~ViewSurface() override;
24 // Called to indicate that the current thread has assumed control of this
25 // object.
26 void BindToThread();
29 // TODO(fsamuel): Add a callback.
30 void SubmitCompositorFrame(mojo::CompositorFramePtr frame);
32 void set_client(mojo::ViewSurfaceClient* client) { client_ = client; }
34 private:
35 friend class mojo::View;
37 ViewSurface(mojo::InterfacePtrInfo<mojo::Surface> surface_info,
38 mojo::InterfaceRequest<mojo::SurfaceClient> client_request);
40 // SurfaceClient implementation:
41 void ReturnResources(
42 mojo::Array<mojo::ReturnedResourcePtr> resources) override;
44 mojo::ViewSurfaceClient* client_;
45 mojo::InterfacePtrInfo<mojo::Surface> surface_info_;
46 mojo::InterfaceRequest<mojo::SurfaceClient> client_request_;
47 mojo::SurfacePtr surface_;
48 mojo::Binding<mojo::SurfaceClient> client_binding_;
49 bool bound_to_thread_;
52 } // namespace mojo
54 #endif // COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_SURFACE_H_