| 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 void SetLatencyInfo(const ui::LatencyInfo&) OVERRIDE; |
| 52 virtual gfx::Size GetSize() OVERRIDE; | 52 virtual gfx::Size GetSize() OVERRIDE; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 virtual ~PbufferImageTransportSurface(); | 55 virtual ~PbufferImageTransportSurface(); |
| 56 void SendBuffersSwapped(); | 56 void SendBuffersSwapped(); |
| 57 void DestroySurface(); | 57 void DestroySurface(); |
| 58 | 58 |
| 59 // Tracks the current buffer allocation state. | 59 // Tracks the current buffer allocation state. |
| 60 bool backbuffer_suggested_allocation_; | 60 bool backbuffer_suggested_allocation_; |
| 61 bool frontbuffer_suggested_allocation_; | 61 bool frontbuffer_suggested_allocation_; |
| 62 | 62 |
| 63 // Whether a SwapBuffers is pending. | 63 // Whether a SwapBuffers is pending. |
| 64 bool is_swap_buffers_pending_; | 64 bool is_swap_buffers_pending_; |
| 65 | 65 |
| 66 // Whether we unscheduled command buffer because of pending SwapBuffers. | 66 // Whether we unscheduled command buffer because of pending SwapBuffers. |
| 67 bool did_unschedule_; | 67 bool did_unschedule_; |
| 68 | 68 |
| 69 // Size to resize to when the surface becomes visible. | 69 // Size to resize to when the surface becomes visible. |
| 70 gfx::Size visible_size_; | 70 gfx::Size visible_size_; |
| 71 | 71 |
| 72 cc::LatencyInfo latency_info_; | 72 ui::LatencyInfo latency_info_; |
| 73 | 73 |
| 74 scoped_ptr<ImageTransportHelper> helper_; | 74 scoped_ptr<ImageTransportHelper> helper_; |
| 75 | 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(PbufferImageTransportSurface); | 76 DISALLOW_COPY_AND_ASSIGN(PbufferImageTransportSurface); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 PbufferImageTransportSurface::PbufferImageTransportSurface( | 79 PbufferImageTransportSurface::PbufferImageTransportSurface( |
| 80 GpuChannelManager* manager, | 80 GpuChannelManager* manager, |
| 81 GpuCommandBufferStub* stub) | 81 GpuCommandBufferStub* stub) |
| 82 : GLSurfaceAdapter(new gfx::PbufferGLSurfaceEGL(false, gfx::Size(1, 1))), | 82 : GLSurfaceAdapter(new gfx::PbufferGLSurfaceEGL(false, gfx::Size(1, 1))), |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 DCHECK(backbuffer_suggested_allocation_); | 223 DCHECK(backbuffer_suggested_allocation_); |
| 224 DCHECK(frontbuffer_suggested_allocation_); | 224 DCHECK(frontbuffer_suggested_allocation_); |
| 225 Resize(size); | 225 Resize(size); |
| 226 | 226 |
| 227 DestroySurface(); | 227 DestroySurface(); |
| 228 | 228 |
| 229 visible_size_ = size; | 229 visible_size_ = size; |
| 230 } | 230 } |
| 231 | 231 |
| 232 void PbufferImageTransportSurface::SetLatencyInfo( | 232 void PbufferImageTransportSurface::SetLatencyInfo( |
| 233 const cc::LatencyInfo& latency_info) { | 233 const ui::LatencyInfo& latency_info) { |
| 234 latency_info_ = latency_info; | 234 latency_info_ = latency_info; |
| 235 } | 235 } |
| 236 | 236 |
| 237 gfx::Size PbufferImageTransportSurface::GetSize() { | 237 gfx::Size PbufferImageTransportSurface::GetSize() { |
| 238 return GLSurfaceAdapter::GetSize(); | 238 return GLSurfaceAdapter::GetSize(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 } // namespace anonymous | 241 } // namespace anonymous |
| 242 | 242 |
| 243 // static | 243 // static |
| (...skipping 26 matching lines...) Expand all Loading... |
| 270 | 270 |
| 271 scoped_refptr<gfx::GLSurface> surface = | 271 scoped_refptr<gfx::GLSurface> surface = |
| 272 gfx::GLSurface::CreateViewGLSurface(false, handle.handle); | 272 gfx::GLSurface::CreateViewGLSurface(false, handle.handle); |
| 273 if (!surface) | 273 if (!surface) |
| 274 return surface; | 274 return surface; |
| 275 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( | 275 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( |
| 276 manager, stub, surface.get(), handle.is_transport())); | 276 manager, stub, surface.get(), handle.is_transport())); |
| 277 } | 277 } |
| 278 | 278 |
| 279 } // namespace content | 279 } // namespace content |
| OLD | NEW |