| 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/base/cocoa/remote_layer_api.h" |
| 16 #include "ui/events/latency_info.h" | 16 #include "ui/events/latency_info.h" |
| 17 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
| 18 #include "ui/gl/gpu_switching_observer.h" | 18 #include "ui/gl/gpu_switching_observer.h" |
| 19 | 19 |
| 20 @class CAContext; | 20 @class CAContext; |
| 21 @class CALayer; | 21 @class CALayer; |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| 25 class CALayerTree; | 25 class CALayerTree; |
| 26 class CALayerPartialDamageTree; | 26 class CALayerPartialDamageTree; |
| 27 struct BufferPresentedParams; | |
| 28 | 27 |
| 29 class ImageTransportSurfaceOverlayMac : public gfx::GLSurface, | 28 class ImageTransportSurfaceOverlayMac : public gfx::GLSurface, |
| 30 public ui::GpuSwitchingObserver { | 29 public ui::GpuSwitchingObserver { |
| 31 public: | 30 public: |
| 32 ImageTransportSurfaceOverlayMac(GpuChannelManager* manager, | 31 ImageTransportSurfaceOverlayMac(GpuChannelManager* manager, |
| 33 GpuCommandBufferStub* stub, | 32 GpuCommandBufferStub* stub, |
| 34 gpu::SurfaceHandle handle); | 33 gpu::SurfaceHandle handle); |
| 35 | 34 |
| 36 // GLSurface implementation | 35 // GLSurface implementation |
| 37 bool Initialize(gfx::GLSurface::Format format) override; | 36 bool Initialize(gfx::GLSurface::Format format) override; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 67 // ui::GpuSwitchingObserver implementation. | 66 // ui::GpuSwitchingObserver implementation. |
| 68 void OnGpuSwitched() override; | 67 void OnGpuSwitched() override; |
| 69 | 68 |
| 70 private: | 69 private: |
| 71 class PendingSwap; | 70 class PendingSwap; |
| 72 class OverlayPlane; | 71 class OverlayPlane; |
| 73 | 72 |
| 74 ~ImageTransportSurfaceOverlayMac() override; | 73 ~ImageTransportSurfaceOverlayMac() override; |
| 75 | 74 |
| 76 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | 75 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
| 77 void BufferPresented(const BufferPresentedParams& params); | 76 void BufferPresented(int32_t surface_id, |
| 77 const base::TimeTicks& vsync_timebase, |
| 78 const base::TimeDelta& vsync_interval); |
| 78 void SendAcceleratedSurfaceBuffersSwapped( | 79 void SendAcceleratedSurfaceBuffersSwapped( |
| 79 int32_t surface_id, | 80 int32_t surface_id, |
| 80 CAContextID ca_context_id, | 81 CAContextID ca_context_id, |
| 81 const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, | 82 const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, |
| 82 const gfx::Size& size, | 83 const gfx::Size& size, |
| 83 float scale_factor, | 84 float scale_factor, |
| 84 std::vector<ui::LatencyInfo> latency_info); | 85 std::vector<ui::LatencyInfo> latency_info); |
| 85 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); | 86 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); |
| 86 | 87 |
| 87 // Returns true if the front of |pending_swaps_| has completed, or has timed | 88 // Returns true if the front of |pending_swaps_| has completed, or has timed |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 base::TimeTicks vsync_timebase_; | 149 base::TimeTicks vsync_timebase_; |
| 149 base::TimeDelta vsync_interval_; | 150 base::TimeDelta vsync_interval_; |
| 150 | 151 |
| 151 base::Timer display_pending_swap_timer_; | 152 base::Timer display_pending_swap_timer_; |
| 152 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; | 153 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; |
| 153 }; | 154 }; |
| 154 | 155 |
| 155 } // namespace content | 156 } // namespace content |
| 156 | 157 |
| 157 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 158 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| OLD | NEW |