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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "content/common/gpu/image_transport_surface.h" | 7 #include "content/common/gpu/image_transport_surface.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 virtual bool SwapBuffers() OVERRIDE; | 40 virtual bool SwapBuffers() OVERRIDE; |
41 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 41 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
42 virtual std::string GetExtensions() OVERRIDE; | 42 virtual std::string GetExtensions() OVERRIDE; |
43 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; | 43 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; |
44 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 44 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
45 | 45 |
46 protected: | 46 protected: |
47 // ImageTransportSurface implementation | 47 // ImageTransportSurface implementation |
48 virtual void OnNewSurfaceACK(uint64 surface_handle, | 48 virtual void OnNewSurfaceACK(uint64 surface_handle, |
49 TransportDIB::Handle shm_handle) OVERRIDE; | 49 TransportDIB::Handle shm_handle) OVERRIDE; |
50 virtual void OnBuffersSwappedACK() OVERRIDE; | 50 virtual void OnBufferPresented() OVERRIDE; |
51 virtual void OnPostSubBufferACK() OVERRIDE; | |
52 virtual void OnResizeViewACK() OVERRIDE; | 51 virtual void OnResizeViewACK() OVERRIDE; |
53 virtual void OnResize(gfx::Size size) OVERRIDE; | 52 virtual void OnResize(gfx::Size size) OVERRIDE; |
54 | 53 |
55 private: | 54 private: |
56 virtual ~PbufferImageTransportSurface(); | 55 virtual ~PbufferImageTransportSurface(); |
57 void SendBuffersSwapped(); | 56 void SendBuffersSwapped(); |
58 void DestroySurface(); | 57 void DestroySurface(); |
59 | 58 |
60 // Tracks the current buffer allocation state. | 59 // Tracks the current buffer allocation state. |
61 bool backbuffer_suggested_allocation_; | 60 bool backbuffer_suggested_allocation_; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 165 |
167 void PbufferImageTransportSurface::SendBuffersSwapped() { | 166 void PbufferImageTransportSurface::SendBuffersSwapped() { |
168 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; | 167 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; |
169 params.surface_handle = reinterpret_cast<int64>(GetShareHandle()); | 168 params.surface_handle = reinterpret_cast<int64>(GetShareHandle()); |
170 params.size = GetSize(); | 169 params.size = GetSize(); |
171 helper_->SendAcceleratedSurfaceBuffersSwapped(params); | 170 helper_->SendAcceleratedSurfaceBuffersSwapped(params); |
172 | 171 |
173 helper_->SetScheduled(false); | 172 helper_->SetScheduled(false); |
174 } | 173 } |
175 | 174 |
176 void PbufferImageTransportSurface::OnBuffersSwappedACK() { | 175 void PbufferImageTransportSurface::OnBufferPresented() { |
177 helper_->SetScheduled(true); | 176 helper_->SetScheduled(true); |
178 } | 177 } |
179 | 178 |
180 void PbufferImageTransportSurface::OnPostSubBufferACK() { | |
181 NOTREACHED(); | |
182 } | |
183 | |
184 void PbufferImageTransportSurface::OnNewSurfaceACK( | 179 void PbufferImageTransportSurface::OnNewSurfaceACK( |
185 uint64 surface_handle, | 180 uint64 surface_handle, |
186 TransportDIB::Handle shm_handle) { | 181 TransportDIB::Handle shm_handle) { |
187 NOTREACHED(); | 182 NOTREACHED(); |
188 } | 183 } |
189 | 184 |
190 void PbufferImageTransportSurface::OnResizeViewACK() { | 185 void PbufferImageTransportSurface::OnResizeViewACK() { |
191 NOTREACHED(); | 186 NOTREACHED(); |
192 } | 187 } |
193 | 188 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 handle.transport); | 228 handle.transport); |
234 } | 229 } |
235 | 230 |
236 if (surface->Initialize()) | 231 if (surface->Initialize()) |
237 return surface; | 232 return surface; |
238 else | 233 else |
239 return NULL; | 234 return NULL; |
240 } | 235 } |
241 | 236 |
242 #endif // ENABLE_GPU | 237 #endif // ENABLE_GPU |
OLD | NEW |