Roll src/third_party/WebKit aa8346d:dbb8a38 (svn 202629:202630)
[chromium-blink-merge.git] / mojo / gles2 / gles2_context.h
blob5ab4b844d2a62b909aba60325fc6a62a1150320d
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MOJO_GLES2_GLES2_CONTEXT_H_
6 #define MOJO_GLES2_GLES2_CONTEXT_H_
8 #include <vector>
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "gpu/command_buffer/client/gles2_implementation.h"
13 #include "mojo/gles2/command_buffer_client_impl.h"
14 #include "mojo/public/c/gles2/gles2.h"
16 struct MojoGLES2ContextPrivate {};
18 namespace gpu {
19 class TransferBuffer;
20 namespace gles2 {
21 class GLES2CmdHelper;
22 class GLES2Implementation;
26 namespace gles2 {
28 class GLES2Context : public CommandBufferDelegate,
29 public MojoGLES2ContextPrivate {
30 public:
31 explicit GLES2Context(const std::vector<int32_t>& attribs,
32 const MojoAsyncWaiter* async_waiter,
33 mojo::ScopedMessagePipeHandle command_buffer_handle,
34 MojoGLES2ContextLost lost_callback,
35 void* closure);
36 ~GLES2Context() override;
37 bool Initialize();
39 gpu::gles2::GLES2Interface* interface() const {
40 return implementation_.get();
42 gpu::ContextSupport* context_support() const { return implementation_.get(); }
44 private:
45 void ContextLost() override;
47 CommandBufferClientImpl command_buffer_;
48 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_;
49 scoped_ptr<gpu::TransferBuffer> transfer_buffer_;
50 scoped_ptr<gpu::gles2::GLES2Implementation> implementation_;
51 MojoGLES2ContextLost lost_callback_;
52 void* closure_;
54 MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2Context);
57 } // namespace gles2
59 #endif // MOJO_GLES2_GLES2_CONTEXT_H_