OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // a lot like an onscreen surface to the GPU process. | 50 // a lot like an onscreen surface to the GPU process. |
51 // | 51 // |
52 // The ImageTransportSurfaceHelper provides some glue to the outside world: | 52 // The ImageTransportSurfaceHelper provides some glue to the outside world: |
53 // making sure outside events reach the ImageTransportSurface and | 53 // making sure outside events reach the ImageTransportSurface and |
54 // allowing the ImageTransportSurface to send events to the outside world. | 54 // allowing the ImageTransportSurface to send events to the outside world. |
55 | 55 |
56 class ImageTransportSurface { | 56 class ImageTransportSurface { |
57 public: | 57 public: |
58 ImageTransportSurface(); | 58 ImageTransportSurface(); |
59 | 59 |
| 60 #if defined(OS_MACOSX) |
60 virtual void OnBufferPresented( | 61 virtual void OnBufferPresented( |
61 const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0; | 62 const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0; |
| 63 #endif |
62 virtual void OnResize(gfx::Size size, float scale_factor) = 0; | 64 virtual void OnResize(gfx::Size size, float scale_factor) = 0; |
63 virtual void SetLatencyInfo( | 65 virtual void SetLatencyInfo( |
64 const std::vector<ui::LatencyInfo>& latency_info) = 0; | 66 const std::vector<ui::LatencyInfo>& latency_info) = 0; |
65 virtual void WakeUpGpu() = 0; | 67 virtual void WakeUpGpu() = 0; |
66 | 68 |
67 // Creates a surface with the given attributes. | 69 // Creates a surface with the given attributes. |
68 static scoped_refptr<gfx::GLSurface> CreateSurface( | 70 static scoped_refptr<gfx::GLSurface> CreateSurface( |
69 GpuChannelManager* manager, | 71 GpuChannelManager* manager, |
70 GpuCommandBufferStub* stub, | 72 GpuCommandBufferStub* stub, |
71 const gfx::GLSurfaceHandle& handle); | 73 const gfx::GLSurfaceHandle& handle); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 static void SetSwapInterval(gfx::GLContext* context); | 137 static void SetSwapInterval(gfx::GLContext* context); |
136 | 138 |
137 GpuChannelManager* manager() const { return manager_; } | 139 GpuChannelManager* manager() const { return manager_; } |
138 GpuCommandBufferStub* stub() const { return stub_.get(); } | 140 GpuCommandBufferStub* stub() const { return stub_.get(); } |
139 | 141 |
140 private: | 142 private: |
141 gpu::GpuScheduler* Scheduler(); | 143 gpu::GpuScheduler* Scheduler(); |
142 gpu::gles2::GLES2Decoder* Decoder(); | 144 gpu::gles2::GLES2Decoder* Decoder(); |
143 | 145 |
144 // IPC::Message handlers. | 146 // IPC::Message handlers. |
| 147 #if defined(OS_MACOSX) |
145 void OnBufferPresented( | 148 void OnBufferPresented( |
146 const AcceleratedSurfaceMsg_BufferPresented_Params& params); | 149 const AcceleratedSurfaceMsg_BufferPresented_Params& params); |
| 150 #endif |
147 void OnWakeUpGpu(); | 151 void OnWakeUpGpu(); |
148 | 152 |
149 // Backbuffer resize callback. | 153 // Backbuffer resize callback. |
150 void Resize(gfx::Size size, float scale_factor); | 154 void Resize(gfx::Size size, float scale_factor); |
151 | 155 |
152 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | 156 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
153 | 157 |
154 // Weak pointers that point to objects that outlive this helper. | 158 // Weak pointers that point to objects that outlive this helper. |
155 ImageTransportSurface* surface_; | 159 ImageTransportSurface* surface_; |
156 GpuChannelManager* manager_; | 160 GpuChannelManager* manager_; |
(...skipping 16 matching lines...) Expand all Loading... |
173 gfx::GLSurface* surface); | 177 gfx::GLSurface* surface); |
174 | 178 |
175 // GLSurface implementation. | 179 // GLSurface implementation. |
176 virtual bool Initialize() override; | 180 virtual bool Initialize() override; |
177 virtual void Destroy() override; | 181 virtual void Destroy() override; |
178 virtual bool SwapBuffers() override; | 182 virtual bool SwapBuffers() override; |
179 virtual bool PostSubBuffer(int x, int y, int width, int height) override; | 183 virtual bool PostSubBuffer(int x, int y, int width, int height) override; |
180 virtual bool OnMakeCurrent(gfx::GLContext* context) override; | 184 virtual bool OnMakeCurrent(gfx::GLContext* context) override; |
181 | 185 |
182 // ImageTransportSurface implementation. | 186 // ImageTransportSurface implementation. |
| 187 #if defined(OS_MACOSX) |
183 virtual void OnBufferPresented( | 188 virtual void OnBufferPresented( |
184 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; | 189 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; |
| 190 #endif |
185 virtual void OnResize(gfx::Size size, float scale_factor) override; | 191 virtual void OnResize(gfx::Size size, float scale_factor) override; |
186 virtual gfx::Size GetSize() override; | 192 virtual gfx::Size GetSize() override; |
187 virtual void SetLatencyInfo( | 193 virtual void SetLatencyInfo( |
188 const std::vector<ui::LatencyInfo>& latency_info) override; | 194 const std::vector<ui::LatencyInfo>& latency_info) override; |
189 virtual void WakeUpGpu() override; | 195 virtual void WakeUpGpu() override; |
190 | 196 |
191 protected: | 197 protected: |
192 virtual ~PassThroughImageTransportSurface(); | 198 virtual ~PassThroughImageTransportSurface(); |
193 | 199 |
194 // If updated vsync parameters can be determined, send this information to | 200 // If updated vsync parameters can be determined, send this information to |
195 // the browser. | 201 // the browser. |
196 virtual void SendVSyncUpdateIfAvailable(); | 202 virtual void SendVSyncUpdateIfAvailable(); |
197 | 203 |
198 ImageTransportHelper* GetHelper() { return helper_.get(); } | 204 ImageTransportHelper* GetHelper() { return helper_.get(); } |
199 | 205 |
200 private: | 206 private: |
201 scoped_ptr<ImageTransportHelper> helper_; | 207 scoped_ptr<ImageTransportHelper> helper_; |
202 bool did_set_swap_interval_; | 208 bool did_set_swap_interval_; |
203 std::vector<ui::LatencyInfo> latency_info_; | 209 std::vector<ui::LatencyInfo> latency_info_; |
204 | 210 |
205 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 211 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
206 }; | 212 }; |
207 | 213 |
208 } // namespace content | 214 } // namespace content |
209 | 215 |
210 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 216 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |