| 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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
| 6 | 6 |
| 7 #include "content/common/gpu/image_transport_surface.h" | 7 #include "content/common/gpu/image_transport_surface.h" |
| 8 | 8 |
| 9 #include "base/mac/scoped_cftyperef.h" | 9 #include "base/mac/scoped_cftyperef.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 36 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
| 37 virtual std::string GetExtensions() OVERRIDE; | 37 virtual std::string GetExtensions() OVERRIDE; |
| 38 virtual gfx::Size GetSize() OVERRIDE; | 38 virtual gfx::Size GetSize() OVERRIDE; |
| 39 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 39 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
| 40 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 40 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
| 41 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; | 41 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; |
| 42 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 42 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
| 43 | 43 |
| 44 protected: | 44 protected: |
| 45 // ImageTransportSurface implementation | 45 // ImageTransportSurface implementation |
| 46 virtual void OnNewSurfaceACK(uint64 surface_handle, | |
| 47 TransportDIB::Handle shm_handle) OVERRIDE; | |
| 48 virtual void OnBufferPresented(uint32 sync_point) OVERRIDE; | 46 virtual void OnBufferPresented(uint32 sync_point) OVERRIDE; |
| 49 virtual void OnResizeViewACK() OVERRIDE; | 47 virtual void OnResizeViewACK() OVERRIDE; |
| 50 virtual void OnResize(gfx::Size size) OVERRIDE; | 48 virtual void OnResize(gfx::Size size) OVERRIDE; |
| 51 | 49 |
| 52 private: | 50 private: |
| 53 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; | 51 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; |
| 54 | 52 |
| 55 void AdjustBufferAllocation(); | 53 void AdjustBufferAllocation(); |
| 56 void UnrefIOSurface(); | 54 void UnrefIOSurface(); |
| 57 void CreateIOSurface(); | 55 void CreateIOSurface(); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 259 |
| 262 void IOSurfaceImageTransportSurface::OnBufferPresented(uint32 sync_point) { | 260 void IOSurfaceImageTransportSurface::OnBufferPresented(uint32 sync_point) { |
| 263 DCHECK(is_swap_buffers_pending_); | 261 DCHECK(is_swap_buffers_pending_); |
| 264 is_swap_buffers_pending_ = false; | 262 is_swap_buffers_pending_ = false; |
| 265 if (did_unschedule_) { | 263 if (did_unschedule_) { |
| 266 did_unschedule_ = false; | 264 did_unschedule_ = false; |
| 267 helper_->SetScheduled(true); | 265 helper_->SetScheduled(true); |
| 268 } | 266 } |
| 269 } | 267 } |
| 270 | 268 |
| 271 void IOSurfaceImageTransportSurface::OnNewSurfaceACK( | |
| 272 uint64 surface_handle, | |
| 273 TransportDIB::Handle /* shm_handle */) { | |
| 274 NOTREACHED(); | |
| 275 } | |
| 276 | |
| 277 void IOSurfaceImageTransportSurface::OnResizeViewACK() { | 269 void IOSurfaceImageTransportSurface::OnResizeViewACK() { |
| 278 NOTREACHED(); | 270 NOTREACHED(); |
| 279 } | 271 } |
| 280 | 272 |
| 281 void IOSurfaceImageTransportSurface::OnResize(gfx::Size size) { | 273 void IOSurfaceImageTransportSurface::OnResize(gfx::Size size) { |
| 282 // Caching |context_| from OnMakeCurrent. It should still be current. | 274 // Caching |context_| from OnMakeCurrent. It should still be current. |
| 283 DCHECK(context_->IsCurrent(this)); | 275 DCHECK(context_->IsCurrent(this)); |
| 284 | 276 |
| 285 size_ = size; | 277 size_ = size; |
| 286 | 278 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 NOTREACHED(); | 397 NOTREACHED(); |
| 406 return NULL; | 398 return NULL; |
| 407 } | 399 } |
| 408 if (surface->Initialize()) | 400 if (surface->Initialize()) |
| 409 return surface; | 401 return surface; |
| 410 else | 402 else |
| 411 return NULL; | 403 return NULL; |
| 412 } | 404 } |
| 413 | 405 |
| 414 #endif // defined(USE_GPU) | 406 #endif // defined(USE_GPU) |
| OLD | NEW |