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/callback.h" | |
11 #include "base/macros.h" | 10 #include "base/macros.h" |
12 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
13 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
14 #include "components/mus/public/interfaces/compositor_frame.mojom.h" | 13 #include "components/mus/public/interfaces/compositor_frame.mojom.h" |
15 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
16 #include "mojo/public/cpp/bindings/interface_ptr_info.h" | 15 #include "mojo/public/cpp/bindings/interface_ptr_info.h" |
17 | 16 |
18 namespace mus { | 17 namespace mus { |
19 | 18 |
20 class WindowSurfaceBinding; | 19 class WindowSurfaceBinding; |
21 class WindowSurfaceClient; | 20 class WindowSurfaceClient; |
22 class Window; | 21 class Window; |
23 | 22 |
24 // A WindowSurface is wrapper to simplify submitting CompositorFrames to | 23 // A WindowSurface is wrapper to simplify submitting CompositorFrames to |
25 // Windows, and receiving ReturnedResources. | 24 // Windows, and receiving ReturnedResources. |
26 class WindowSurface : public mojom::SurfaceClient { | 25 class WindowSurface : public mojom::SurfaceClient { |
27 public: | 26 public: |
28 // static | 27 // static |
29 static std::unique_ptr<WindowSurface> Create( | 28 static std::unique_ptr<WindowSurface> Create( |
30 std::unique_ptr<WindowSurfaceBinding>* surface_binding); | 29 std::unique_ptr<WindowSurfaceBinding>* surface_binding); |
31 | 30 |
32 ~WindowSurface() override; | 31 ~WindowSurface() override; |
33 | 32 |
34 // Called to indicate that the current thread has assumed control of this | 33 // Called to indicate that the current thread has assumed control of this |
35 // object. | 34 // object. |
36 void BindToThread(); | 35 void BindToThread(); |
37 | 36 |
38 void SubmitCompositorFrame(mojom::CompositorFramePtr frame, | 37 void SubmitCompositorFrame(mojom::CompositorFramePtr frame, |
39 const base::Closure& callback); | 38 const mojo::Closure& callback); |
40 | 39 |
41 void set_client(WindowSurfaceClient* client) { client_ = client; } | 40 void set_client(WindowSurfaceClient* client) { client_ = client; } |
42 | 41 |
43 private: | 42 private: |
44 friend class Window; | 43 friend class Window; |
45 | 44 |
46 WindowSurface(mojo::InterfacePtrInfo<mojom::Surface> surface_info, | 45 WindowSurface(mojo::InterfacePtrInfo<mojom::Surface> surface_info, |
47 mojo::InterfaceRequest<mojom::SurfaceClient> client_request); | 46 mojo::InterfaceRequest<mojom::SurfaceClient> client_request); |
48 | 47 |
49 // SurfaceClient implementation: | 48 // SurfaceClient implementation: |
(...skipping 26 matching lines...) Expand all Loading... |
76 | 75 |
77 mojo::InterfaceRequest<mojom::Surface> surface_request_; | 76 mojo::InterfaceRequest<mojom::Surface> surface_request_; |
78 mojo::InterfacePtrInfo<mojom::SurfaceClient> surface_client_; | 77 mojo::InterfacePtrInfo<mojom::SurfaceClient> surface_client_; |
79 | 78 |
80 DISALLOW_COPY_AND_ASSIGN(WindowSurfaceBinding); | 79 DISALLOW_COPY_AND_ASSIGN(WindowSurfaceBinding); |
81 }; | 80 }; |
82 | 81 |
83 } // namespace mus | 82 } // namespace mus |
84 | 83 |
85 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_ | 84 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_ |
OLD | NEW |