| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "gpu/command_buffer/client/gles2_implementation.h" | 10 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 11 #include "mojo/gles2/command_buffer_client_impl.h" | 11 #include "mojo/gles2/command_buffer_client_impl.h" |
| 12 #include "mojo/public/c/gpu/MGL/mgl_echo.h" |
| 12 #include "mojo/public/c/gpu/MGL/mgl_signal_sync_point.h" | 13 #include "mojo/public/c/gpu/MGL/mgl_signal_sync_point.h" |
| 13 #include "mojo/public/c/gpu/MGL/mgl_types.h" | 14 #include "mojo/public/c/gpu/MGL/mgl_types.h" |
| 14 | 15 |
| 15 struct MGLContextPrivate {}; | 16 struct MGLContextPrivate {}; |
| 16 | 17 |
| 17 namespace gpu { | 18 namespace gpu { |
| 18 class TransferBuffer; | 19 class TransferBuffer; |
| 19 namespace gles2 { | 20 namespace gles2 { |
| 20 class GLES2CmdHelper; | 21 class GLES2CmdHelper; |
| 21 class GLES2Implementation; | 22 class GLES2Implementation; |
| 22 } | 23 } |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace gles2 { | 26 namespace gles2 { |
| 26 | 27 |
| 27 class GLES2Context : public CommandBufferDelegate, public MGLContextPrivate { | 28 class GLES2Context : public CommandBufferDelegate, public MGLContextPrivate { |
| 28 public: | 29 public: |
| 29 explicit GLES2Context(const MojoAsyncWaiter* async_waiter, | 30 explicit GLES2Context(const MojoAsyncWaiter* async_waiter, |
| 30 mojo::ScopedMessagePipeHandle command_buffer_handle, | 31 mojo::ScopedMessagePipeHandle command_buffer_handle, |
| 31 MGLContextLostCallback lost_callback, | 32 MGLContextLostCallback lost_callback, |
| 32 void* closure); | 33 void* closure); |
| 33 ~GLES2Context() override; | 34 ~GLES2Context() override; |
| 34 bool Initialize(); | 35 bool Initialize(); |
| 35 | 36 |
| 36 gpu::gles2::GLES2Interface* interface() const { | 37 gpu::gles2::GLES2Interface* interface() const { |
| 37 return implementation_.get(); | 38 return implementation_.get(); |
| 38 } | 39 } |
| 39 gpu::ContextSupport* context_support() const { return implementation_.get(); } | 40 gpu::ContextSupport* context_support() const { return implementation_.get(); } |
| 40 | 41 |
| 42 void Echo(MGLEchoCallback callback, void* closure); |
| 43 |
| 41 void SignalSyncPoint(uint32_t sync_point, | 44 void SignalSyncPoint(uint32_t sync_point, |
| 42 MGLSignalSyncPointCallback callback, | 45 MGLSignalSyncPointCallback callback, |
| 43 void* closure); | 46 void* closure); |
| 44 | 47 |
| 45 private: | 48 private: |
| 46 void ContextLost() override; | 49 void ContextLost() override; |
| 47 | 50 |
| 48 CommandBufferClientImpl command_buffer_; | 51 CommandBufferClientImpl command_buffer_; |
| 49 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 52 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
| 50 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; | 53 scoped_ptr<gpu::TransferBuffer> transfer_buffer_; |
| 51 scoped_ptr<gpu::gles2::GLES2Implementation> implementation_; | 54 scoped_ptr<gpu::gles2::GLES2Implementation> implementation_; |
| 52 MGLContextLostCallback lost_callback_; | 55 MGLContextLostCallback lost_callback_; |
| 53 void* closure_; | 56 void* closure_; |
| 54 | 57 |
| 55 MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2Context); | 58 MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2Context); |
| 56 }; | 59 }; |
| 57 | 60 |
| 58 } // namespace gles2 | 61 } // namespace gles2 |
| 59 | 62 |
| 60 #endif // MOJO_GLES2_GLES2_CONTEXT_H_ | 63 #endif // MOJO_GLES2_GLES2_CONTEXT_H_ |
| OLD | NEW |