| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 static void SetSwapInterval(gfx::GLContext* context); | 135 static void SetSwapInterval(gfx::GLContext* context); |
| 136 | 136 |
| 137 GpuChannelManager* manager() const { return manager_; } | 137 GpuChannelManager* manager() const { return manager_; } |
| 138 GpuCommandBufferStub* stub() const { return stub_.get(); } | 138 GpuCommandBufferStub* stub() const { return stub_.get(); } |
| 139 | 139 |
| 140 private: | 140 private: |
| 141 gpu::GpuScheduler* Scheduler(); | 141 gpu::GpuScheduler* Scheduler(); |
| 142 gpu::gles2::GLES2Decoder* Decoder(); | 142 gpu::gles2::GLES2Decoder* Decoder(); |
| 143 | 143 |
| 144 // IPC::Message handlers. | 144 // IPC::Message handlers. |
| 145 #if defined(OS_MACOSX) |
| 145 void OnBufferPresented( | 146 void OnBufferPresented( |
| 146 const AcceleratedSurfaceMsg_BufferPresented_Params& params); | 147 const AcceleratedSurfaceMsg_BufferPresented_Params& params); |
| 148 #endif |
| 147 void OnWakeUpGpu(); | 149 void OnWakeUpGpu(); |
| 148 | 150 |
| 149 // Backbuffer resize callback. | 151 // Backbuffer resize callback. |
| 150 void Resize(gfx::Size size, float scale_factor); | 152 void Resize(gfx::Size size, float scale_factor); |
| 151 | 153 |
| 152 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | 154 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
| 153 | 155 |
| 154 // Weak pointers that point to objects that outlive this helper. | 156 // Weak pointers that point to objects that outlive this helper. |
| 155 ImageTransportSurface* surface_; | 157 ImageTransportSurface* surface_; |
| 156 GpuChannelManager* manager_; | 158 GpuChannelManager* manager_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 173 gfx::GLSurface* surface); | 175 gfx::GLSurface* surface); |
| 174 | 176 |
| 175 // GLSurface implementation. | 177 // GLSurface implementation. |
| 176 virtual bool Initialize() override; | 178 virtual bool Initialize() override; |
| 177 virtual void Destroy() override; | 179 virtual void Destroy() override; |
| 178 virtual bool SwapBuffers() override; | 180 virtual bool SwapBuffers() override; |
| 179 virtual bool PostSubBuffer(int x, int y, int width, int height) override; | 181 virtual bool PostSubBuffer(int x, int y, int width, int height) override; |
| 180 virtual bool OnMakeCurrent(gfx::GLContext* context) override; | 182 virtual bool OnMakeCurrent(gfx::GLContext* context) override; |
| 181 | 183 |
| 182 // ImageTransportSurface implementation. | 184 // ImageTransportSurface implementation. |
| 185 #if defined(OS_MACOSX) |
| 183 virtual void OnBufferPresented( | 186 virtual void OnBufferPresented( |
| 184 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; | 187 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; |
| 188 #endif |
| 185 virtual void OnResize(gfx::Size size, float scale_factor) override; | 189 virtual void OnResize(gfx::Size size, float scale_factor) override; |
| 186 virtual gfx::Size GetSize() override; | 190 virtual gfx::Size GetSize() override; |
| 187 virtual void SetLatencyInfo( | 191 virtual void SetLatencyInfo( |
| 188 const std::vector<ui::LatencyInfo>& latency_info) override; | 192 const std::vector<ui::LatencyInfo>& latency_info) override; |
| 189 virtual void WakeUpGpu() override; | 193 virtual void WakeUpGpu() override; |
| 190 | 194 |
| 191 protected: | 195 protected: |
| 192 virtual ~PassThroughImageTransportSurface(); | 196 virtual ~PassThroughImageTransportSurface(); |
| 193 | 197 |
| 194 // If updated vsync parameters can be determined, send this information to | 198 // If updated vsync parameters can be determined, send this information to |
| 195 // the browser. | 199 // the browser. |
| 196 virtual void SendVSyncUpdateIfAvailable(); | 200 virtual void SendVSyncUpdateIfAvailable(); |
| 197 | 201 |
| 198 ImageTransportHelper* GetHelper() { return helper_.get(); } | 202 ImageTransportHelper* GetHelper() { return helper_.get(); } |
| 199 | 203 |
| 200 private: | 204 private: |
| 201 scoped_ptr<ImageTransportHelper> helper_; | 205 scoped_ptr<ImageTransportHelper> helper_; |
| 202 bool did_set_swap_interval_; | 206 bool did_set_swap_interval_; |
| 203 std::vector<ui::LatencyInfo> latency_info_; | 207 std::vector<ui::LatencyInfo> latency_info_; |
| 204 | 208 |
| 205 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 209 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
| 206 }; | 210 }; |
| 207 | 211 |
| 208 } // namespace content | 212 } // namespace content |
| 209 | 213 |
| 210 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 214 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| OLD | NEW |