| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CC_SURFACES_SURFACE_FACTORY_H_ | 5 #ifndef CC_SURFACES_SURFACE_FACTORY_H_ |
| 6 #define CC_SURFACES_SURFACE_FACTORY_H_ | 6 #define CC_SURFACES_SURFACE_FACTORY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 ~SurfaceFactory() override; | 43 ~SurfaceFactory() override; |
| 44 | 44 |
| 45 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } | 45 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
| 46 | 46 |
| 47 // Destroys the current surface. You need to call this method before the | 47 // Destroys the current surface. You need to call this method before the |
| 48 // factory is destroyed, or when you would like to get rid of the surface as | 48 // factory is destroyed, or when you would like to get rid of the surface as |
| 49 // soon as possible (otherwise, the next time you call SubmitCompositorFrame | 49 // soon as possible (otherwise, the next time you call SubmitCompositorFrame |
| 50 // the old surface will be dealt with). | 50 // the old surface will be dealt with). |
| 51 void EvictSurface(); | 51 void EvictSurface(); |
| 52 | 52 |
| 53 // Destroys and disowns the current surface, and resets all resource | |
| 54 // references. This is useful when resources are invalid (e.g. lost context). | |
| 55 void Reset(); | |
| 56 | |
| 57 // Submits the frame to the current surface being managed by the factory if | 53 // Submits the frame to the current surface being managed by the factory if |
| 58 // the local frame ids match, or creates a new surface with the given local | 54 // the local frame ids match, or creates a new surface with the given local |
| 59 // frame id, destroys the old one, and submits the frame to this new surface. | 55 // frame id, destroys the old one, and submits the frame to this new surface. |
| 60 // The frame can contain references to any surface, regardless of which | 56 // The frame can contain references to any surface, regardless of which |
| 61 // factory owns it. The callback is called the first time this frame is used | 57 // factory owns it. The callback is called the first time this frame is used |
| 62 // to draw, or if the frame is discarded. | 58 // to draw, or if the frame is discarded. |
| 63 void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, | 59 void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, |
| 64 CompositorFrame frame, | 60 CompositorFrame frame, |
| 65 const DrawCallback& callback); | 61 const DrawCallback& callback); |
| 66 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> copy_request); | 62 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> copy_request); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 bool seen_first_frame_activation_ = false; | 107 bool seen_first_frame_activation_ = false; |
| 112 std::unique_ptr<Surface> current_surface_; | 108 std::unique_ptr<Surface> current_surface_; |
| 113 base::WeakPtrFactory<SurfaceFactory> weak_factory_; | 109 base::WeakPtrFactory<SurfaceFactory> weak_factory_; |
| 114 | 110 |
| 115 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); | 111 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); |
| 116 }; | 112 }; |
| 117 | 113 |
| 118 } // namespace cc | 114 } // namespace cc |
| 119 | 115 |
| 120 #endif // CC_SURFACES_SURFACE_FACTORY_H_ | 116 #endif // CC_SURFACES_SURFACE_FACTORY_H_ |
| OLD | NEW |