| 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 |
| 11 #import "base/mac/scoped_nsobject.h" | 11 #import "base/mac/scoped_nsobject.h" |
| 12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
| 13 #include "content/common/gpu/gpu_command_buffer_stub.h" | 13 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 14 #include "content/common/gpu/image_transport_surface.h" | 14 #include "content/common/gpu/image_transport_surface.h" |
| 15 #include "ui/base/cocoa/remote_layer_api.h" |
| 15 #include "ui/events/latency_info.h" | 16 #include "ui/events/latency_info.h" |
| 16 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
| 17 #include "ui/gl/gpu_switching_observer.h" | 18 #include "ui/gl/gpu_switching_observer.h" |
| 18 | 19 |
| 19 @class CAContext; | 20 @class CAContext; |
| 20 @class CALayer; | 21 @class CALayer; |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 | 24 |
| 24 class CALayerTree; | 25 class CALayerTree; |
| 25 class CALayerPartialDamageTree; | 26 class CALayerPartialDamageTree; |
| 26 struct AcceleratedSurfaceBuffersSwappedParams; | |
| 27 struct BufferPresentedParams; | 27 struct BufferPresentedParams; |
| 28 | 28 |
| 29 class ImageTransportSurfaceOverlayMac : public gfx::GLSurface, | 29 class ImageTransportSurfaceOverlayMac : public gfx::GLSurface, |
| 30 public ui::GpuSwitchingObserver { | 30 public ui::GpuSwitchingObserver { |
| 31 public: | 31 public: |
| 32 ImageTransportSurfaceOverlayMac(GpuChannelManager* manager, | 32 ImageTransportSurfaceOverlayMac(GpuChannelManager* manager, |
| 33 GpuCommandBufferStub* stub, | 33 GpuCommandBufferStub* stub, |
| 34 gpu::SurfaceHandle handle); | 34 gpu::SurfaceHandle handle); |
| 35 | 35 |
| 36 // GLSurface implementation | 36 // GLSurface implementation |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 class PendingSwap; | 71 class PendingSwap; |
| 72 class OverlayPlane; | 72 class OverlayPlane; |
| 73 | 73 |
| 74 ~ImageTransportSurfaceOverlayMac() override; | 74 ~ImageTransportSurfaceOverlayMac() override; |
| 75 | 75 |
| 76 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | 76 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
| 77 void BufferPresented(const BufferPresentedParams& params); | 77 void BufferPresented(const BufferPresentedParams& params); |
| 78 void SendAcceleratedSurfaceBuffersSwapped( | 78 void SendAcceleratedSurfaceBuffersSwapped( |
| 79 AcceleratedSurfaceBuffersSwappedParams params); | 79 int32_t surface_id, |
| 80 CAContextID ca_context_id, |
| 81 const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, |
| 82 const gfx::Size& size, |
| 83 float scale_factor, |
| 84 std::vector<ui::LatencyInfo> latency_info); |
| 80 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); | 85 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); |
| 81 | 86 |
| 82 // Returns true if the front of |pending_swaps_| has completed, or has timed | 87 // Returns true if the front of |pending_swaps_| has completed, or has timed |
| 83 // out by |now|. | 88 // out by |now|. |
| 84 bool IsFirstPendingSwapReadyToDisplay( | 89 bool IsFirstPendingSwapReadyToDisplay( |
| 85 const base::TimeTicks& now); | 90 const base::TimeTicks& now); |
| 86 // Sets the CALayer contents to the IOSurface for the front of | 91 // Sets the CALayer contents to the IOSurface for the front of |
| 87 // |pending_swaps_|, and removes it from the queue. | 92 // |pending_swaps_|, and removes it from the queue. |
| 88 void DisplayFirstPendingSwapImmediately(); | 93 void DisplayFirstPendingSwapImmediately(); |
| 89 // Force that all of |pending_swaps_| displayed immediately, and the list be | 94 // Force that all of |pending_swaps_| displayed immediately, and the list be |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 base::TimeTicks vsync_timebase_; | 148 base::TimeTicks vsync_timebase_; |
| 144 base::TimeDelta vsync_interval_; | 149 base::TimeDelta vsync_interval_; |
| 145 | 150 |
| 146 base::Timer display_pending_swap_timer_; | 151 base::Timer display_pending_swap_timer_; |
| 147 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; | 152 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; |
| 148 }; | 153 }; |
| 149 | 154 |
| 150 } // namespace content | 155 } // namespace content |
| 151 | 156 |
| 152 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 157 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| OLD | NEW |