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 COMPONENTS_MUS_PUBLIC_CPP_GLES2_CONTEXT_H_ | 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_GLES2_CONTEXT_H_ |
6 #define COMPONENTS_MUS_PUBLIC_CPP_GLES2_CONTEXT_H_ | 6 #define COMPONENTS_MUS_PUBLIC_CPP_GLES2_CONTEXT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "components/mus/public/cpp/lib/command_buffer_client_impl.h" | 14 #include "components/mus/public/cpp/mus_public_export.h" |
15 #include "gpu/command_buffer/client/gles2_implementation.h" | 15 #include "gpu/command_buffer/client/gles2_implementation.h" |
16 #include "mojo/public/c/gles2/gles2.h" | 16 #include "mojo/public/c/gles2/gles2.h" |
| 17 #include "mojo/public/cpp/bindings/binding.h" |
17 | 18 |
18 struct MojoGLES2ContextPrivate {}; | 19 struct MojoGLES2ContextPrivate {}; |
19 | 20 |
20 namespace gpu { | 21 namespace gpu { |
| 22 class CommandBufferProxyImpl; |
21 class TransferBuffer; | 23 class TransferBuffer; |
22 namespace gles2 { | 24 namespace gles2 { |
23 class GLES2CmdHelper; | 25 class GLES2CmdHelper; |
24 class GLES2Implementation; | |
25 } | 26 } |
26 } | 27 } |
27 | 28 |
28 namespace mus { | 29 namespace mus { |
29 | 30 |
30 class GLES2Context : public MojoGLES2ContextPrivate { | 31 class CommandBufferClientImpl; |
| 32 |
| 33 class MUS_PUBLIC_EXPORT GLES2Context : public MojoGLES2ContextPrivate { |
31 public: | 34 public: |
32 explicit GLES2Context(const std::vector<int32_t>& attribs, | 35 explicit GLES2Context(const std::vector<int32_t>& attribs, |
33 mojo::ScopedMessagePipeHandle command_buffer_handle, | 36 mojo::ScopedMessagePipeHandle command_buffer_handle, |
34 MojoGLES2ContextLost lost_callback, | 37 MojoGLES2ContextLost lost_callback, |
35 void* closure); | 38 void* closure); |
36 virtual ~GLES2Context(); | 39 virtual ~GLES2Context(); |
37 bool Initialize(); | 40 bool Initialize(); |
38 | 41 |
39 gpu::gles2::GLES2Interface* interface() const { | 42 gpu::gles2::GLES2Interface* interface() const { |
40 return implementation_.get(); | 43 return implementation_.get(); |
41 } | 44 } |
42 gpu::ContextSupport* context_support() const { return implementation_.get(); } | 45 gpu::ContextSupport* context_support() const { return implementation_.get(); } |
43 | 46 |
44 private: | 47 private: |
45 void OnLostContext(); | 48 void OnLostContext(); |
46 | 49 |
47 CommandBufferClientImpl command_buffer_; | 50 std::unique_ptr<CommandBufferClientImpl> command_buffer_client_impl_; |
| 51 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_proxy_impl_; |
48 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 52 std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
49 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; | 53 std::unique_ptr<gpu::TransferBuffer> transfer_buffer_; |
50 std::unique_ptr<gpu::gles2::GLES2Implementation> implementation_; | 54 std::unique_ptr<gpu::gles2::GLES2Implementation> implementation_; |
51 MojoGLES2ContextLost lost_callback_; | 55 MojoGLES2ContextLost lost_callback_; |
52 void* closure_; | 56 void* closure_; |
53 | 57 |
54 DISALLOW_COPY_AND_ASSIGN(GLES2Context); | 58 DISALLOW_COPY_AND_ASSIGN(GLES2Context); |
55 }; | 59 }; |
56 | 60 |
57 } // namespace mus | 61 } // namespace mus |
58 | 62 |
59 #endif // COMPONENTS_MUS_PUBLIC_CPP_GLES2_CONTEXT_H_ | 63 #endif // COMPONENTS_MUS_PUBLIC_CPP_GLES2_CONTEXT_H_ |
OLD | NEW |