| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_ | 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_ |
| 6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_ | 6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "components/mus/public/interfaces/compositor_frame.mojom.h" | 10 #include "components/mus/public/interfaces/compositor_frame.mojom.h" |
| 11 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" | 11 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
| 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h" | 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr_info.h" |
| 13 | 13 |
| 14 namespace mus { | 14 namespace mus { |
| 15 | 15 |
| 16 class WindowSurfaceClient; | 16 class WindowSurfaceClient; |
| 17 class Window; | 17 class Window; |
| 18 | 18 |
| 19 // A WindowSurface is wrapper to simplify submitting CompositorFrames to Views, | 19 // A WindowSurface is wrapper to simplify submitting CompositorFrames to Views, |
| 20 // and receiving ReturnedResources. | 20 // and receiving ReturnedResources. |
| 21 class WindowSurface : public mojo::SurfaceClient { | 21 class WindowSurface : public mojom::SurfaceClient { |
| 22 public: | 22 public: |
| 23 ~WindowSurface() override; | 23 ~WindowSurface() override; |
| 24 | 24 |
| 25 // Called to indicate that the current thread has assumed control of this | 25 // Called to indicate that the current thread has assumed control of this |
| 26 // object. | 26 // object. |
| 27 void BindToThread(); | 27 void BindToThread(); |
| 28 | 28 |
| 29 void SubmitCompositorFrame(mojo::CompositorFramePtr frame, | 29 void SubmitCompositorFrame(mojom::CompositorFramePtr frame, |
| 30 const mojo::Closure& callback); | 30 const mojo::Closure& callback); |
| 31 | 31 |
| 32 void set_client(WindowSurfaceClient* client) { client_ = client; } | 32 void set_client(WindowSurfaceClient* client) { client_ = client; } |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 friend class Window; | 35 friend class Window; |
| 36 | 36 |
| 37 WindowSurface(mojo::InterfacePtrInfo<mojo::Surface> surface_info, | 37 WindowSurface(mojo::InterfacePtrInfo<mojom::Surface> surface_info, |
| 38 mojo::InterfaceRequest<mojo::SurfaceClient> client_request); | 38 mojo::InterfaceRequest<mojom::SurfaceClient> client_request); |
| 39 | 39 |
| 40 // SurfaceClient implementation: | 40 // SurfaceClient implementation: |
| 41 void ReturnResources( | 41 void ReturnResources( |
| 42 mojo::Array<mojo::ReturnedResourcePtr> resources) override; | 42 mojo::Array<mojom::ReturnedResourcePtr> resources) override; |
| 43 | 43 |
| 44 WindowSurfaceClient* client_; | 44 WindowSurfaceClient* client_; |
| 45 mojo::InterfacePtrInfo<mojo::Surface> surface_info_; | 45 mojo::InterfacePtrInfo<mojom::Surface> surface_info_; |
| 46 mojo::InterfaceRequest<mojo::SurfaceClient> client_request_; | 46 mojo::InterfaceRequest<mojom::SurfaceClient> client_request_; |
| 47 mojo::SurfacePtr surface_; | 47 mojom::SurfacePtr surface_; |
| 48 scoped_ptr<mojo::Binding<mojo::SurfaceClient>> client_binding_; | 48 scoped_ptr<mojo::Binding<mojom::SurfaceClient>> client_binding_; |
| 49 bool bound_to_thread_; | 49 bool bound_to_thread_; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 } // namespace mus | 52 } // namespace mus |
| 53 | 53 |
| 54 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_ | 54 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_ |
| OLD | NEW |