| 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 #include "content/browser/renderer_host/accelerated_surface_container_linux.h" | 5 #include "content/browser/renderer_host/accelerated_surface_container_linux.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "content/browser/renderer_host/image_transport_client.h" | 8 #include "content/browser/renderer_host/image_transport_client.h" |
| 9 #include "ui/gfx/compositor/compositor_gl.h" | 9 #include "ui/gfx/compositor/compositor_gl.h" |
| 10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
| 11 #include "ui/gfx/transform.h" | 11 #include "ui/gfx/transform.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 class AcceleratedSurfaceContainerLinuxGL | 15 class AcceleratedSurfaceContainerLinuxGL |
| 16 : public AcceleratedSurfaceContainerLinux, public ui::TextureGL { | 16 : public AcceleratedSurfaceContainerLinux, public ui::TextureGL { |
| 17 public: | 17 public: |
| 18 explicit AcceleratedSurfaceContainerLinuxGL(const gfx::Size& size) | 18 explicit AcceleratedSurfaceContainerLinuxGL(const gfx::Size& size) |
| 19 : ui::TextureGL(size) { | 19 : ui::TextureGL(size) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 virtual ~AcceleratedSurfaceContainerLinuxGL() { } | 22 virtual ~AcceleratedSurfaceContainerLinuxGL() { } |
| 23 virtual void AddRef() { ui::TextureGL::AddRef(); } | 23 virtual void AddRef() { ui::TextureGL::AddRef(); } |
| 24 virtual void Release() { ui::TextureGL::Release(); } | 24 virtual void Release() { ui::TextureGL::Release(); } |
| 25 | 25 |
| 26 virtual bool Initialize(uint64* surface_id) OVERRIDE { | 26 virtual bool Initialize(uint64* surface_handle) OVERRIDE { |
| 27 ui::SharedResourcesGL* instance = ui::SharedResourcesGL::GetInstance(); | 27 ui::SharedResourcesGL* instance = ui::SharedResourcesGL::GetInstance(); |
| 28 DCHECK(instance); | 28 DCHECK(instance); |
| 29 image_transport_client_.reset( | 29 image_transport_client_.reset( |
| 30 ImageTransportClient::Create(instance, size_)); | 30 ImageTransportClient::Create(instance, size_)); |
| 31 if (!image_transport_client_.get()) | 31 if (!image_transport_client_.get()) |
| 32 return false; | 32 return false; |
| 33 | 33 |
| 34 texture_id_ = image_transport_client_->Initialize(surface_id); | 34 texture_id_ = image_transport_client_->Initialize(surface_handle); |
| 35 if (!texture_id_) { | 35 if (!texture_id_) { |
| 36 image_transport_client_.reset(); | 36 image_transport_client_.reset(); |
| 37 return false; | 37 return false; |
| 38 } | 38 } |
| 39 return true; | 39 return true; |
| 40 } | 40 } |
| 41 | 41 |
| 42 virtual const gfx::Size& GetSize() { | 42 virtual const gfx::Size& GetSize() { |
| 43 return ui::TextureGL::size(); | 43 return ui::TextureGL::size(); |
| 44 } | 44 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerLinuxGL); | 77 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerLinuxGL); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace | 80 } // namespace |
| 81 | 81 |
| 82 // static | 82 // static |
| 83 AcceleratedSurfaceContainerLinux* | 83 AcceleratedSurfaceContainerLinux* |
| 84 AcceleratedSurfaceContainerLinux::Create(const gfx::Size& size) { | 84 AcceleratedSurfaceContainerLinux::Create(const gfx::Size& size) { |
| 85 return new AcceleratedSurfaceContainerLinuxGL(size); | 85 return new AcceleratedSurfaceContainerLinuxGL(size); |
| 86 } | 86 } |
| OLD | NEW |