| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 13 #include "components/mus/public/cpp/mus_public_export.h" |
| 13 #include "components/mus/public/interfaces/compositor_frame.mojom.h" | 14 #include "components/mus/public/interfaces/compositor_frame.mojom.h" |
| 14 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 15 #include "mojo/public/cpp/bindings/interface_ptr_info.h" | 16 #include "mojo/public/cpp/bindings/interface_ptr_info.h" |
| 16 | 17 |
| 17 namespace mus { | 18 namespace mus { |
| 18 | 19 |
| 19 class WindowSurfaceBinding; | 20 class WindowSurfaceBinding; |
| 20 class WindowSurfaceClient; | 21 class WindowSurfaceClient; |
| 21 class Window; | 22 class Window; |
| 22 | 23 |
| 23 // A WindowSurface is wrapper to simplify submitting CompositorFrames to | 24 // A WindowSurface is wrapper to simplify submitting CompositorFrames to |
| 24 // Windows, and receiving ReturnedResources. | 25 // Windows, and receiving ReturnedResources. |
| 25 class WindowSurface : public mojom::SurfaceClient { | 26 class MUS_PUBLIC_EXPORT WindowSurface : public mojom::SurfaceClient { |
| 26 public: | 27 public: |
| 27 // static | 28 // static |
| 28 static std::unique_ptr<WindowSurface> Create( | 29 static std::unique_ptr<WindowSurface> Create( |
| 29 std::unique_ptr<WindowSurfaceBinding>* surface_binding); | 30 std::unique_ptr<WindowSurfaceBinding>* surface_binding); |
| 30 | 31 |
| 31 ~WindowSurface() override; | 32 ~WindowSurface() override; |
| 32 | 33 |
| 33 // Called to indicate that the current thread has assumed control of this | 34 // Called to indicate that the current thread has assumed control of this |
| 34 // object. | 35 // object. |
| 35 void BindToThread(); | 36 void BindToThread(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 55 mojom::SurfacePtr surface_; | 56 mojom::SurfacePtr surface_; |
| 56 std::unique_ptr<mojo::Binding<mojom::SurfaceClient>> client_binding_; | 57 std::unique_ptr<mojo::Binding<mojom::SurfaceClient>> client_binding_; |
| 57 std::unique_ptr<base::ThreadChecker> thread_checker_; | 58 std::unique_ptr<base::ThreadChecker> thread_checker_; |
| 58 | 59 |
| 59 DISALLOW_COPY_AND_ASSIGN(WindowSurface); | 60 DISALLOW_COPY_AND_ASSIGN(WindowSurface); |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 // A WindowSurfaceBinding is a bundle of mojo interfaces that are to be used by | 63 // A WindowSurfaceBinding is a bundle of mojo interfaces that are to be used by |
| 63 // or implemented by the Mus window server when passed into | 64 // or implemented by the Mus window server when passed into |
| 64 // Window::AttachSurface. WindowSurfaceBinding has no standalone functionality. | 65 // Window::AttachSurface. WindowSurfaceBinding has no standalone functionality. |
| 65 class WindowSurfaceBinding { | 66 class MUS_PUBLIC_EXPORT WindowSurfaceBinding { |
| 66 public: | 67 public: |
| 67 ~WindowSurfaceBinding(); | 68 ~WindowSurfaceBinding(); |
| 68 | 69 |
| 69 private: | 70 private: |
| 70 friend class WindowSurface; | 71 friend class WindowSurface; |
| 71 friend class Window; | 72 friend class Window; |
| 72 | 73 |
| 73 WindowSurfaceBinding( | 74 WindowSurfaceBinding( |
| 74 mojo::InterfaceRequest<mojom::Surface> surface_request, | 75 mojo::InterfaceRequest<mojom::Surface> surface_request, |
| 75 mojo::InterfacePtrInfo<mojom::SurfaceClient> surface_client); | 76 mojo::InterfacePtrInfo<mojom::SurfaceClient> surface_client); |
| 76 | 77 |
| 77 mojo::InterfaceRequest<mojom::Surface> surface_request_; | 78 mojo::InterfaceRequest<mojom::Surface> surface_request_; |
| 78 mojo::InterfacePtrInfo<mojom::SurfaceClient> surface_client_; | 79 mojo::InterfacePtrInfo<mojom::SurfaceClient> surface_client_; |
| 79 | 80 |
| 80 DISALLOW_COPY_AND_ASSIGN(WindowSurfaceBinding); | 81 DISALLOW_COPY_AND_ASSIGN(WindowSurfaceBinding); |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 } // namespace mus | 84 } // namespace mus |
| 84 | 85 |
| 85 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_ | 86 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_ |
| OLD | NEW |