| 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..022fbb41e7922a9c8e607529348033b12842f3c0 100644
|
| --- a/content/common/gpu/image_transport_surface_overlay_mac.h
|
| +++ b/content/common/gpu/image_transport_surface_overlay_mac.h
|
| @@ -5,9 +5,13 @@
|
| #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_
|
| #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_
|
|
|
| +#include <deque>
|
| +
|
| +#include "base/memory/linked_ptr.h"
|
| #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 +51,35 @@ class ImageTransportSurfaceOverlayMac : public gfx::GLSurface,
|
| void WakeUpGpu() override;
|
|
|
| private:
|
| + class PendingSwap;
|
| +
|
| ~ImageTransportSurfaceOverlayMac() override;
|
| +
|
| + gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect);
|
| +
|
| + // Returns true if the front of |pending_swaps_| has completed, or has timed
|
| + // out by |now|.
|
| + bool IsFirstPendingSwapReadyToDisplay(
|
| + const base::TimeTicks& now);
|
| + // Sets the CALayer contents to the IOSurface for the front of
|
| + // |pending_swaps_|, and removes it from the queue.
|
| + void DisplayFirstPendingSwapImmediately();
|
| + // Force that all of |pending_swaps_| displayed immediately, and the list be
|
| + // cleared.
|
| + void FinishAllPendingSwaps();
|
| + // Callback issued during the next vsync period ofter a SwapBuffers call,
|
| + // to check if the swap is completed, and display the frame. Note that if
|
| + // another SwapBuffers happens before this callback, the pending swap will
|
| + // be tested at that time, too.
|
| + void CheckPendingSwapsCallback();
|
| + // Function to post the above callback. The argument |now| is passed as an
|
| + // argument to avoid redundant calls to base::TimeTicks::Now.
|
| + void PostCheckPendingSwapsCallbackIfNeeded(const base::TimeTicks& now);
|
| +
|
| 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 +88,19 @@ 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. This queue is checked at the beginning of
|
| + // every swap and also by a callback.
|
| + std::deque<linked_ptr<PendingSwap>> pending_swaps_;
|
| +
|
| + // The display link used to compute the time for callbacks.
|
| + scoped_refptr<ui::DisplayLinkMac> display_link_mac_;
|
| +
|
| + // True if there is a pending call to CheckPendingSwapsCallback posted.
|
| + bool has_pending_callback_;
|
| +
|
| + base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_;
|
| };
|
|
|
| } // namespace content
|
|
|