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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; | 44 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; |
45 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 45 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
46 | 46 |
47 protected: | 47 protected: |
48 // ImageTransportSurface implementation | 48 // ImageTransportSurface implementation |
49 virtual void OnNewSurfaceACK(uint64 surface_handle, | 49 virtual void OnNewSurfaceACK(uint64 surface_handle, |
50 TransportDIB::Handle shm_handle) OVERRIDE; | 50 TransportDIB::Handle shm_handle) OVERRIDE; |
51 virtual void OnBufferPresented(uint32 sync_point) OVERRIDE; | 51 virtual void OnBufferPresented(uint32 sync_point) OVERRIDE; |
52 virtual void OnResizeViewACK() OVERRIDE; | 52 virtual void OnResizeViewACK() OVERRIDE; |
53 virtual void OnResize(gfx::Size size) OVERRIDE; | 53 virtual void OnResize(gfx::Size size) OVERRIDE; |
| 54 virtual gfx::Size GetSize() OVERRIDE; |
54 | 55 |
55 private: | 56 private: |
56 virtual ~PbufferImageTransportSurface(); | 57 virtual ~PbufferImageTransportSurface(); |
57 void SendBuffersSwapped(); | 58 void SendBuffersSwapped(); |
58 void DestroySurface(); | 59 void DestroySurface(); |
59 | 60 |
60 // Tracks the current buffer allocation state. | 61 // Tracks the current buffer allocation state. |
61 bool backbuffer_suggested_allocation_; | 62 bool backbuffer_suggested_allocation_; |
62 bool frontbuffer_suggested_allocation_; | 63 bool frontbuffer_suggested_allocation_; |
63 | 64 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 void PbufferImageTransportSurface::OnResize(gfx::Size size) { | 224 void PbufferImageTransportSurface::OnResize(gfx::Size size) { |
224 DCHECK(backbuffer_suggested_allocation_); | 225 DCHECK(backbuffer_suggested_allocation_); |
225 DCHECK(frontbuffer_suggested_allocation_); | 226 DCHECK(frontbuffer_suggested_allocation_); |
226 Resize(size); | 227 Resize(size); |
227 | 228 |
228 DestroySurface(); | 229 DestroySurface(); |
229 | 230 |
230 visible_size_ = size; | 231 visible_size_ = size; |
231 } | 232 } |
232 | 233 |
| 234 gfx::Size PbufferImageTransportSurface::GetSize() { |
| 235 return GLSurfaceAdapter::GetSize(); |
| 236 } |
| 237 |
233 } // namespace anonymous | 238 } // namespace anonymous |
234 | 239 |
235 // static | 240 // static |
236 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( | 241 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( |
237 GpuChannelManager* manager, | 242 GpuChannelManager* manager, |
238 GpuCommandBufferStub* stub, | 243 GpuCommandBufferStub* stub, |
239 const gfx::GLSurfaceHandle& handle) { | 244 const gfx::GLSurfaceHandle& handle) { |
240 scoped_refptr<gfx::GLSurface> surface; | 245 scoped_refptr<gfx::GLSurface> surface; |
241 | 246 |
242 if (handle.transport && | 247 if (handle.transport && |
(...skipping 19 matching lines...) Expand all Loading... |
262 handle.transport); | 267 handle.transport); |
263 } | 268 } |
264 | 269 |
265 if (surface->Initialize()) | 270 if (surface->Initialize()) |
266 return surface; | 271 return surface; |
267 else | 272 else |
268 return NULL; | 273 return NULL; |
269 } | 274 } |
270 | 275 |
271 #endif // ENABLE_GPU | 276 #endif // ENABLE_GPU |
OLD | NEW |