Chromium Code Reviews| 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 ImageTransportSurfaceOverlayMac(GpuCommandBufferStub* stub, | 38 ImageTransportSurfaceOverlayMac(GpuCommandBufferStub* stub); |
|
piman
2016/09/23 00:55:24
nit: explicit
| |
| 39 SurfaceHandle handle); | |
| 40 | 39 |
| 41 // GLSurface implementation | 40 // GLSurface implementation |
| 42 bool Initialize(gl::GLSurface::Format format) override; | 41 bool Initialize(gl::GLSurface::Format format) override; |
| 43 void Destroy() override; | 42 void Destroy() override; |
| 44 bool Resize(const gfx::Size& size, | 43 bool Resize(const gfx::Size& size, |
| 45 float scale_factor, | 44 float scale_factor, |
| 46 bool has_alpha) override; | 45 bool has_alpha) override; |
| 47 bool IsOffscreen() override; | 46 bool IsOffscreen() override; |
| 48 gfx::SwapResult SwapBuffers() override; | 47 gfx::SwapResult SwapBuffers() override; |
| 49 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; | 48 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 62 bool IsSurfaceless() const override; | 61 bool IsSurfaceless() const override; |
| 63 | 62 |
| 64 // ui::GpuSwitchingObserver implementation. | 63 // ui::GpuSwitchingObserver implementation. |
| 65 void OnGpuSwitched() override; | 64 void OnGpuSwitched() override; |
| 66 | 65 |
| 67 private: | 66 private: |
| 68 ~ImageTransportSurfaceOverlayMac() override; | 67 ~ImageTransportSurfaceOverlayMac() override; |
| 69 | 68 |
| 70 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | 69 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
| 71 void SendAcceleratedSurfaceBuffersSwapped( | 70 void SendAcceleratedSurfaceBuffersSwapped( |
| 72 gpu::SurfaceHandle surface_handle, | |
| 73 CAContextID ca_context_id, | 71 CAContextID ca_context_id, |
| 74 bool fullscreen_low_power_ca_context_valid, | 72 bool fullscreen_low_power_ca_context_valid, |
| 75 CAContextID fullscreen_low_power_ca_context_id, | 73 CAContextID fullscreen_low_power_ca_context_id, |
| 76 const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, | 74 const gfx::ScopedRefCountedIOSurfaceMachPort& io_surface, |
| 77 const gfx::Size& size, | 75 const gfx::Size& size, |
| 78 float scale_factor, | 76 float scale_factor, |
| 79 std::vector<ui::LatencyInfo> latency_info); | 77 std::vector<ui::LatencyInfo> latency_info); |
| 80 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); | 78 gfx::SwapResult SwapBuffersInternal(const gfx::Rect& pixel_damage_rect); |
| 81 | 79 |
| 82 base::WeakPtr<GpuCommandBufferStub> stub_; | 80 base::WeakPtr<GpuCommandBufferStub> stub_; |
| 83 SurfaceHandle handle_; | |
| 84 std::vector<ui::LatencyInfo> latency_info_; | 81 std::vector<ui::LatencyInfo> latency_info_; |
| 85 | 82 |
| 86 bool use_remote_layer_api_; | 83 bool use_remote_layer_api_; |
| 87 base::scoped_nsobject<CAContext> ca_context_; | 84 base::scoped_nsobject<CAContext> ca_context_; |
| 88 base::scoped_nsobject<CAContext> fullscreen_low_power_ca_context_; | 85 base::scoped_nsobject<CAContext> fullscreen_low_power_ca_context_; |
| 89 std::unique_ptr<ui::CALayerTreeCoordinator> ca_layer_tree_coordinator_; | 86 std::unique_ptr<ui::CALayerTreeCoordinator> ca_layer_tree_coordinator_; |
| 90 | 87 |
| 91 gfx::Size pixel_size_; | 88 gfx::Size pixel_size_; |
| 92 float scale_factor_; | 89 float scale_factor_; |
| 93 | 90 |
| 94 std::vector<CALayerInUseQuery> ca_layer_in_use_queries_; | 91 std::vector<CALayerInUseQuery> ca_layer_in_use_queries_; |
| 95 | 92 |
| 96 // A GLFence marking the end of the previous frame. Must only be accessed | 93 // A GLFence marking the end of the previous frame. Must only be accessed |
| 97 // while in a ScopedSetGLToRealGLApi, and while the associated | 94 // while in a ScopedSetGLToRealGLApi, and while the associated |
| 98 // |previous_frame_context_| is bound. | 95 // |previous_frame_context_| is bound. |
| 99 std::unique_ptr<gl::GLFence> previous_frame_fence_; | 96 std::unique_ptr<gl::GLFence> previous_frame_fence_; |
| 100 base::ScopedTypeRef<CGLContextObj> fence_context_obj_; | 97 base::ScopedTypeRef<CGLContextObj> fence_context_obj_; |
| 101 | 98 |
| 102 // The renderer ID that all contexts made current to this surface should be | 99 // The renderer ID that all contexts made current to this surface should be |
| 103 // targeting. | 100 // targeting. |
| 104 GLint gl_renderer_id_; | 101 GLint gl_renderer_id_; |
| 105 }; | 102 }; |
| 106 | 103 |
| 107 } // namespace gpu | 104 } // namespace gpu |
| 108 | 105 |
| 109 #endif // GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 106 #endif // GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| OLD | NEW |