| 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 CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 class PendingSwap; | 60 class PendingSwap; |
| 61 class OverlayPlane; | 61 class OverlayPlane; |
| 62 | 62 |
| 63 ~ImageTransportSurfaceOverlayMac() override; | 63 ~ImageTransportSurfaceOverlayMac() override; |
| 64 | 64 |
| 65 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); | 65 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); |
| 66 | 66 |
| 67 void UpdateRootAndPartialDamagePlanes( | 67 void UpdateRootAndPartialDamagePlanes( |
| 68 const std::vector<linked_ptr<OverlayPlane>>& new_overlay_planes, | 68 const linked_ptr<OverlayPlane>& new_root_plane, |
| 69 const gfx::RectF& dip_damage_rect); | 69 const gfx::RectF& dip_damage_rect); |
| 70 void UpdateOverlayPlanes( | 70 void UpdateOverlayPlanes( |
| 71 const std::vector<linked_ptr<OverlayPlane>>& new_overlay_planes); | 71 const std::vector<linked_ptr<OverlayPlane>>& new_overlay_planes); |
| 72 void UpdateCALayerTree(); | 72 void UpdateCALayerTree(); |
| 73 | 73 |
| 74 // Returns true if the front of |pending_swaps_| has completed, or has timed | 74 // Returns true if the front of |pending_swaps_| has completed, or has timed |
| 75 // out by |now|. | 75 // out by |now|. |
| 76 bool IsFirstPendingSwapReadyToDisplay( | 76 bool IsFirstPendingSwapReadyToDisplay( |
| 77 const base::TimeTicks& now); | 77 const base::TimeTicks& now); |
| 78 // Sets the CALayer contents to the IOSurface for the front of | 78 // Sets the CALayer contents to the IOSurface for the front of |
| (...skipping 22 matching lines...) Expand all Loading... |
| 101 base::scoped_nsobject<CALayer> ca_root_layer_; | 101 base::scoped_nsobject<CALayer> ca_root_layer_; |
| 102 | 102 |
| 103 gfx::Size pixel_size_; | 103 gfx::Size pixel_size_; |
| 104 float scale_factor_; | 104 float scale_factor_; |
| 105 std::vector<ui::LatencyInfo> latency_info_; | 105 std::vector<ui::LatencyInfo> latency_info_; |
| 106 | 106 |
| 107 // The renderer ID that all contexts made current to this surface should be | 107 // The renderer ID that all contexts made current to this surface should be |
| 108 // targeting. | 108 // targeting. |
| 109 GLint gl_renderer_id_; | 109 GLint gl_renderer_id_; |
| 110 | 110 |
| 111 // Overlay planes that have been scheduled, but have not had a subsequent | 111 // Planes that have been scheduled, but have not had a subsequent SwapBuffers |
| 112 // SwapBuffers call made yet. | 112 // call made yet. |
| 113 linked_ptr<OverlayPlane> pending_root_plane_; |
| 113 std::vector<linked_ptr<OverlayPlane>> pending_overlay_planes_; | 114 std::vector<linked_ptr<OverlayPlane>> pending_overlay_planes_; |
| 114 | 115 |
| 115 // A queue of all frames that have been created by SwapBuffersInternal but | 116 // A queue of all frames that have been created by SwapBuffersInternal but |
| 116 // have not yet been displayed. This queue is checked at the beginning of | 117 // have not yet been displayed. This queue is checked at the beginning of |
| 117 // every swap and also by a callback. | 118 // every swap and also by a callback. |
| 118 std::deque<linked_ptr<PendingSwap>> pending_swaps_; | 119 std::deque<linked_ptr<PendingSwap>> pending_swaps_; |
| 119 | 120 |
| 120 // The planes that are currently being displayed on the screen. | 121 // The planes that are currently being displayed on the screen. |
| 121 linked_ptr<OverlayPlane> current_root_plane_; | 122 linked_ptr<OverlayPlane> current_root_plane_; |
| 122 std::list<linked_ptr<OverlayPlane>> current_partial_damage_planes_; | 123 std::list<linked_ptr<OverlayPlane>> current_partial_damage_planes_; |
| 123 std::list<linked_ptr<OverlayPlane>> current_overlay_planes_; | 124 std::list<linked_ptr<OverlayPlane>> current_overlay_planes_; |
| 124 | 125 |
| 125 // The time of the last swap was issued. If this is more than two vsyncs, then | 126 // The time of the last swap was issued. If this is more than two vsyncs, then |
| 126 // use the simpler non-smooth animation path. | 127 // use the simpler non-smooth animation path. |
| 127 base::TimeTicks last_swap_time_; | 128 base::TimeTicks last_swap_time_; |
| 128 | 129 |
| 129 // The vsync information provided by the browser. | 130 // The vsync information provided by the browser. |
| 130 bool vsync_parameters_valid_; | 131 bool vsync_parameters_valid_; |
| 131 base::TimeTicks vsync_timebase_; | 132 base::TimeTicks vsync_timebase_; |
| 132 base::TimeDelta vsync_interval_; | 133 base::TimeDelta vsync_interval_; |
| 133 | 134 |
| 134 base::Timer display_pending_swap_timer_; | 135 base::Timer display_pending_swap_timer_; |
| 135 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; | 136 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; |
| 136 }; | 137 }; |
| 137 | 138 |
| 138 } // namespace content | 139 } // namespace content |
| 139 | 140 |
| 140 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 141 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| OLD | NEW |