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 GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
6 #define CONTENT_COMMON_GPU_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 <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 "gpu/ipc/service/gpu_command_buffer_stub.h" |
14 #include "content/common/gpu/image_transport_surface.h" | 14 #include "gpu/ipc/service/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 gpu { |
24 | 24 |
25 class CALayerTree; | 25 class CALayerTree; |
26 class CALayerPartialDamageTree; | 26 class CALayerPartialDamageTree; |
27 | 27 |
28 class ImageTransportSurfaceOverlayMac : public gfx::GLSurface, | 28 class ImageTransportSurfaceOverlayMac : public gfx::GLSurface, |
29 public ui::GpuSwitchingObserver { | 29 public ui::GpuSwitchingObserver { |
30 public: | 30 public: |
31 ImageTransportSurfaceOverlayMac(GpuChannelManager* manager, | 31 ImageTransportSurfaceOverlayMac(GpuChannelManager* manager, |
32 GpuCommandBufferStub* stub, | 32 GpuCommandBufferStub* stub, |
33 gpu::SurfaceHandle handle); | 33 SurfaceHandle handle); |
34 | 34 |
35 // GLSurface implementation | 35 // GLSurface implementation |
36 bool Initialize(gfx::GLSurface::Format format) override; | 36 bool Initialize(gfx::GLSurface::Format format) override; |
37 void Destroy() override; | 37 void Destroy() override; |
38 bool Resize(const gfx::Size& size, | 38 bool Resize(const gfx::Size& size, |
39 float scale_factor, | 39 float scale_factor, |
40 bool has_alpha) override; | 40 bool has_alpha) override; |
41 bool IsOffscreen() override; | 41 bool IsOffscreen() override; |
42 gfx::SwapResult SwapBuffers() override; | 42 gfx::SwapResult SwapBuffers() override; |
43 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; | 43 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 void PostCheckPendingSwapsCallbackIfNeeded(const base::TimeTicks& now); | 105 void PostCheckPendingSwapsCallbackIfNeeded(const base::TimeTicks& now); |
106 | 106 |
107 // Return the time of |interval_fraction| of the way through the next | 107 // Return the time of |interval_fraction| of the way through the next |
108 // vsync period that starts after |from|. If the vsync parameters are not | 108 // vsync period that starts after |from|. If the vsync parameters are not |
109 // valid then return |from|. | 109 // valid then return |from|. |
110 base::TimeTicks GetNextVSyncTimeAfter( | 110 base::TimeTicks GetNextVSyncTimeAfter( |
111 const base::TimeTicks& from, double interval_fraction); | 111 const base::TimeTicks& from, double interval_fraction); |
112 | 112 |
113 GpuChannelManager* manager_; | 113 GpuChannelManager* manager_; |
114 base::WeakPtr<GpuCommandBufferStub> stub_; | 114 base::WeakPtr<GpuCommandBufferStub> stub_; |
115 gpu::SurfaceHandle handle_; | 115 SurfaceHandle handle_; |
116 std::vector<ui::LatencyInfo> latency_info_; | 116 std::vector<ui::LatencyInfo> latency_info_; |
117 | 117 |
118 bool use_remote_layer_api_; | 118 bool use_remote_layer_api_; |
119 base::scoped_nsobject<CAContext> ca_context_; | 119 base::scoped_nsobject<CAContext> ca_context_; |
120 base::scoped_nsobject<CALayer> ca_root_layer_; | 120 base::scoped_nsobject<CALayer> ca_root_layer_; |
121 | 121 |
122 gfx::Size pixel_size_; | 122 gfx::Size pixel_size_; |
123 float scale_factor_; | 123 float scale_factor_; |
124 | 124 |
125 // The renderer ID that all contexts made current to this surface should be | 125 // The renderer ID that all contexts made current to this surface should be |
(...skipping 20 matching lines...) Expand all Loading... |
146 | 146 |
147 // The vsync information provided by the browser. | 147 // The vsync information provided by the browser. |
148 bool vsync_parameters_valid_; | 148 bool vsync_parameters_valid_; |
149 base::TimeTicks vsync_timebase_; | 149 base::TimeTicks vsync_timebase_; |
150 base::TimeDelta vsync_interval_; | 150 base::TimeDelta vsync_interval_; |
151 | 151 |
152 base::Timer display_pending_swap_timer_; | 152 base::Timer display_pending_swap_timer_; |
153 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; | 153 base::WeakPtrFactory<ImageTransportSurfaceOverlayMac> weak_factory_; |
154 }; | 154 }; |
155 | 155 |
156 } // namespace content | 156 } // namespace gpu |
157 | 157 |
158 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ | 158 #endif // GPU_IPC_SERVICE_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
OLD | NEW |