Upstream version 5.34.92.0
[platform/framework/web/crosswalk.git] / src / mojo / examples / compositor_app / gles2_client_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_EXAMPLES_COMPOSITOR_APP_GLES2_CLIENT_IMPL_H_
6 #define MOJO_EXAMPLES_COMPOSITOR_APP_GLES2_CLIENT_IMPL_H_
7
8 #include "base/time/time.h"
9 #include "base/timer/timer.h"
10 #include "mojo/public/bindings/lib/remote_ptr.h"
11 #include "mojo/public/gles2/gles2.h"
12 #include "mojom/native_viewport.h"
13 #include "ui/gfx/size.h"
14
15 namespace gpu {
16 class ContextSupport;
17 namespace gles2 {
18 class GLES2Interface;
19 }
20 }
21
22 namespace mojo {
23 namespace examples {
24
25 class GLES2ClientImpl {
26  public:
27   GLES2ClientImpl(
28       ScopedMessagePipeHandle pipe,
29       const base::Callback<void(gfx::Size)>& context_created_callback);
30   virtual ~GLES2ClientImpl();
31
32   gpu::gles2::GLES2Interface* Interface() const;
33   gpu::ContextSupport* Support() const;
34
35  private:
36   void DidCreateContext(uint32_t width, uint32_t height);
37   static void DidCreateContextThunk(
38       void* closure,
39       uint32_t width,
40       uint32_t height);
41   void ContextLost();
42   static void ContextLostThunk(void* closure);
43
44   base::Callback<void(gfx::Size viewport_size)> context_created_callback_;
45
46   MojoGLES2Context context_;
47
48   MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2ClientImpl);
49 };
50
51 }  // namespace examples
52 }  // namespace mojo
53
54 #endif  // MOJO_EXAMPLES_COMPOSITOR_APP_GLES2_CLIENT_IMPL_H_