Chromium Code Reviews| 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 30 matching lines...) Expand all Loading... | |
| 41 virtual std::string GetExtensions() OVERRIDE; | 41 virtual std::string GetExtensions() OVERRIDE; |
| 42 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; | 42 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; |
| 43 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 43 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
| 44 | 44 |
| 45 protected: | 45 protected: |
| 46 // ImageTransportSurface implementation | 46 // ImageTransportSurface implementation |
| 47 virtual void OnBufferPresented( | 47 virtual void OnBufferPresented( |
| 48 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; | 48 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; |
| 49 virtual void OnResizeViewACK() OVERRIDE; | 49 virtual void OnResizeViewACK() OVERRIDE; |
| 50 virtual void OnResize(gfx::Size size) OVERRIDE; | 50 virtual void OnResize(gfx::Size size) OVERRIDE; |
| 51 virtual void SetLatencyInfo(const cc::LatencyInfo&) OVERRIDE; | |
| 51 virtual gfx::Size GetSize() OVERRIDE; | 52 virtual gfx::Size GetSize() OVERRIDE; |
| 52 | 53 |
| 53 private: | 54 private: |
| 54 virtual ~PbufferImageTransportSurface(); | 55 virtual ~PbufferImageTransportSurface(); |
| 55 void SendBuffersSwapped(); | 56 void SendBuffersSwapped(); |
| 56 void DestroySurface(); | 57 void DestroySurface(); |
| 57 | 58 |
| 58 // Tracks the current buffer allocation state. | 59 // Tracks the current buffer allocation state. |
| 59 bool backbuffer_suggested_allocation_; | 60 bool backbuffer_suggested_allocation_; |
| 60 bool frontbuffer_suggested_allocation_; | 61 bool frontbuffer_suggested_allocation_; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 void PbufferImageTransportSurface::OnResize(gfx::Size size) { | 219 void PbufferImageTransportSurface::OnResize(gfx::Size size) { |
| 219 DCHECK(backbuffer_suggested_allocation_); | 220 DCHECK(backbuffer_suggested_allocation_); |
| 220 DCHECK(frontbuffer_suggested_allocation_); | 221 DCHECK(frontbuffer_suggested_allocation_); |
| 221 Resize(size); | 222 Resize(size); |
| 222 | 223 |
| 223 DestroySurface(); | 224 DestroySurface(); |
| 224 | 225 |
| 225 visible_size_ = size; | 226 visible_size_ = size; |
| 226 } | 227 } |
| 227 | 228 |
| 229 void PbufferImageTransportSurface::SetLatencyInfo( | |
| 230 const cc::LatencyInfo&) { | |
| 231 // TODO: implement | |
|
piman
2013/04/03 18:05:09
Same here, is there anything to do here beyond kee
| |
| 232 } | |
| 233 | |
| 228 gfx::Size PbufferImageTransportSurface::GetSize() { | 234 gfx::Size PbufferImageTransportSurface::GetSize() { |
| 229 return GLSurfaceAdapter::GetSize(); | 235 return GLSurfaceAdapter::GetSize(); |
| 230 } | 236 } |
| 231 | 237 |
| 232 } // namespace anonymous | 238 } // namespace anonymous |
| 233 | 239 |
| 234 // static | 240 // static |
| 235 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface( | 241 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface( |
| 236 GpuChannelManager* manager, | 242 GpuChannelManager* manager, |
| 237 GpuCommandBufferStub* stub, | 243 GpuCommandBufferStub* stub, |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 261 | 267 |
| 262 scoped_refptr<gfx::GLSurface> surface = | 268 scoped_refptr<gfx::GLSurface> surface = |
| 263 gfx::GLSurface::CreateViewGLSurface(false, handle.handle); | 269 gfx::GLSurface::CreateViewGLSurface(false, handle.handle); |
| 264 if (!surface.get()) | 270 if (!surface.get()) |
| 265 return surface; | 271 return surface; |
| 266 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( | 272 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( |
| 267 manager, stub, surface.get(), handle.is_transport())); | 273 manager, stub, surface.get(), handle.is_transport())); |
| 268 } | 274 } |
| 269 | 275 |
| 270 } // namespace content | 276 } // namespace content |
| OLD | NEW |