| 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 #include "content/common/gpu/image_transport_surface.h" | 5 #include "content/common/gpu/image_transport_surface.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 virtual std::string GetExtensions() OVERRIDE; | 42 virtual std::string GetExtensions() OVERRIDE; |
| 43 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; | 43 virtual bool 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 OnBufferPresented( | 48 virtual void OnBufferPresented( |
| 49 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; | 49 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; |
| 50 virtual void OnResizeViewACK() OVERRIDE; | 50 virtual void OnResizeViewACK() OVERRIDE; |
| 51 virtual void OnResize(gfx::Size size) OVERRIDE; | 51 virtual void OnResize(gfx::Size size) OVERRIDE; |
| 52 virtual void SetLatencyInfo(const cc::LatencyInfo&) OVERRIDE; |
| 52 virtual gfx::Size GetSize() OVERRIDE; | 53 virtual gfx::Size GetSize() OVERRIDE; |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 virtual ~PbufferImageTransportSurface(); | 56 virtual ~PbufferImageTransportSurface(); |
| 56 void SendBuffersSwapped(); | 57 void SendBuffersSwapped(); |
| 57 void DestroySurface(); | 58 void DestroySurface(); |
| 58 | 59 |
| 59 // Tracks the current buffer allocation state. | 60 // Tracks the current buffer allocation state. |
| 60 bool backbuffer_suggested_allocation_; | 61 bool backbuffer_suggested_allocation_; |
| 61 bool frontbuffer_suggested_allocation_; | 62 bool frontbuffer_suggested_allocation_; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 void PbufferImageTransportSurface::OnResize(gfx::Size size) { | 220 void PbufferImageTransportSurface::OnResize(gfx::Size size) { |
| 220 DCHECK(backbuffer_suggested_allocation_); | 221 DCHECK(backbuffer_suggested_allocation_); |
| 221 DCHECK(frontbuffer_suggested_allocation_); | 222 DCHECK(frontbuffer_suggested_allocation_); |
| 222 Resize(size); | 223 Resize(size); |
| 223 | 224 |
| 224 DestroySurface(); | 225 DestroySurface(); |
| 225 | 226 |
| 226 visible_size_ = size; | 227 visible_size_ = size; |
| 227 } | 228 } |
| 228 | 229 |
| 230 void PbufferImageTransportSurface::SetLatencyInfo( |
| 231 const cc::LatencyInfo&) { |
| 232 // TODO: implement |
| 233 } |
| 234 |
| 229 gfx::Size PbufferImageTransportSurface::GetSize() { | 235 gfx::Size PbufferImageTransportSurface::GetSize() { |
| 230 return GLSurfaceAdapter::GetSize(); | 236 return GLSurfaceAdapter::GetSize(); |
| 231 } | 237 } |
| 232 | 238 |
| 233 } // namespace anonymous | 239 } // namespace anonymous |
| 234 | 240 |
| 235 // static | 241 // static |
| 236 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( | 242 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( |
| 237 GpuChannelManager* manager, | 243 GpuChannelManager* manager, |
| 238 GpuCommandBufferStub* stub, | 244 GpuCommandBufferStub* stub, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 286 } |
| 281 } | 287 } |
| 282 | 288 |
| 283 if (surface->Initialize()) | 289 if (surface->Initialize()) |
| 284 return surface; | 290 return surface; |
| 285 else | 291 else |
| 286 return NULL; | 292 return NULL; |
| 287 } | 293 } |
| 288 | 294 |
| 289 } // namespace content | 295 } // namespace content |
| OLD | NEW |