| 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 GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 5 #ifndef GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| 6 #define GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 6 #define GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 namespace ui { | 24 namespace ui { |
| 25 class CALayerTreeCoordinator; | 25 class CALayerTreeCoordinator; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace gpu { | 28 namespace gpu { |
| 29 | 29 |
| 30 class ImageTransportSurfaceOverlayMac : public gfx::GLSurface, | 30 class ImageTransportSurfaceOverlayMac : public gfx::GLSurface, |
| 31 public ui::GpuSwitchingObserver { | 31 public ui::GpuSwitchingObserver { |
| 32 public: | 32 public: |
| 33 ImageTransportSurfaceOverlayMac(GpuChannelManager* manager, | 33 ImageTransportSurfaceOverlayMac(GpuCommandBufferStub* stub, |
| 34 GpuCommandBufferStub* stub, | |
| 35 SurfaceHandle handle); | 34 SurfaceHandle handle); |
| 36 | 35 |
| 37 // GLSurface implementation | 36 // GLSurface implementation |
| 38 bool Initialize(gfx::GLSurface::Format format) override; | 37 bool Initialize(gfx::GLSurface::Format format) override; |
| 39 void Destroy() override; | 38 void Destroy() override; |
| 40 bool Resize(const gfx::Size& size, | 39 bool Resize(const gfx::Size& size, |
| 41 float scale_factor, | 40 float scale_factor, |
| 42 bool has_alpha) override; | 41 bool has_alpha) override; |
| 43 bool IsOffscreen() override; | 42 bool IsOffscreen() override; |
| 44 gfx::SwapResult SwapBuffers() override; | 43 gfx::SwapResult SwapBuffers() override; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 65 unsigned filter) override; | 64 unsigned filter) override; |
| 66 bool IsSurfaceless() const override; | 65 bool IsSurfaceless() const override; |
| 67 | 66 |
| 68 // ui::GpuSwitchingObserver implementation. | 67 // ui::GpuSwitchingObserver implementation. |
| 69 void OnGpuSwitched() override; | 68 void OnGpuSwitched() override; |
| 70 | 69 |
| 71 private: | 70 private: |
| 72 ~ImageTransportSurfaceOverlayMac() override; | 71 ~ImageTransportSurfaceOverlayMac() override; |
| 73 | 72 |
| 74 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | 73 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
| 75 void BufferPresented(gpu::SurfaceHandle surface_handle, | |
| 76 const base::TimeTicks& vsync_timebase, | |
| 77 const base::TimeDelta& vsync_interval); | |
| 78 void SendAcceleratedSurfaceBuffersSwapped( | 74 void SendAcceleratedSurfaceBuffersSwapped( |
| 79 gpu::SurfaceHandle surface_handle, | 75 gpu::SurfaceHandle surface_handle, |
| 80 CAContextID ca_context_id, | 76 CAContextID ca_context_id, |
| 81 bool fullscreen_low_power_ca_context_valid, | 77 bool fullscreen_low_power_ca_context_valid, |
| 82 CAContextID fullscreen_low_power_ca_context_id, | 78 CAContextID fullscreen_low_power_ca_context_id, |
| 83 const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, | 79 const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, |
| 84 const gfx::Size& size, | 80 const gfx::Size& size, |
| 85 float scale_factor, | 81 float scale_factor, |
| 86 std::vector<ui::LatencyInfo> latency_info); | 82 std::vector<ui::LatencyInfo> latency_info); |
| 87 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); | 83 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); |
| 88 | 84 |
| 89 GpuChannelManager* manager_; | |
| 90 base::WeakPtr<GpuCommandBufferStub> stub_; | 85 base::WeakPtr<GpuCommandBufferStub> stub_; |
| 91 SurfaceHandle handle_; | 86 SurfaceHandle handle_; |
| 92 std::vector<ui::LatencyInfo> latency_info_; | 87 std::vector<ui::LatencyInfo> latency_info_; |
| 93 | 88 |
| 94 bool use_remote_layer_api_; | 89 bool use_remote_layer_api_; |
| 95 base::scoped_nsobject<CAContext> ca_context_; | 90 base::scoped_nsobject<CAContext> ca_context_; |
| 96 base::scoped_nsobject<CAContext> fullscreen_low_power_ca_context_; | 91 base::scoped_nsobject<CAContext> fullscreen_low_power_ca_context_; |
| 97 std::unique_ptr<ui::CALayerTreeCoordinator> ca_layer_tree_coordinator_; | 92 std::unique_ptr<ui::CALayerTreeCoordinator> ca_layer_tree_coordinator_; |
| 98 | 93 |
| 99 gfx::Size pixel_size_; | 94 gfx::Size pixel_size_; |
| 100 float scale_factor_; | 95 float scale_factor_; |
| 101 | 96 |
| 102 // The renderer ID that all contexts made current to this surface should be | 97 // The renderer ID that all contexts made current to this surface should be |
| 103 // targeting. | 98 // targeting. |
| 104 GLint gl_renderer_id_; | 99 GLint gl_renderer_id_; |
| 105 | |
| 106 // The vsync information provided by the browser. | |
| 107 bool vsync_parameters_valid_; | |
| 108 base::TimeTicks vsync_timebase_; | |
| 109 base::TimeDelta vsync_interval_; | |
| 110 }; | 100 }; |
| 111 | 101 |
| 112 } // namespace gpu | 102 } // namespace gpu |
| 113 | 103 |
| 114 #endif // GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 104 #endif // GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| OLD | NEW |