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 <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // another SwapBuffers happens before this callback, the pending swap will | 72 // another SwapBuffers happens before this callback, the pending swap will |
73 // be tested at that time, too. | 73 // be tested at that time, too. |
74 void CheckPendingSwapsCallback(); | 74 void CheckPendingSwapsCallback(); |
75 // Function to post the above callback. The argument |now| is passed as an | 75 // Function to post the above callback. The argument |now| is passed as an |
76 // argument to avoid redundant calls to base::TimeTicks::Now. | 76 // argument to avoid redundant calls to base::TimeTicks::Now. |
77 void PostCheckPendingSwapsCallbackIfNeeded(const base::TimeTicks& now); | 77 void PostCheckPendingSwapsCallbackIfNeeded(const base::TimeTicks& now); |
78 | 78 |
79 scoped_ptr<ImageTransportHelper> helper_; | 79 scoped_ptr<ImageTransportHelper> helper_; |
80 base::scoped_nsobject<CAContext> ca_context_; | 80 base::scoped_nsobject<CAContext> ca_context_; |
81 base::scoped_nsobject<CALayer> layer_; | 81 base::scoped_nsobject<CALayer> layer_; |
| 82 base::scoped_nsobject<CALayer> partial_damage_layer_; |
82 | 83 |
83 gfx::Size pixel_size_; | 84 gfx::Size pixel_size_; |
84 float scale_factor_; | 85 float scale_factor_; |
85 std::vector<ui::LatencyInfo> latency_info_; | 86 std::vector<ui::LatencyInfo> latency_info_; |
86 | 87 |
87 // Weak pointer to the image provided when ScheduleOverlayPlane is called. Is | 88 // Weak pointer to the image provided when ScheduleOverlayPlane is called. Is |
88 // consumed and reset when SwapBuffers is called. For now, only one overlay | 89 // consumed and reset when SwapBuffers is called. For now, only one overlay |
89 // plane is supported. | 90 // plane is supported. |
90 gfx::GLImage* pending_overlay_image_; | 91 gfx::GLImage* pending_overlay_image_; |
91 | 92 |
92 // A queue of all frames that have been created by SwapBuffersInternal but | 93 // A queue of all frames that have been created by SwapBuffersInternal but |
93 // have not yet been displayed. This queue is checked at the beginning of | 94 // have not yet been displayed. This queue is checked at the beginning of |
94 // every swap and also by a callback. | 95 // every swap and also by a callback. |
95 std::deque<linked_ptr<PendingSwap>> pending_swaps_; | 96 std::deque<linked_ptr<PendingSwap>> pending_swaps_; |
96 | 97 |
| 98 // The union of the damage rects of SwapBuffersInternal since the last |
| 99 // non-partial swap. |
| 100 gfx::Rect accumulated_partial_damage_pixel_rect_; |
| 101 |
97 // The display link used to compute the time for callbacks. | 102 // The display link used to compute the time for callbacks. |
98 scoped_refptr<ui::DisplayLinkMac> display_link_mac_; | 103 scoped_refptr<ui::DisplayLinkMac> display_link_mac_; |
99 | 104 |
100 // True if there is a pending call to CheckPendingSwapsCallback posted. | 105 // True if there is a pending call to CheckPendingSwapsCallback posted. |
101 bool has_pending_callback_; | 106 bool has_pending_callback_; |
102 | 107 |
103 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; | 108 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; |
104 }; | 109 }; |
105 | 110 |
106 } // namespace content | 111 } // namespace content |
107 | 112 |
108 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 113 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
OLD | NEW |