| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 namespace gl { | 29 namespace gl { |
| 30 class GLFence; | 30 class GLFence; |
| 31 } | 31 } |
| 32 | 32 |
| 33 namespace gpu { | 33 namespace gpu { |
| 34 | 34 |
| 35 class ImageTransportSurfaceOverlayMac : public gl::GLSurface, | 35 class ImageTransportSurfaceOverlayMac : public gl::GLSurface, |
| 36 public ui::GpuSwitchingObserver { | 36 public ui::GpuSwitchingObserver { |
| 37 public: | 37 public: |
| 38 explicit ImageTransportSurfaceOverlayMac(GpuCommandBufferStub* stub); | 38 explicit ImageTransportSurfaceOverlayMac( |
| 39 base::WeakPtr<ImageTransportSurfaceDelegate> delegate); |
| 39 | 40 |
| 40 // GLSurface implementation | 41 // GLSurface implementation |
| 41 bool Initialize(gl::GLSurface::Format format) override; | 42 bool Initialize(gl::GLSurface::Format format) override; |
| 42 void Destroy() override; | 43 void Destroy() override; |
| 43 bool Resize(const gfx::Size& size, | 44 bool Resize(const gfx::Size& size, |
| 44 float scale_factor, | 45 float scale_factor, |
| 45 bool has_alpha) override; | 46 bool has_alpha) override; |
| 46 bool IsOffscreen() override; | 47 bool IsOffscreen() override; |
| 47 gfx::SwapResult SwapBuffers() override; | 48 gfx::SwapResult SwapBuffers() override; |
| 48 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; | 49 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 70 void SendAcceleratedSurfaceBuffersSwapped( | 71 void SendAcceleratedSurfaceBuffersSwapped( |
| 71 CAContextID ca_context_id, | 72 CAContextID ca_context_id, |
| 72 bool fullscreen_low_power_ca_context_valid, | 73 bool fullscreen_low_power_ca_context_valid, |
| 73 CAContextID fullscreen_low_power_ca_context_id, | 74 CAContextID fullscreen_low_power_ca_context_id, |
| 74 const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, | 75 const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, |
| 75 const gfx::Size& size, | 76 const gfx::Size& size, |
| 76 float scale_factor, | 77 float scale_factor, |
| 77 std::vector<ui::LatencyInfo> latency_info); | 78 std::vector<ui::LatencyInfo> latency_info); |
| 78 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); | 79 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); |
| 79 | 80 |
| 80 base::WeakPtr<GpuCommandBufferStub> stub_; | 81 base::WeakPtr<ImageTransportSurfaceDelegate> delegate_; |
| 81 std::vector<ui::LatencyInfo> latency_info_; | 82 std::vector<ui::LatencyInfo> latency_info_; |
| 82 | 83 |
| 83 bool use_remote_layer_api_; | 84 bool use_remote_layer_api_; |
| 84 base::scoped_nsobject<CAContext> ca_context_; | 85 base::scoped_nsobject<CAContext> ca_context_; |
| 85 base::scoped_nsobject<CAContext> fullscreen_low_power_ca_context_; | 86 base::scoped_nsobject<CAContext> fullscreen_low_power_ca_context_; |
| 86 std::unique_ptr<ui::CALayerTreeCoordinator> ca_layer_tree_coordinator_; | 87 std::unique_ptr<ui::CALayerTreeCoordinator> ca_layer_tree_coordinator_; |
| 87 | 88 |
| 88 gfx::Size pixel_size_; | 89 gfx::Size pixel_size_; |
| 89 float scale_factor_; | 90 float scale_factor_; |
| 90 | 91 |
| 91 std::vector<CALayerInUseQuery> ca_layer_in_use_queries_; | 92 std::vector<CALayerInUseQuery> ca_layer_in_use_queries_; |
| 92 | 93 |
| 93 // A GLFence marking the end of the previous frame. Must only be accessed | 94 // A GLFence marking the end of the previous frame. Must only be accessed |
| 94 // while in a ScopedSetGLToRealGLApi, and while the associated | 95 // while in a ScopedSetGLToRealGLApi, and while the associated |
| 95 // |previous_frame_context_| is bound. | 96 // |previous_frame_context_| is bound. |
| 96 std::unique_ptr<gl::GLFence> previous_frame_fence_; | 97 std::unique_ptr<gl::GLFence> previous_frame_fence_; |
| 97 base::ScopedTypeRef<CGLContextObj> fence_context_obj_; | 98 base::ScopedTypeRef<CGLContextObj> fence_context_obj_; |
| 98 | 99 |
| 99 // The renderer ID that all contexts made current to this surface should be | 100 // The renderer ID that all contexts made current to this surface should be |
| 100 // targeting. | 101 // targeting. |
| 101 GLint gl_renderer_id_; | 102 GLint gl_renderer_id_; |
| 102 }; | 103 }; |
| 103 | 104 |
| 104 } // namespace gpu | 105 } // namespace gpu |
| 105 | 106 |
| 106 #endif // GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 107 #endif // GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| OLD | NEW |