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 #pragma once | 7 #pragma once |
8 | 8 |
9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // making sure outside events reach the ImageTransportSurface and | 56 // making sure outside events reach the ImageTransportSurface and |
57 // allowing the ImageTransportSurface to send events to the outside world. | 57 // allowing the ImageTransportSurface to send events to the outside world. |
58 | 58 |
59 class ImageTransportSurface { | 59 class ImageTransportSurface { |
60 public: | 60 public: |
61 ImageTransportSurface(); | 61 ImageTransportSurface(); |
62 virtual ~ImageTransportSurface(); | 62 virtual ~ImageTransportSurface(); |
63 | 63 |
64 virtual void OnNewSurfaceACK( | 64 virtual void OnNewSurfaceACK( |
65 uint64 surface_id, TransportDIB::Handle surface_handle) = 0; | 65 uint64 surface_id, TransportDIB::Handle surface_handle) = 0; |
66 virtual void OnBuffersSwappedACK() = 0; | 66 virtual void OnBufferPresented() = 0; |
67 virtual void OnPostSubBufferACK() = 0; | |
68 virtual void OnResizeViewACK() = 0; | 67 virtual void OnResizeViewACK() = 0; |
69 virtual void OnResize(gfx::Size size) = 0; | 68 virtual void OnResize(gfx::Size size) = 0; |
70 | 69 |
71 // Creates the appropriate surface depending on the GL implementation. | 70 // Creates the appropriate surface depending on the GL implementation. |
72 static scoped_refptr<gfx::GLSurface> | 71 static scoped_refptr<gfx::GLSurface> |
73 CreateSurface(GpuChannelManager* manager, | 72 CreateSurface(GpuChannelManager* manager, |
74 GpuCommandBufferStub* stub, | 73 GpuCommandBufferStub* stub, |
75 const gfx::GLSurfaceHandle& handle); | 74 const gfx::GLSurfaceHandle& handle); |
76 protected: | 75 protected: |
77 // Used by certain implements of PostSubBuffer to determine | 76 // Used by certain implements of PostSubBuffer to determine |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 void Suspend(); | 127 void Suspend(); |
129 | 128 |
130 GpuChannelManager* manager() const { return manager_; } | 129 GpuChannelManager* manager() const { return manager_; } |
131 | 130 |
132 private: | 131 private: |
133 gpu::GpuScheduler* Scheduler(); | 132 gpu::GpuScheduler* Scheduler(); |
134 gpu::gles2::GLES2Decoder* Decoder(); | 133 gpu::gles2::GLES2Decoder* Decoder(); |
135 | 134 |
136 // IPC::Message handlers. | 135 // IPC::Message handlers. |
137 void OnNewSurfaceACK(uint64 surface_handle, TransportDIB::Handle shm_handle); | 136 void OnNewSurfaceACK(uint64 surface_handle, TransportDIB::Handle shm_handle); |
138 void OnBuffersSwappedACK(); | 137 void OnBufferPresented(); |
139 void OnPostSubBufferACK(); | |
140 void OnResizeViewACK(); | 138 void OnResizeViewACK(); |
141 | 139 |
142 // Backbuffer resize callback. | 140 // Backbuffer resize callback. |
143 void Resize(gfx::Size size); | 141 void Resize(gfx::Size size); |
144 | 142 |
145 // Weak pointers that point to objects that outlive this helper. | 143 // Weak pointers that point to objects that outlive this helper. |
146 ImageTransportSurface* surface_; | 144 ImageTransportSurface* surface_; |
147 GpuChannelManager* manager_; | 145 GpuChannelManager* manager_; |
148 | 146 |
149 base::WeakPtr<GpuCommandBufferStub> stub_; | 147 base::WeakPtr<GpuCommandBufferStub> stub_; |
(...skipping 17 matching lines...) Expand all Loading... |
167 // GLSurface implementation. | 165 // GLSurface implementation. |
168 virtual bool Initialize() OVERRIDE; | 166 virtual bool Initialize() OVERRIDE; |
169 virtual void Destroy() OVERRIDE; | 167 virtual void Destroy() OVERRIDE; |
170 virtual bool SwapBuffers() OVERRIDE; | 168 virtual bool SwapBuffers() OVERRIDE; |
171 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 169 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
172 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 170 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
173 | 171 |
174 // ImageTransportSurface implementation. | 172 // ImageTransportSurface implementation. |
175 virtual void OnNewSurfaceACK( | 173 virtual void OnNewSurfaceACK( |
176 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; | 174 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; |
177 virtual void OnBuffersSwappedACK() OVERRIDE; | 175 virtual void OnBufferPresented() OVERRIDE; |
178 virtual void OnPostSubBufferACK() OVERRIDE; | |
179 virtual void OnResizeViewACK() OVERRIDE; | 176 virtual void OnResizeViewACK() OVERRIDE; |
180 virtual void OnResize(gfx::Size size) OVERRIDE; | 177 virtual void OnResize(gfx::Size size) OVERRIDE; |
181 | 178 |
182 protected: | 179 protected: |
183 virtual ~PassThroughImageTransportSurface(); | 180 virtual ~PassThroughImageTransportSurface(); |
184 | 181 |
185 private: | 182 private: |
186 scoped_ptr<ImageTransportHelper> helper_; | 183 scoped_ptr<ImageTransportHelper> helper_; |
187 gfx::Size new_size_; | 184 gfx::Size new_size_; |
188 bool transport_; | 185 bool transport_; |
189 bool did_set_swap_interval_; | 186 bool did_set_swap_interval_; |
190 | 187 |
191 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 188 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
192 }; | 189 }; |
193 | 190 |
194 #endif // defined(ENABLE_GPU) | 191 #endif // defined(ENABLE_GPU) |
195 | 192 |
196 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 193 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |