| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 SwapBuffers() OVERRIDE; | 36 virtual bool SwapBuffers() OVERRIDE; |
| 37 virtual gfx::Size GetSize() OVERRIDE; | 37 virtual gfx::Size GetSize() OVERRIDE; |
| 38 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 38 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
| 39 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 39 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 // ImageTransportSurface implementation | 42 // ImageTransportSurface implementation |
| 43 virtual void OnNewSurfaceACK(uint64 surface_id, | 43 virtual void OnNewSurfaceACK(uint64 surface_id, |
| 44 TransportDIB::Handle shm_handle) OVERRIDE; | 44 TransportDIB::Handle shm_handle) OVERRIDE; |
| 45 virtual void OnBuffersSwappedACK() OVERRIDE; | 45 virtual void OnBuffersSwappedACK() OVERRIDE; |
| 46 virtual void OnResizeViewACK() OVERRIDE; |
| 46 virtual void OnResize(gfx::Size size) OVERRIDE; | 47 virtual void OnResize(gfx::Size size) OVERRIDE; |
| 47 | 48 |
| 48 private: | 49 private: |
| 49 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; | 50 virtual ~IOSurfaceImageTransportSurface() OVERRIDE; |
| 50 | 51 |
| 51 uint32 fbo_id_; | 52 uint32 fbo_id_; |
| 52 GLuint texture_id_; | 53 GLuint texture_id_; |
| 53 | 54 |
| 54 base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_; | 55 base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_; |
| 55 | 56 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 virtual bool SwapBuffers() OVERRIDE; | 88 virtual bool SwapBuffers() OVERRIDE; |
| 88 virtual gfx::Size GetSize() OVERRIDE; | 89 virtual gfx::Size GetSize() OVERRIDE; |
| 89 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 90 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
| 90 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 91 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
| 91 | 92 |
| 92 protected: | 93 protected: |
| 93 // ImageTransportSurface implementation | 94 // ImageTransportSurface implementation |
| 94 virtual void OnBuffersSwappedACK() OVERRIDE; | 95 virtual void OnBuffersSwappedACK() OVERRIDE; |
| 95 virtual void OnNewSurfaceACK(uint64 surface_id, | 96 virtual void OnNewSurfaceACK(uint64 surface_id, |
| 96 TransportDIB::Handle shm_handle) OVERRIDE; | 97 TransportDIB::Handle shm_handle) OVERRIDE; |
| 98 virtual void OnResizeViewACK() OVERRIDE; |
| 97 virtual void OnResize(gfx::Size size) OVERRIDE; | 99 virtual void OnResize(gfx::Size size) OVERRIDE; |
| 98 | 100 |
| 99 private: | 101 private: |
| 100 virtual ~TransportDIBImageTransportSurface() OVERRIDE; | 102 virtual ~TransportDIBImageTransportSurface() OVERRIDE; |
| 101 | 103 |
| 102 uint32 fbo_id_; | 104 uint32 fbo_id_; |
| 103 GLuint render_buffer_id_; | 105 GLuint render_buffer_id_; |
| 104 | 106 |
| 105 scoped_ptr<TransportDIB> shared_mem_; | 107 scoped_ptr<TransportDIB> shared_mem_; |
| 106 | 108 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 helper_->SetScheduled(true); | 234 helper_->SetScheduled(true); |
| 233 } | 235 } |
| 234 | 236 |
| 235 void IOSurfaceImageTransportSurface::OnNewSurfaceACK( | 237 void IOSurfaceImageTransportSurface::OnNewSurfaceACK( |
| 236 uint64 surface_id, | 238 uint64 surface_id, |
| 237 TransportDIB::Handle /* shm_handle */) { | 239 TransportDIB::Handle /* shm_handle */) { |
| 238 DCHECK_EQ(io_surface_id_, surface_id); | 240 DCHECK_EQ(io_surface_id_, surface_id); |
| 239 helper_->SetScheduled(true); | 241 helper_->SetScheduled(true); |
| 240 } | 242 } |
| 241 | 243 |
| 244 void IOSurfaceImageTransportSurface::OnResizeViewACK() { |
| 245 NOTREACHED(); |
| 246 } |
| 247 |
| 242 void IOSurfaceImageTransportSurface::OnResize(gfx::Size size) { | 248 void IOSurfaceImageTransportSurface::OnResize(gfx::Size size) { |
| 243 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize(); | 249 IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize(); |
| 244 | 250 |
| 245 // Caching |context_| from OnMakeCurrent. It should still be current. | 251 // Caching |context_| from OnMakeCurrent. It should still be current. |
| 246 DCHECK(context_->IsCurrent(this)); | 252 DCHECK(context_->IsCurrent(this)); |
| 247 | 253 |
| 248 size_ = size; | 254 size_ = size; |
| 249 | 255 |
| 250 if (texture_id_) { | 256 if (texture_id_) { |
| 251 glDeleteTextures(1, &texture_id_); | 257 glDeleteTextures(1, &texture_id_); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 442 |
| 437 void TransportDIBImageTransportSurface::OnNewSurfaceACK( | 443 void TransportDIBImageTransportSurface::OnNewSurfaceACK( |
| 438 uint64 surface_id, | 444 uint64 surface_id, |
| 439 TransportDIB::Handle shm_handle) { | 445 TransportDIB::Handle shm_handle) { |
| 440 helper_->SetScheduled(true); | 446 helper_->SetScheduled(true); |
| 441 | 447 |
| 442 shared_mem_.reset(TransportDIB::Map(shm_handle)); | 448 shared_mem_.reset(TransportDIB::Map(shm_handle)); |
| 443 DCHECK_NE(shared_mem_.get(), static_cast<void*>(NULL)); | 449 DCHECK_NE(shared_mem_.get(), static_cast<void*>(NULL)); |
| 444 } | 450 } |
| 445 | 451 |
| 452 void TransportDIBImageTransportSurface::OnResizeViewACK() { |
| 453 NOTREACHED(); |
| 454 } |
| 455 |
| 446 void TransportDIBImageTransportSurface::OnResize(gfx::Size size) { | 456 void TransportDIBImageTransportSurface::OnResize(gfx::Size size) { |
| 447 size_ = size; | 457 size_ = size; |
| 448 | 458 |
| 449 if (!render_buffer_id_) | 459 if (!render_buffer_id_) |
| 450 glGenRenderbuffersEXT(1, &render_buffer_id_); | 460 glGenRenderbuffersEXT(1, &render_buffer_id_); |
| 451 | 461 |
| 452 GLint previous_fbo_id = 0; | 462 GLint previous_fbo_id = 0; |
| 453 glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &previous_fbo_id); | 463 glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &previous_fbo_id); |
| 454 | 464 |
| 455 GLint previous_renderbuffer_id = 0; | 465 GLint previous_renderbuffer_id = 0; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 NOTREACHED(); | 521 NOTREACHED(); |
| 512 return NULL; | 522 return NULL; |
| 513 } | 523 } |
| 514 if (surface->Initialize()) | 524 if (surface->Initialize()) |
| 515 return surface; | 525 return surface; |
| 516 else | 526 else |
| 517 return NULL; | 527 return NULL; |
| 518 } | 528 } |
| 519 | 529 |
| 520 #endif // defined(USE_GPU) | 530 #endif // defined(USE_GPU) |
| OLD | NEW |