Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / mojo / gles2 / gles2_client_impl.h
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.
4
5 #ifndef MOJO_GLES2_GLES2_CLIENT_IMPL_H_
6 #define MOJO_GLES2_GLES2_CLIENT_IMPL_H_
7
8 #include "gpu/command_buffer/client/gles2_implementation.h"
9 #include "mojo/public/bindings/lib/remote_ptr.h"
10 #include "mojo/public/gles2/gles2.h"
11 #include "mojom/gles2.h"
12
13 struct MojoGLES2ContextPrivate {};
14
15 namespace mojo {
16 namespace gles2 {
17
18 class GLES2ClientImpl : public GLES2Client, public MojoGLES2ContextPrivate {
19  public:
20   explicit GLES2ClientImpl(MojoAsyncWaiter* async_waiter,
21                            ScopedMessagePipeHandle pipe,
22                            MojoGLES2ContextCreated created_callback,
23                            MojoGLES2ContextLost lost_callback,
24                            MojoGLES2DrawAnimationFrame animation_callback,
25                            void* closure);
26   virtual ~GLES2ClientImpl();
27   gpu::gles2::GLES2Interface* interface() const { return implementation_; }
28   gpu::ContextSupport* context_support() const { return implementation_; }
29   void RequestAnimationFrames();
30   void CancelAnimationFrames();
31
32  private:
33   virtual void DidCreateContext(uint64_t encoded,
34                                 uint32_t width,
35                                 uint32_t height) MOJO_OVERRIDE;
36   virtual void ContextLost() MOJO_OVERRIDE;
37   virtual void DrawAnimationFrame() MOJO_OVERRIDE;
38
39
40   RemotePtr<GLES2> service_;
41   gpu::gles2::GLES2Implementation* implementation_;
42   MojoGLES2ContextCreated created_callback_;
43   MojoGLES2ContextLost lost_callback_;
44   MojoGLES2DrawAnimationFrame animation_callback_;
45   void* closure_;
46
47   MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2ClientImpl);
48 };
49
50 }  // namespace gles2
51 }  // namespace mojo
52
53 #endif  // MOJO_GLES2_GLES2_CLIENT_IMPL_H_