| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_DEPENDENCY_TRACKER_H_ | 5 #ifndef CC_SURFACES_SURFACE_DEPENDENCY_TRACKER_H_ |
| 6 #define CC_SURFACES_SURFACE_DEPENDENCY_TRACKER_H_ | 6 #define CC_SURFACES_SURFACE_DEPENDENCY_TRACKER_H_ |
| 7 | 7 |
| 8 #include "cc/scheduler/begin_frame_source.h" | 8 #include "cc/scheduler/begin_frame_source.h" |
| 9 #include "cc/surfaces/pending_frame_observer.h" | 9 #include "cc/surfaces/pending_frame_observer.h" |
| 10 #include "cc/surfaces/surface.h" | 10 #include "cc/surfaces/surface.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // SurfaceObserver implementation: | 64 // SurfaceObserver implementation: |
| 65 void OnSurfaceCreated(const SurfaceInfo& surface_info) override; | 65 void OnSurfaceCreated(const SurfaceInfo& surface_info) override; |
| 66 void OnSurfaceDamaged(const SurfaceId& surface_id, bool* changed) override; | 66 void OnSurfaceDamaged(const SurfaceId& surface_id, bool* changed) override; |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 // Informs all Surfaces with pending frames blocked on the provided | 69 // Informs all Surfaces with pending frames blocked on the provided |
| 70 // |surface_id| that there is now an active frame available in Surface | 70 // |surface_id| that there is now an active frame available in Surface |
| 71 // corresponding to |surface_id|. | 71 // corresponding to |surface_id|. |
| 72 void NotifySurfaceIdAvailable(const SurfaceId& surface_id); | 72 void NotifySurfaceIdAvailable(const SurfaceId& surface_id); |
| 73 | 73 |
| 74 // Determines whether we should be observing the BeginFrameSource and |
| 75 // starts/stops observing as necessary. |
| 76 void UpdateNeedsBeginFrames(); |
| 77 |
| 78 // Acknowledge and confirm the last BeginFrame we received after we have |
| 79 // activated all previously pending frames. |
| 80 void AcknowledgeLastBeginFrame(); |
| 81 |
| 74 SurfaceManager* const surface_manager_; | 82 SurfaceManager* const surface_manager_; |
| 75 | 83 |
| 76 // The last begin frame args generated by the begin frame source. | 84 // The last begin frame args generated by the begin frame source. |
| 77 BeginFrameArgs last_begin_frame_args_; | 85 BeginFrameArgs last_begin_frame_args_; |
| 78 | 86 |
| 79 // The BeginFrameSource used to set deadlines. | 87 // The BeginFrameSource used to set deadlines. |
| 80 BeginFrameSource* const begin_frame_source_; | 88 BeginFrameSource* const begin_frame_source_; |
| 81 | 89 |
| 82 // The number of BeginFrames observed since a deadline was set. If | 90 // The number of BeginFrames observed since a deadline was set. If |
| 83 // base::nullopt_t then a deadline is not set. | 91 // base::nullopt_t then a deadline is not set. |
| 84 base::Optional<uint32_t> frames_since_deadline_set_; | 92 base::Optional<uint32_t> frames_since_deadline_set_; |
| 85 | 93 |
| 86 // A map from a SurfaceId to the set of Surfaces blocked on that SurfaceId. | 94 // A map from a SurfaceId to the set of Surfaces blocked on that SurfaceId. |
| 87 std::unordered_map<SurfaceId, PendingSurfaceSet, SurfaceIdHash> | 95 std::unordered_map<SurfaceId, PendingSurfaceSet, SurfaceIdHash> |
| 88 blocked_surfaces_; | 96 blocked_surfaces_; |
| 89 | 97 |
| 90 PendingSurfaceSet pending_surfaces_; | 98 PendingSurfaceSet pending_surfaces_; |
| 91 | 99 |
| 100 // Whether we are currently observing the BeginFrameSource. |
| 101 bool needs_begin_frames_ = false; |
| 102 |
| 92 DISALLOW_COPY_AND_ASSIGN(SurfaceDependencyTracker); | 103 DISALLOW_COPY_AND_ASSIGN(SurfaceDependencyTracker); |
| 93 }; | 104 }; |
| 94 | 105 |
| 95 } // namespace cc | 106 } // namespace cc |
| 96 | 107 |
| 97 #endif // CC_SURFACES_SURFACE_DEPENDENCY_TRACKER_H_ | 108 #endif // CC_SURFACES_SURFACE_DEPENDENCY_TRACKER_H_ |
| OLD | NEW |