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 #ifndef CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_LINUX_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_LINUX_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_LINUX_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_LINUX_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "ui/gfx/compositor/compositor.h" | 10 #include "ui/gfx/compositor/compositor.h" |
11 #include "ui/gfx/surface/transport_dib.h" | 11 #include "ui/gfx/surface/transport_dib.h" |
12 | 12 |
| 13 class ImageTransportClient; |
| 14 |
13 // Helper class for storing image data from the GPU process renderered | 15 // Helper class for storing image data from the GPU process renderered |
14 // on behalf of the RWHVV. It assumes that GL context that will display | 16 // on behalf of the RWHVV. It assumes that GL context that will display |
15 // the image data is current when an instance of this object is created | 17 // the image data is current when an instance of this object is created |
16 // or destroyed. | 18 // or destroyed. |
17 class AcceleratedSurfaceContainerLinux { | 19 class AcceleratedSurfaceContainerLinux : public ui::Texture { |
18 public: | 20 public: |
19 virtual ~AcceleratedSurfaceContainerLinux() { } | 21 explicit AcceleratedSurfaceContainerLinux(const gfx::Size& size); |
20 virtual void AddRef() = 0; | 22 virtual ~AcceleratedSurfaceContainerLinux(); |
21 virtual void Release() = 0; | |
22 | 23 |
23 // Initialize the surface container, and returns an ID for it. | 24 // Initialize the surface container, and returns an ID for it. |
24 // The |surface_handle| given to this function may be modified, and the | 25 // The |surface_handle| given to this function may be modified, and the |
25 // modified value should be used to identify the object. | 26 // modified value should be used to identify the object. |
26 virtual bool Initialize(uint64* surface_handle) = 0; | 27 bool Initialize(uint64* surface_handle); |
27 | 28 |
28 // Some implementations of this class use shared memory, this is the handle | 29 // Some implementations of this class use shared memory, this is the handle |
29 // to the shared buffer, which is part of the surface container. | 30 // to the shared buffer, which is part of the surface container. |
30 virtual TransportDIB::Handle Handle() const = 0; | 31 TransportDIB::Handle Handle() const; |
31 | 32 |
32 virtual ui::Texture* GetTexture() = 0; | 33 void Update(); |
33 | 34 |
34 virtual const gfx::Size& GetSize() = 0; | 35 private: |
35 | 36 scoped_ptr<ImageTransportClient> image_transport_client_; |
36 static AcceleratedSurfaceContainerLinux* Create(const gfx::Size& size); | 37 bool acquired_; |
| 38 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerLinux); |
37 }; | 39 }; |
38 | 40 |
39 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_LINUX_H_ | 41 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_SURFACE_CONTAINER_LINUX_H_ |
OLD | NEW |