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 SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ | 5 #ifndef SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ |
6 #define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ | 6 #define SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 void CreateCompositorFrameSinkInternal( | 92 void CreateCompositorFrameSinkInternal( |
93 const cc::FrameSinkId& frame_sink_id, | 93 const cc::FrameSinkId& frame_sink_id, |
94 gpu::SurfaceHandle surface_handle, | 94 gpu::SurfaceHandle surface_handle, |
95 std::unique_ptr<cc::Display> display, | 95 std::unique_ptr<cc::Display> display, |
96 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source, | 96 std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source, |
97 cc::mojom::MojoCompositorFrameSinkRequest request, | 97 cc::mojom::MojoCompositorFrameSinkRequest request, |
98 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | 98 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, |
99 cc::mojom::MojoCompositorFrameSinkClientPtr client, | 99 cc::mojom::MojoCompositorFrameSinkClientPtr client, |
100 cc::mojom::DisplayPrivateRequest display_private_request); | 100 cc::mojom::DisplayPrivateRequest display_private_request); |
101 | 101 |
| 102 // It is necessary to pass |frame_sink_id| by value because the id |
| 103 // is owned by the GpuCompositorFrameSink in the map. When the sink is |
| 104 // removed from the map, |frame_sink_id| would also be destroyed if it were a |
| 105 // reference. But the map can continue to iterate and try to use it. Passing |
| 106 // by value avoids this. |
| 107 void DestroyCompositorFrameSink(cc::FrameSinkId frame_sink_id); |
| 108 |
102 // cc::SurfaceObserver implementation. | 109 // cc::SurfaceObserver implementation. |
103 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override; | 110 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override; |
104 void OnSurfaceDamaged(const cc::SurfaceId& surface_id, | 111 void OnSurfaceDamaged(const cc::SurfaceId& surface_id, |
105 bool* changed) override; | 112 bool* changed) override; |
106 | 113 |
107 // SurfaceManager should be the first object constructed and the last object | 114 // SurfaceManager should be the first object constructed and the last object |
108 // destroyed in order to ensure that all other objects that depend on it have | 115 // destroyed in order to ensure that all other objects that depend on it have |
109 // access to a valid pointer for the entirety of their liftimes. | 116 // access to a valid pointer for the entirety of their liftimes. |
110 cc::SurfaceManager manager_; | 117 cc::SurfaceManager manager_; |
111 | 118 |
(...skipping 13 matching lines...) Expand all Loading... |
125 | 132 |
126 cc::mojom::DisplayCompositorClientPtr client_; | 133 cc::mojom::DisplayCompositorClientPtr client_; |
127 mojo::Binding<cc::mojom::DisplayCompositor> binding_; | 134 mojo::Binding<cc::mojom::DisplayCompositor> binding_; |
128 | 135 |
129 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); | 136 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); |
130 }; | 137 }; |
131 | 138 |
132 } // namespace ui | 139 } // namespace ui |
133 | 140 |
134 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ | 141 #endif // SERVICES_UI_SURFACES_DISPLAY_COMPOSITOR_H_ |
OLD | NEW |