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, float scale_factor) OVERRIDE; | 50 virtual void OnResize(gfx::Size size, float scale_factor) 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 DCHECK(backbuffer_suggested_allocation_); | 224 DCHECK(backbuffer_suggested_allocation_); |
225 DCHECK(frontbuffer_suggested_allocation_); | 225 DCHECK(frontbuffer_suggested_allocation_); |
226 Resize(size); | 226 Resize(size); |
227 | 227 |
228 DestroySurface(); | 228 DestroySurface(); |
229 | 229 |
230 visible_size_ = size; | 230 visible_size_ = size; |
231 } | 231 } |
232 | 232 |
233 void PbufferImageTransportSurface::SetLatencyInfo( | 233 void PbufferImageTransportSurface::SetLatencyInfo( |
234 const cc::LatencyInfo& latency_info) { | 234 const ui::LatencyInfo& latency_info) { |
235 latency_info_ = latency_info; | 235 latency_info_ = latency_info; |
236 } | 236 } |
237 | 237 |
238 gfx::Size PbufferImageTransportSurface::GetSize() { | 238 gfx::Size PbufferImageTransportSurface::GetSize() { |
239 return GLSurfaceAdapter::GetSize(); | 239 return GLSurfaceAdapter::GetSize(); |
240 } | 240 } |
241 | 241 |
242 } // namespace anonymous | 242 } // namespace anonymous |
243 | 243 |
244 // static | 244 // static |
(...skipping 26 matching lines...) Expand all Loading... |
271 | 271 |
272 scoped_refptr<gfx::GLSurface> surface = | 272 scoped_refptr<gfx::GLSurface> surface = |
273 gfx::GLSurface::CreateViewGLSurface(false, handle.handle); | 273 gfx::GLSurface::CreateViewGLSurface(false, handle.handle); |
274 if (!surface) | 274 if (!surface) |
275 return surface; | 275 return surface; |
276 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( | 276 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( |
277 manager, stub, surface.get(), handle.is_transport())); | 277 manager, stub, surface.get(), handle.is_transport())); |
278 } | 278 } |
279 | 279 |
280 } // namespace content | 280 } // namespace content |
OLD | NEW |