| 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/mac/scoped_cftyperef.h" | 7 #include "base/mac/scoped_cftyperef.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/common/gpu/gpu_command_buffer_stub.h" | 9 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 10 #include "content/common/gpu/gpu_messages.h" | 10 #include "content/common/gpu/gpu_messages.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 virtual gfx::Size GetSize() OVERRIDE; | 54 virtual gfx::Size GetSize() OVERRIDE; |
| 55 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 55 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
| 56 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 56 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
| 57 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; | 57 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; |
| 58 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 58 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
| 59 | 59 |
| 60 protected: | 60 protected: |
| 61 // ImageTransportSurface implementation | 61 // ImageTransportSurface implementation |
| 62 virtual void OnBufferPresented( | 62 virtual void OnBufferPresented( |
| 63 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; | 63 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; |
| 64 virtual void OnResizeViewACK() OVERRIDE; | |
| 65 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; | 64 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; |
| 66 virtual void SetLatencyInfo( | 65 virtual void SetLatencyInfo( |
| 67 const std::vector<ui::LatencyInfo>&) OVERRIDE; | 66 const std::vector<ui::LatencyInfo>&) OVERRIDE; |
| 68 virtual void WakeUpGpu() OVERRIDE; | 67 virtual void WakeUpGpu() OVERRIDE; |
| 69 | 68 |
| 70 // GpuCommandBufferStub::DestructionObserver implementation. | 69 // GpuCommandBufferStub::DestructionObserver implementation. |
| 71 virtual void OnWillDestroyStub() OVERRIDE; | 70 virtual void OnWillDestroyStub() OVERRIDE; |
| 72 | 71 |
| 73 private: | 72 private: |
| 74 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; | 73 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 DCHECK(is_swap_buffers_pending_); | 293 DCHECK(is_swap_buffers_pending_); |
| 295 | 294 |
| 296 context_->share_group()->SetRendererID(params.renderer_id); | 295 context_->share_group()->SetRendererID(params.renderer_id); |
| 297 is_swap_buffers_pending_ = false; | 296 is_swap_buffers_pending_ = false; |
| 298 if (did_unschedule_) { | 297 if (did_unschedule_) { |
| 299 did_unschedule_ = false; | 298 did_unschedule_ = false; |
| 300 helper_->SetScheduled(true); | 299 helper_->SetScheduled(true); |
| 301 } | 300 } |
| 302 } | 301 } |
| 303 | 302 |
| 304 void IOSurfaceImageTransportSurface::OnResizeViewACK() { | |
| 305 NOTREACHED(); | |
| 306 } | |
| 307 | |
| 308 void IOSurfaceImageTransportSurface::OnResize(gfx::Size size, | 303 void IOSurfaceImageTransportSurface::OnResize(gfx::Size size, |
| 309 float scale_factor) { | 304 float scale_factor) { |
| 310 // This trace event is used in gpu_feature_browsertest.cc - the test will need | 305 // This trace event is used in gpu_feature_browsertest.cc - the test will need |
| 311 // to be updated if this event is changed or moved. | 306 // to be updated if this event is changed or moved. |
| 312 TRACE_EVENT2("gpu", "IOSurfaceImageTransportSurface::OnResize", | 307 TRACE_EVENT2("gpu", "IOSurfaceImageTransportSurface::OnResize", |
| 313 "old_width", size_.width(), "new_width", size.width()); | 308 "old_width", size_.width(), "new_width", size.width()); |
| 314 // Caching |context_| from OnMakeCurrent. It should still be current. | 309 // Caching |context_| from OnMakeCurrent. It should still be current. |
| 315 DCHECK(context_->IsCurrent(this)); | 310 DCHECK(context_->IsCurrent(this)); |
| 316 | 311 |
| 317 size_ = size; | 312 size_ = size; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 // image transport surface, but that surface isn't used to read pixel | 533 // image transport surface, but that surface isn't used to read pixel |
| 539 // baselines. So this is mostly a dummy surface. | 534 // baselines. So this is mostly a dummy surface. |
| 540 if (!g_allow_os_mesa) { | 535 if (!g_allow_os_mesa) { |
| 541 NOTREACHED(); | 536 NOTREACHED(); |
| 542 return scoped_refptr<gfx::GLSurface>(); | 537 return scoped_refptr<gfx::GLSurface>(); |
| 543 } | 538 } |
| 544 scoped_refptr<gfx::GLSurface> surface(new DRTSurfaceOSMesa()); | 539 scoped_refptr<gfx::GLSurface> surface(new DRTSurfaceOSMesa()); |
| 545 if (!surface.get() || !surface->Initialize()) | 540 if (!surface.get() || !surface->Initialize()) |
| 546 return surface; | 541 return surface; |
| 547 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( | 542 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( |
| 548 manager, stub, surface.get(), false)); | 543 manager, stub, surface.get())); |
| 549 } | 544 } |
| 550 } | 545 } |
| 551 | 546 |
| 552 // static | 547 // static |
| 553 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { | 548 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { |
| 554 g_allow_os_mesa = allow; | 549 g_allow_os_mesa = allow; |
| 555 } | 550 } |
| 556 | 551 |
| 557 } // namespace content | 552 } // namespace content |
| OLD | NEW |