Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: content/common/gpu/image_transport_surface_overlay_mac.h

Issue 1640093002: Mac overlays: Isolate partial swap support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename to partial damage Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/common/gpu/image_transport_surface_overlay_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/memory/linked_ptr.h" 11 #include "base/memory/linked_ptr.h"
12 #import "base/mac/scoped_nsobject.h" 12 #import "base/mac/scoped_nsobject.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "content/common/gpu/gpu_command_buffer_stub.h" 14 #include "content/common/gpu/gpu_command_buffer_stub.h"
15 #include "content/common/gpu/image_transport_surface.h" 15 #include "content/common/gpu/image_transport_surface.h"
16 #include "ui/gl/gl_surface.h" 16 #include "ui/gl/gl_surface.h"
17 #include "ui/gl/gpu_switching_observer.h" 17 #include "ui/gl/gpu_switching_observer.h"
18 18
19 @class CAContext; 19 @class CAContext;
20 @class CALayer; 20 @class CALayer;
21 21
22 namespace content { 22 namespace content {
23 23
24 class CALayerTree; 24 class CALayerTree;
25 class CALayerPartialDamageTree;
25 26
26 class ImageTransportSurfaceOverlayMac : public gfx::GLSurface, 27 class ImageTransportSurfaceOverlayMac : public gfx::GLSurface,
27 public ImageTransportSurface, 28 public ImageTransportSurface,
28 public ui::GpuSwitchingObserver { 29 public ui::GpuSwitchingObserver {
29 public: 30 public:
30 ImageTransportSurfaceOverlayMac(GpuChannelManager* manager, 31 ImageTransportSurfaceOverlayMac(GpuChannelManager* manager,
31 GpuCommandBufferStub* stub, 32 GpuCommandBufferStub* stub,
32 gfx::PluginWindowHandle handle); 33 gfx::PluginWindowHandle handle);
33 34
34 // GLSurface implementation 35 // GLSurface implementation
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 void OnGpuSwitched() override; 72 void OnGpuSwitched() override;
72 73
73 private: 74 private:
74 class PendingSwap; 75 class PendingSwap;
75 class OverlayPlane; 76 class OverlayPlane;
76 77
77 ~ImageTransportSurfaceOverlayMac() override; 78 ~ImageTransportSurfaceOverlayMac() override;
78 79
79 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); 80 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect);
80 81
81 void UpdateRootAndPartialDamagePlanes(
82 const linked_ptr<OverlayPlane>& new_root_plane,
83 const gfx::RectF& pixel_damage_rect);
84 void UpdateRootAndPartialDamageCALayers(float scale_factor);
85 void UpdateCALayerTree(scoped_ptr<CALayerTree> ca_layer_tree,
86 float scale_factor);
87
88 // Returns true if the front of |pending_swaps_| has completed, or has timed 82 // Returns true if the front of |pending_swaps_| has completed, or has timed
89 // out by |now|. 83 // out by |now|.
90 bool IsFirstPendingSwapReadyToDisplay( 84 bool IsFirstPendingSwapReadyToDisplay(
91 const base::TimeTicks& now); 85 const base::TimeTicks& now);
92 // Sets the CALayer contents to the IOSurface for the front of 86 // Sets the CALayer contents to the IOSurface for the front of
93 // |pending_swaps_|, and removes it from the queue. 87 // |pending_swaps_|, and removes it from the queue.
94 void DisplayFirstPendingSwapImmediately(); 88 void DisplayFirstPendingSwapImmediately();
95 // Force that all of |pending_swaps_| displayed immediately, and the list be 89 // Force that all of |pending_swaps_| displayed immediately, and the list be
96 // cleared. 90 // cleared.
97 void DisplayAndClearAllPendingSwaps(); 91 void DisplayAndClearAllPendingSwaps();
(...skipping 20 matching lines...) Expand all
118 gfx::Size pixel_size_; 112 gfx::Size pixel_size_;
119 float scale_factor_; 113 float scale_factor_;
120 std::vector<ui::LatencyInfo> latency_info_; 114 std::vector<ui::LatencyInfo> latency_info_;
121 115
122 // The renderer ID that all contexts made current to this surface should be 116 // The renderer ID that all contexts made current to this surface should be
123 // targeting. 117 // targeting.
124 GLint gl_renderer_id_; 118 GLint gl_renderer_id_;
125 119
126 // Planes that have been scheduled, but have not had a subsequent SwapBuffers 120 // Planes that have been scheduled, but have not had a subsequent SwapBuffers
127 // call made yet. 121 // call made yet.
128 linked_ptr<OverlayPlane> pending_root_plane_; 122 scoped_ptr<CALayerPartialDamageTree> pending_partial_damage_tree_;
129 scoped_ptr<CALayerTree> pending_ca_layer_tree_; 123 scoped_ptr<CALayerTree> pending_ca_layer_tree_;
130 124
131 // A queue of all frames that have been created by SwapBuffersInternal but 125 // A queue of all frames that have been created by SwapBuffersInternal but
132 // have not yet been displayed. This queue is checked at the beginning of 126 // have not yet been displayed. This queue is checked at the beginning of
133 // every swap and also by a callback. 127 // every swap and also by a callback.
134 std::deque<linked_ptr<PendingSwap>> pending_swaps_; 128 std::deque<linked_ptr<PendingSwap>> pending_swaps_;
135 129
136 // The planes that are currently being displayed on the screen. 130 // The planes that are currently being displayed on the screen.
137 linked_ptr<OverlayPlane> current_root_plane_; 131 scoped_ptr<CALayerPartialDamageTree> current_partial_damage_tree_;
138 std::list<linked_ptr<OverlayPlane>> current_partial_damage_planes_;
139 scoped_ptr<CALayerTree> current_ca_layer_tree_; 132 scoped_ptr<CALayerTree> current_ca_layer_tree_;
140 133
141 // The time of the last swap was issued. If this is more than two vsyncs, then 134 // The time of the last swap was issued. If this is more than two vsyncs, then
142 // use the simpler non-smooth animation path. 135 // use the simpler non-smooth animation path.
143 base::TimeTicks last_swap_time_; 136 base::TimeTicks last_swap_time_;
144 137
145 // The vsync information provided by the browser. 138 // The vsync information provided by the browser.
146 bool vsync_parameters_valid_; 139 bool vsync_parameters_valid_;
147 base::TimeTicks vsync_timebase_; 140 base::TimeTicks vsync_timebase_;
148 base::TimeDelta vsync_interval_; 141 base::TimeDelta vsync_interval_;
149 142
150 // Calls to ScheduleCALayer come in back-to-front. This is reset to 1 at each
151 // swap and increments with each call to ScheduleCALayer.
152 int next_ca_layer_z_order_;
153
154 base::Timer display_pending_swap_timer_; 143 base::Timer display_pending_swap_timer_;
155 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; 144 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_;
156 }; 145 };
157 146
158 } // namespace content 147 } // namespace content
159 148
160 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ 149 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/image_transport_surface_overlay_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698