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_WS_SERVER_WINDOW_SURFACE_H_ | 5 #ifndef COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_H_ |
6 #define COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_H_ | 6 #define COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // to this window. | 52 // to this window. |
53 const std::set<WindowId>& referenced_window_ids() const { | 53 const std::set<WindowId>& referenced_window_ids() const { |
54 return referenced_window_ids_; | 54 return referenced_window_ids_; |
55 } | 55 } |
56 | 56 |
57 const cc::SurfaceId& id() const { return surface_id_; } | 57 const cc::SurfaceId& id() const { return surface_id_; } |
58 | 58 |
59 // Destroys old surfaces that have been outdated by a new surface. | 59 // Destroys old surfaces that have been outdated by a new surface. |
60 void DestroySurfacesScheduledForDestruction(); | 60 void DestroySurfacesScheduledForDestruction(); |
61 | 61 |
| 62 // Registers this with the SurfaceManager |
| 63 void RegisterForBeginFrames(); |
| 64 |
62 private: | 65 private: |
63 ServerWindow* window(); | 66 ServerWindow* window(); |
64 | 67 |
65 // Takes a mojom::CompositorFrame |input|, and converts it into a | 68 // Takes a mojom::CompositorFrame |input|, and converts it into a |
66 // cc::CompositorFrame. Along the way, this conversion ensures that a | 69 // cc::CompositorFrame. Along the way, this conversion ensures that a |
67 // CompositorFrame of this window can only refer to windows within its | 70 // CompositorFrame of this window can only refer to windows within its |
68 // subtree. Windows referenced in |input| are stored in | 71 // subtree. Windows referenced in |input| are stored in |
69 // |referenced_window_ids_|. | 72 // |referenced_window_ids_|. |
70 scoped_ptr<cc::CompositorFrame> ConvertCompositorFrame( | 73 scoped_ptr<cc::CompositorFrame> ConvertCompositorFrame( |
71 const mojom::CompositorFramePtr& input); | 74 const mojom::CompositorFramePtr& input); |
72 | 75 |
73 // Overriden from CustomSurfaceConverter: | 76 // Overriden from CustomSurfaceConverter: |
74 bool ConvertSurfaceDrawQuad(const mojom::QuadPtr& input, | 77 bool ConvertSurfaceDrawQuad(const mojom::QuadPtr& input, |
75 const mojom::CompositorFrameMetadataPtr& metadata, | 78 const mojom::CompositorFrameMetadataPtr& metadata, |
76 cc::SharedQuadState* sqs, | 79 cc::SharedQuadState* sqs, |
77 cc::RenderPass* render_pass) override; | 80 cc::RenderPass* render_pass) override; |
78 | 81 |
79 // SurfaceFactoryClient implementation. | 82 // SurfaceFactoryClient implementation. |
80 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 83 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
81 void SetBeginFrameSource(cc::SurfaceId surface_id, | 84 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
82 cc::BeginFrameSource* begin_frame_source) override; | |
83 | 85 |
84 ServerWindowSurfaceManager* manager_; // Owns this. | 86 ServerWindowSurfaceManager* manager_; // Owns this. |
85 | 87 |
86 const mojom::SurfaceType surface_type_; | 88 const mojom::SurfaceType surface_type_; |
87 | 89 |
88 // The set of Windows referenced in the last submitted CompositorFrame. | 90 // The set of Windows referenced in the last submitted CompositorFrame. |
89 std::set<WindowId> referenced_window_ids_; | 91 std::set<WindowId> referenced_window_ids_; |
90 gfx::Size last_submitted_frame_size_; | 92 gfx::Size last_submitted_frame_size_; |
91 | 93 |
92 cc::SurfaceId surface_id_; | 94 cc::SurfaceId surface_id_; |
93 cc::SurfaceFactory surface_factory_; | 95 cc::SurfaceFactory surface_factory_; |
94 | 96 |
95 mojom::SurfaceClientPtr client_; | 97 mojom::SurfaceClientPtr client_; |
96 mojo::Binding<Surface> binding_; | 98 mojo::Binding<Surface> binding_; |
97 | 99 |
98 // Set of surface ids that need to be destroyed. | 100 // Set of surface ids that need to be destroyed. |
99 std::set<cc::SurfaceId> surfaces_scheduled_for_destruction_; | 101 std::set<cc::SurfaceId> surfaces_scheduled_for_destruction_; |
100 | 102 |
| 103 bool registered_surface_factory_client_; |
| 104 |
101 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurface); | 105 DISALLOW_COPY_AND_ASSIGN(ServerWindowSurface); |
102 }; | 106 }; |
103 | 107 |
104 } // namespace ws | 108 } // namespace ws |
105 | 109 |
106 } // namespace mus | 110 } // namespace mus |
107 | 111 |
108 #endif // COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_H_ | 112 #endif // COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_H_ |
OLD | NEW |