| 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_H_ | 5 #ifndef CC_SURFACES_SURFACE_H_ |
| 6 #define CC_SURFACES_SURFACE_H_ | 6 #define CC_SURFACES_SURFACE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 class SurfaceResourceHolder; | 37 class SurfaceResourceHolder; |
| 38 | 38 |
| 39 class CC_SURFACES_EXPORT Surface { | 39 class CC_SURFACES_EXPORT Surface { |
| 40 public: | 40 public: |
| 41 using DrawCallback = SurfaceFactory::DrawCallback; | 41 using DrawCallback = SurfaceFactory::DrawCallback; |
| 42 | 42 |
| 43 Surface(SurfaceId id, SurfaceFactory* factory); | 43 Surface(SurfaceId id, SurfaceFactory* factory); |
| 44 ~Surface(); | 44 ~Surface(); |
| 45 | 45 |
| 46 SurfaceId surface_id() const { return surface_id_; } | 46 SurfaceId surface_id() const { return surface_id_; } |
| 47 SurfaceId previous_frame_surface_id() const { |
| 48 return previous_frame_surface_id_; |
| 49 } |
| 50 |
| 51 void SetPreviousFrameSurface(Surface* surface); |
| 47 | 52 |
| 48 void QueueFrame(std::unique_ptr<CompositorFrame> frame, | 53 void QueueFrame(std::unique_ptr<CompositorFrame> frame, |
| 49 const DrawCallback& draw_callback); | 54 const DrawCallback& draw_callback); |
| 50 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> copy_request); | 55 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> copy_request); |
| 51 // Adds each CopyOutputRequest in the current frame to copy_requests. The | 56 // Adds each CopyOutputRequest in the current frame to copy_requests. The |
| 52 // caller takes ownership of them. | 57 // caller takes ownership of them. |
| 53 void TakeCopyOutputRequests( | 58 void TakeCopyOutputRequests( |
| 54 std::multimap<RenderPassId, std::unique_ptr<CopyOutputRequest>>* | 59 std::multimap<RenderPassId, std::unique_ptr<CopyOutputRequest>>* |
| 55 copy_requests); | 60 copy_requests); |
| 56 // Returns the most recent frame that is eligible to be rendered. | 61 // Returns the most recent frame that is eligible to be rendered. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 81 return referenced_surfaces_; | 86 return referenced_surfaces_; |
| 82 } | 87 } |
| 83 | 88 |
| 84 bool destroyed() const { return destroyed_; } | 89 bool destroyed() const { return destroyed_; } |
| 85 void set_destroyed(bool destroyed) { destroyed_ = destroyed; } | 90 void set_destroyed(bool destroyed) { destroyed_ = destroyed; } |
| 86 | 91 |
| 87 private: | 92 private: |
| 88 void ClearCopyRequests(); | 93 void ClearCopyRequests(); |
| 89 | 94 |
| 90 SurfaceId surface_id_; | 95 SurfaceId surface_id_; |
| 96 SurfaceId previous_frame_surface_id_; |
| 91 base::WeakPtr<SurfaceFactory> factory_; | 97 base::WeakPtr<SurfaceFactory> factory_; |
| 92 // TODO(jamesr): Support multiple frames in flight. | 98 // TODO(jamesr): Support multiple frames in flight. |
| 93 std::unique_ptr<CompositorFrame> current_frame_; | 99 std::unique_ptr<CompositorFrame> current_frame_; |
| 94 int frame_index_; | 100 int frame_index_; |
| 95 bool destroyed_; | 101 bool destroyed_; |
| 96 std::vector<SurfaceSequence> destruction_dependencies_; | 102 std::vector<SurfaceSequence> destruction_dependencies_; |
| 97 | 103 |
| 98 // This surface may have multiple BeginFrameSources if it is | 104 // This surface may have multiple BeginFrameSources if it is |
| 99 // on multiple Displays. | 105 // on multiple Displays. |
| 100 std::set<BeginFrameSource*> begin_frame_sources_; | 106 std::set<BeginFrameSource*> begin_frame_sources_; |
| 101 | 107 |
| 102 std::vector<SurfaceId> referenced_surfaces_; | 108 std::vector<SurfaceId> referenced_surfaces_; |
| 103 | 109 |
| 104 DrawCallback draw_callback_; | 110 DrawCallback draw_callback_; |
| 105 | 111 |
| 106 DISALLOW_COPY_AND_ASSIGN(Surface); | 112 DISALLOW_COPY_AND_ASSIGN(Surface); |
| 107 }; | 113 }; |
| 108 | 114 |
| 109 } // namespace cc | 115 } // namespace cc |
| 110 | 116 |
| 111 #endif // CC_SURFACES_SURFACE_H_ | 117 #endif // CC_SURFACES_SURFACE_H_ |
| OLD | NEW |