15
15
// License along with this library; if not, write to the Free Software
16
16
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
#ifndef _OXIDE_SHARED_PORT_CONTENT_COMMON_GPU_THREAD_SHIM_H_
19
#define _OXIDE_SHARED_PORT_CONTENT_COMMON_GPU_THREAD_SHIM_H_
23
#include "base/macros.h"
24
#include "base/memory/scoped_ptr.h"
25
#include "base/memory/weak_ptr.h"
18
#ifndef _OXIDE_SHARED_PORT_CONTENT_COMMON_GPU_SERVICE_SHIM_H_
19
#define _OXIDE_SHARED_PORT_CONTENT_COMMON_GPU_SERVICE_SHIM_H_
26
23
#include "content/common/content_export.h"
28
typedef unsigned int GLuint;
31
26
class GLShareGroup;
42
35
namespace content {
44
class ContextProviderCommandBuffer;
45
class GpuCommandBufferStub;
47
36
namespace oxide_gpu_shim {
49
// Wrapper class for TextureRef. This is not thread-safe, and should only
50
// be used on the GPU thread
51
class CONTENT_EXPORT Texture {
53
Texture(content::GpuCommandBufferStub* command_buffer,
54
gpu::gles2::TextureRef* ref);
57
// Return the real texture ID
58
GLuint GetServiceID() const;
60
// Returns the TextureManager associated with the share group that the
61
// TextureRef belongs to
62
gpu::gles2::TextureManager* GetTextureManager() const;
64
// Destroy the underlying TextureRef. This can fail, eg, if the context
65
// is lost. On success, |this| can be deleted. On failure, |this| must not
66
// be deleted until its TextureManager is deing destroyed
67
// Returns: true on success, false on failure
71
// We use a WeakPtr, but it's a bug if this class outlives command_buffer_
72
base::WeakPtr<content::GpuCommandBufferStub> command_buffer_;
74
scoped_refptr<gpu::gles2::TextureRef> ref_;
76
DISALLOW_COPY_AND_ASSIGN(Texture);
79
// Create and return a Texture instance for the corresponding client process,
80
// command buffer and mailbox. The caller takes ownership of Texture
81
CONTENT_EXPORT Texture* ConsumeTextureFromMailbox(
84
const gpu::Mailbox& mailbox);
86
CONTENT_EXPORT int32_t GetContextProviderRouteID(
87
content::ContextProviderCommandBuffer* provider);
89
CONTENT_EXPORT gfx::GLShareGroup* GetGLShareGroup();
38
CONTENT_EXPORT gpu::gles2::GLES2Decoder* GetGLES2Decoder(int32_t client_id,
41
gfx::GLShareGroup* GetGLShareGroup();
90
42
CONTENT_EXPORT void SetGLShareGroup(gfx::GLShareGroup* share_group);
92
44
} // oxide_gpu_shim
95
#endif // _OXIDE_SHARED_PORT_CONTENT_COMMON_GPU_THREAD_SHIM_H_
47
#endif // _OXIDE_SHARED_PORT_CONTENT_COMMON_GPU_SERVICE_SHIM_H_