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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // allowing the ImageTransportSurface to send events to the outside world. | 56 // allowing the ImageTransportSurface to send events to the outside world. |
57 | 57 |
58 class ImageTransportSurface { | 58 class ImageTransportSurface { |
59 public: | 59 public: |
60 ImageTransportSurface(); | 60 ImageTransportSurface(); |
61 | 61 |
62 #if defined(OS_MACOSX) | 62 #if defined(OS_MACOSX) |
63 virtual void OnBufferPresented( | 63 virtual void OnBufferPresented( |
64 const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0; | 64 const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0; |
65 #endif | 65 #endif |
66 virtual void OnResize(gfx::Size size, float scale_factor) = 0; | |
67 virtual void SetLatencyInfo( | 66 virtual void SetLatencyInfo( |
68 const std::vector<ui::LatencyInfo>& latency_info) = 0; | 67 const std::vector<ui::LatencyInfo>& latency_info) = 0; |
69 | 68 |
70 // Creates a surface with the given attributes. | 69 // Creates a surface with the given attributes. |
71 static scoped_refptr<gfx::GLSurface> CreateSurface( | 70 static scoped_refptr<gfx::GLSurface> CreateSurface( |
72 GpuChannelManager* manager, | 71 GpuChannelManager* manager, |
73 GpuCommandBufferStub* stub, | 72 GpuCommandBufferStub* stub, |
74 const gfx::GLSurfaceHandle& handle); | 73 const gfx::GLSurfaceHandle& handle); |
75 | 74 |
76 #if defined(OS_MACOSX) | 75 #if defined(OS_MACOSX) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 void Destroy() override; | 169 void Destroy() override; |
171 gfx::SwapResult SwapBuffers() override; | 170 gfx::SwapResult SwapBuffers() override; |
172 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; | 171 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
173 bool OnMakeCurrent(gfx::GLContext* context) override; | 172 bool OnMakeCurrent(gfx::GLContext* context) override; |
174 | 173 |
175 // ImageTransportSurface implementation. | 174 // ImageTransportSurface implementation. |
176 #if defined(OS_MACOSX) | 175 #if defined(OS_MACOSX) |
177 void OnBufferPresented( | 176 void OnBufferPresented( |
178 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; | 177 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; |
179 #endif | 178 #endif |
180 void OnResize(gfx::Size size, float scale_factor) override; | |
181 gfx::Size GetSize() override; | 179 gfx::Size GetSize() override; |
182 void SetLatencyInfo( | 180 void SetLatencyInfo( |
183 const std::vector<ui::LatencyInfo>& latency_info) override; | 181 const std::vector<ui::LatencyInfo>& latency_info) override; |
184 | 182 |
185 protected: | 183 protected: |
186 ~PassThroughImageTransportSurface() override; | 184 ~PassThroughImageTransportSurface() override; |
187 | 185 |
188 // If updated vsync parameters can be determined, send this information to | 186 // If updated vsync parameters can be determined, send this information to |
189 // the browser. | 187 // the browser. |
190 virtual void SendVSyncUpdateIfAvailable(); | 188 virtual void SendVSyncUpdateIfAvailable(); |
191 void SwapBuffersCallBack(std::vector<ui::LatencyInfo>* latency_info_ptr, | 189 void SwapBuffersCallBack(std::vector<ui::LatencyInfo>* latency_info_ptr, |
192 gfx::SwapResult result); | 190 gfx::SwapResult result); |
193 | 191 |
194 ImageTransportHelper* GetHelper() { return helper_.get(); } | 192 ImageTransportHelper* GetHelper() { return helper_.get(); } |
195 | 193 |
196 private: | 194 private: |
197 scoped_ptr<ImageTransportHelper> helper_; | 195 scoped_ptr<ImageTransportHelper> helper_; |
198 bool did_set_swap_interval_; | 196 bool did_set_swap_interval_; |
199 std::vector<ui::LatencyInfo> latency_info_; | 197 std::vector<ui::LatencyInfo> latency_info_; |
200 base::WeakPtrFactory<PassThroughImageTransportSurface> weak_ptr_factory_; | 198 base::WeakPtrFactory<PassThroughImageTransportSurface> weak_ptr_factory_; |
201 | 199 |
202 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 200 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
203 }; | 201 }; |
204 | 202 |
205 } // namespace content | 203 } // namespace content |
206 | 204 |
207 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 205 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |