| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   43                                  GpuCommandBufferStub* stub, |   43                                  GpuCommandBufferStub* stub, | 
|   44                                  gfx::PluginWindowHandle handle); |   44                                  gfx::PluginWindowHandle handle); | 
|   45  |   45  | 
|   46   // GLSurface implementation |   46   // GLSurface implementation | 
|   47   virtual bool Initialize() OVERRIDE; |   47   virtual bool Initialize() OVERRIDE; | 
|   48   virtual void Destroy() OVERRIDE; |   48   virtual void Destroy() OVERRIDE; | 
|   49   virtual bool DeferDraws() OVERRIDE; |   49   virtual bool DeferDraws() OVERRIDE; | 
|   50   virtual bool IsOffscreen() OVERRIDE; |   50   virtual bool IsOffscreen() OVERRIDE; | 
|   51   virtual bool SwapBuffers() OVERRIDE; |   51   virtual bool SwapBuffers() OVERRIDE; | 
|   52   virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |   52   virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 
|   53   virtual std::string GetExtensions() OVERRIDE; |   53   virtual bool SupportsPostSubBuffer() OVERRIDE; | 
|   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; | 
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  274   params.surface_size = GetSize(); |  274   params.surface_size = GetSize(); | 
|  275   params.surface_scale_factor = scale_factor_; |  275   params.surface_scale_factor = scale_factor_; | 
|  276   params.latency_info.swap(latency_info_); |  276   params.latency_info.swap(latency_info_); | 
|  277   helper_->SendAcceleratedSurfacePostSubBuffer(params); |  277   helper_->SendAcceleratedSurfacePostSubBuffer(params); | 
|  278  |  278  | 
|  279   DCHECK(!is_swap_buffers_pending_); |  279   DCHECK(!is_swap_buffers_pending_); | 
|  280   is_swap_buffers_pending_ = true; |  280   is_swap_buffers_pending_ = true; | 
|  281   return true; |  281   return true; | 
|  282 } |  282 } | 
|  283  |  283  | 
|  284 std::string IOSurfaceImageTransportSurface::GetExtensions() { |  284 bool IOSurfaceImageTransportSurface::SupportsPostSubBuffer() { | 
|  285   std::string extensions = gfx::GLSurface::GetExtensions(); |  285   return true; | 
|  286   extensions += extensions.empty() ? "" : " "; |  | 
|  287   extensions += "GL_CHROMIUM_post_sub_buffer"; |  | 
|  288   return extensions; |  | 
|  289 } |  286 } | 
|  290  |  287  | 
|  291 gfx::Size IOSurfaceImageTransportSurface::GetSize() { |  288 gfx::Size IOSurfaceImageTransportSurface::GetSize() { | 
|  292   return size_; |  289   return size_; | 
|  293 } |  290 } | 
|  294  |  291  | 
|  295 void IOSurfaceImageTransportSurface::OnBufferPresented( |  292 void IOSurfaceImageTransportSurface::OnBufferPresented( | 
|  296     const AcceleratedSurfaceMsg_BufferPresented_Params& params) { |  293     const AcceleratedSurfaceMsg_BufferPresented_Params& params) { | 
|  297   DCHECK(is_swap_buffers_pending_); |  294   DCHECK(is_swap_buffers_pending_); | 
|  298  |  295  | 
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  551           manager, stub, surface.get(), false)); |  548           manager, stub, surface.get(), false)); | 
|  552   } |  549   } | 
|  553 } |  550 } | 
|  554  |  551  | 
|  555 // static |  552 // static | 
|  556 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { |  553 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { | 
|  557   g_allow_os_mesa = allow; |  554   g_allow_os_mesa = allow; | 
|  558 } |  555 } | 
|  559  |  556  | 
|  560 }  // namespace content |  557 }  // namespace content | 
| OLD | NEW |