Chromium Code Reviews| Index: content/common/gpu/image_transport_surface_overlay_mac.h |
| diff --git a/content/common/gpu/image_transport_surface_overlay_mac.h b/content/common/gpu/image_transport_surface_overlay_mac.h |
| index 66c0591f1ee365618d667be13d0aaefe99e5d24a..32b93c941ecea6b869824dedc8856dbfa3a31259 100644 |
| --- a/content/common/gpu/image_transport_surface_overlay_mac.h |
| +++ b/content/common/gpu/image_transport_surface_overlay_mac.h |
| @@ -5,9 +5,12 @@ |
| #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| +#include <list> |
| + |
| #import "base/mac/scoped_nsobject.h" |
| #include "content/common/gpu/gpu_command_buffer_stub.h" |
| #include "content/common/gpu/image_transport_surface.h" |
| +#include "ui/accelerated_widget_mac/display_link_mac.h" |
| #include "ui/gl/gl_surface.h" |
| @class CAContext; |
| @@ -47,14 +50,29 @@ class ImageTransportSurfaceOverlayMac : public gfx::GLSurface, |
| void WakeUpGpu() override; |
| private: |
| + class PendingSwap; |
| + |
| ~ImageTransportSurfaceOverlayMac() override; |
| + |
| + gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); |
| + |
| + // Check the oldest swap in |pending_swaps_|, and, if its fence has passed, |
| + // send the content to the window server by -[CALayer setContents:]. If |
| + // |force_immediate_display| is true then skip the fence check and immediately |
| + // call -[CALayer setContents:]. |
| + void CheckAndDisplayPendingSwaps(bool force_immediate_display); |
| + |
| + // Post a call to CheckAndDisplayPendingSwaps at the next midpoint of a |
| + // vsync period. |
| + void PostCheckAndDisplayPendingSwaps(); |
| + |
| + // Force all pending swaps to display immediately. |
| + void FinishAllPendingSwaps(); |
| + |
| scoped_ptr<ImageTransportHelper> helper_; |
| base::scoped_nsobject<CAContext> ca_context_; |
| base::scoped_nsobject<CALayer> layer_; |
| - // A phony NSView handle used to identify this. |
| - gfx::AcceleratedWidget widget_; |
| - |
| gfx::Size pixel_size_; |
| float scale_factor_; |
| std::vector<ui::LatencyInfo> latency_info_; |
| @@ -63,6 +81,16 @@ class ImageTransportSurfaceOverlayMac : public gfx::GLSurface, |
| // consumed and reset when SwapBuffers is called. For now, only one overlay |
| // plane is supported. |
| gfx::GLImage* pending_overlay_image_; |
| + |
| + // A queue of all frames that have been created by SwapBuffersInternal but |
| + // have not yet been displayed by CheckAndDisplayPendingSwaps. |
| + std::list<scoped_refptr<PendingSwap>> pending_swaps_; |
|
dcheng
2015/08/07 00:28:37
How about using linked_ptr instead of refcounting?
ccameron
2015/08/07 22:14:16
Done.
|
| + |
| + // The display link used to compute the delay for the posted task in |
| + // PostCheckAndDisplayPendingSwaps. |
| + scoped_refptr<ui::DisplayLinkMac> display_link_mac_; |
| + |
| + base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; |
| }; |
| } // namespace content |