OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_GLES2_GLES2_CONTEXT_H_ | 5 #ifndef MOJO_GLES2_GLES2_CONTEXT_H_ |
6 #define MOJO_GLES2_GLES2_CONTEXT_H_ | 6 #define MOJO_GLES2_GLES2_CONTEXT_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
10 #include "gpu/command_buffer/client/gles2_implementation.h" | 12 #include "gpu/command_buffer/client/gles2_implementation.h" |
11 #include "mojo/gles2/command_buffer_client_impl.h" | 13 #include "mojo/gles2/command_buffer_client_impl.h" |
12 #include "mojo/public/c/gles2/gles2.h" | 14 #include "mojo/public/c/gles2/gles2.h" |
13 | 15 |
14 struct MojoGLES2ContextPrivate {}; | 16 struct MojoGLES2ContextPrivate {}; |
15 | 17 |
16 namespace gpu { | 18 namespace gpu { |
17 class TransferBuffer; | 19 class TransferBuffer; |
18 namespace gles2 { | 20 namespace gles2 { |
19 class GLES2CmdHelper; | 21 class GLES2CmdHelper; |
20 class GLES2Implementation; | 22 class GLES2Implementation; |
21 } | 23 } |
22 } | 24 } |
23 | 25 |
24 namespace gles2 { | 26 namespace gles2 { |
25 | 27 |
26 class GLES2Context : public CommandBufferDelegate, | 28 class GLES2Context : public CommandBufferDelegate, |
27 public MojoGLES2ContextPrivate { | 29 public MojoGLES2ContextPrivate { |
28 public: | 30 public: |
29 explicit GLES2Context(const MojoAsyncWaiter* async_waiter, | 31 explicit GLES2Context(const std::vector<int32_t>& attribs, |
| 32 const MojoAsyncWaiter* async_waiter, |
30 mojo::ScopedMessagePipeHandle command_buffer_handle, | 33 mojo::ScopedMessagePipeHandle command_buffer_handle, |
31 MojoGLES2ContextLost lost_callback, | 34 MojoGLES2ContextLost lost_callback, |
32 void* closure); | 35 void* closure); |
33 ~GLES2Context() override; | 36 ~GLES2Context() override; |
34 bool Initialize(); | 37 bool Initialize(); |
35 | 38 |
36 gpu::gles2::GLES2Interface* interface() const { | 39 gpu::gles2::GLES2Interface* interface() const { |
37 return implementation_.get(); | 40 return implementation_.get(); |
38 } | 41 } |
39 gpu::ContextSupport* context_support() const { return implementation_.get(); } | 42 gpu::ContextSupport* context_support() const { return implementation_.get(); } |
40 | 43 |
41 private: | 44 private: |
42 void ContextLost() override; | 45 void ContextLost() override; |
43 | 46 |
44 CommandBufferClientImpl command_buffer_; | 47 CommandBufferClientImpl command_buffer_; |
45 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 48 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
46 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; | 49 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; |
47 scoped_ptr<gpu::gles2::GLES2Implementation> implementation_; | 50 scoped_ptr<gpu::gles2::GLES2Implementation> implementation_; |
48 MojoGLES2ContextLost lost_callback_; | 51 MojoGLES2ContextLost lost_callback_; |
49 void* closure_; | 52 void* closure_; |
50 | 53 |
51 MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2Context); | 54 MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2Context); |
52 }; | 55 }; |
53 | 56 |
54 } // namespace gles2 | 57 } // namespace gles2 |
55 | 58 |
56 #endif // MOJO_GLES2_GLES2_CONTEXT_H_ | 59 #endif // MOJO_GLES2_GLES2_CONTEXT_H_ |
OLD | NEW |