Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / mojo / services / gles2 / gles2_impl.h
1 // Copyright 2013 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_SERVICES_GLES2_GLES2_IMPL_H_
6 #define MOJO_SERVICES_GLES2_GLES2_IMPL_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/timer/timer.h"
10 #include "mojo/public/bindings/lib/remote_ptr.h"
11 #include "mojo/public/system/core_cpp.h"
12 #include "mojom/gles2.h"
13 #include "ui/gfx/native_widget_types.h"
14 #include "ui/gfx/size.h"
15
16 namespace gpu {
17 class GLInProcessContext;
18 }
19
20 namespace mojo {
21 namespace services {
22
23 class GLES2Impl : public GLES2 {
24  public:
25   explicit GLES2Impl(ScopedMessagePipeHandle client);
26   virtual ~GLES2Impl();
27
28   void CreateContext(gfx::AcceleratedWidget widget, const gfx::Size& size);
29
30  private:
31   virtual void RequestAnimationFrames() OVERRIDE;
32   virtual void CancelAnimationFrames() OVERRIDE;
33   virtual void Destroy() OVERRIDE;
34
35   void OnGLContextLost();
36   void DrawAnimationFrame();
37
38   base::RepeatingTimer<GLES2Impl> timer_;
39   scoped_ptr<gpu::GLInProcessContext> gl_context_;
40   RemotePtr<GLES2Client> client_;
41
42   DISALLOW_COPY_AND_ASSIGN(GLES2Impl);
43 };
44
45 }  // namespace services
46 }  // namespace mojo
47
48 #endif  // MOJO_SERVICES_GLES2_GLES2_IMPL_H_