| 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_cc.h" | 9 #include "ui/gfx/compositor/compositor_cc.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 AcceleratedSurfaceContainerLinuxCC | 15 class AcceleratedSurfaceContainerLinuxCC |
| 16 : public AcceleratedSurfaceContainerLinux, public ui::TextureCC { | 16 : public AcceleratedSurfaceContainerLinux, public ui::TextureCC { |
| 17 public: | 17 public: |
| 18 explicit AcceleratedSurfaceContainerLinuxCC(const gfx::Size& size) | 18 explicit AcceleratedSurfaceContainerLinuxCC(const gfx::Size& size) |
| 19 : size_(size), | 19 : acquired_(false) { |
| 20 acquired_(false) { | 20 size_ = size; |
| 21 } | 21 } |
| 22 | 22 |
| 23 virtual ~AcceleratedSurfaceContainerLinuxCC() { | 23 virtual ~AcceleratedSurfaceContainerLinuxCC() { |
| 24 if (image_transport_client_.get()) | 24 if (image_transport_client_.get()) |
| 25 image_transport_client_->Release(); | 25 image_transport_client_->Release(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual void AddRef() { ui::TextureCC::AddRef(); } | 28 virtual void AddRef() { ui::TextureCC::AddRef(); } |
| 29 virtual void Release() { ui::TextureCC::Release(); } | 29 virtual void Release() { ui::TextureCC::Release(); } |
| 30 | 30 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual TransportDIB::Handle Handle() const { | 60 virtual TransportDIB::Handle Handle() const { |
| 61 return image_transport_client_->Handle(); | 61 return image_transport_client_->Handle(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 virtual ui::Texture* GetTexture() { return this; } | 64 virtual ui::Texture* GetTexture() { return this; } |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 scoped_ptr<ImageTransportClient> image_transport_client_; | 67 scoped_ptr<ImageTransportClient> image_transport_client_; |
| 68 gfx::Size size_; | |
| 69 bool acquired_; | 68 bool acquired_; |
| 70 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerLinuxCC); | 69 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerLinuxCC); |
| 71 }; | 70 }; |
| 72 | 71 |
| 73 } // namespace | 72 } // namespace |
| 74 | 73 |
| 75 // static | 74 // static |
| 76 AcceleratedSurfaceContainerLinux* | 75 AcceleratedSurfaceContainerLinux* |
| 77 AcceleratedSurfaceContainerLinux::Create(const gfx::Size& size) { | 76 AcceleratedSurfaceContainerLinux::Create(const gfx::Size& size) { |
| 78 return new AcceleratedSurfaceContainerLinuxCC(size); | 77 return new AcceleratedSurfaceContainerLinuxCC(size); |
| 79 } | 78 } |
| OLD | NEW |