| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "gpu/command_buffer/client/gles2_implementation.h" | 14 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 15 #include "gpu/command_buffer/client/gpu_control_client.h" |
| 15 #include "mojo/gles2/command_buffer_client_impl.h" | 16 #include "mojo/gles2/command_buffer_client_impl.h" |
| 16 #include "mojo/public/c/gles2/gles2.h" | 17 #include "mojo/public/c/gles2/gles2.h" |
| 17 | 18 |
| 18 struct MojoGLES2ContextPrivate {}; | 19 struct MojoGLES2ContextPrivate {}; |
| 19 | 20 |
| 20 namespace gpu { | 21 namespace gpu { |
| 21 class TransferBuffer; | 22 class TransferBuffer; |
| 22 namespace gles2 { | 23 namespace gles2 { |
| 23 class GLES2CmdHelper; | 24 class GLES2CmdHelper; |
| 24 class GLES2Implementation; | 25 class GLES2Implementation; |
| 25 } | 26 } |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace gles2 { | 29 namespace gles2 { |
| 29 | 30 |
| 30 class GLES2Context : public CommandBufferDelegate, | 31 class GLES2Context : public MojoGLES2ContextPrivate, |
| 31 public MojoGLES2ContextPrivate { | 32 public gpu::GpuControlClient { |
| 32 public: | 33 public: |
| 33 explicit GLES2Context(const std::vector<int32_t>& attribs, | 34 explicit GLES2Context(const std::vector<int32_t>& attribs, |
| 34 mojo::ScopedMessagePipeHandle command_buffer_handle, | 35 mojo::ScopedMessagePipeHandle command_buffer_handle, |
| 35 MojoGLES2ContextLost lost_callback, | 36 MojoGLES2ContextLost lost_callback, |
| 36 void* closure); | 37 void* closure); |
| 37 ~GLES2Context() override; | 38 virtual ~GLES2Context(); |
| 38 bool Initialize(); | 39 bool Initialize(); |
| 39 | 40 |
| 40 gpu::gles2::GLES2Interface* interface() const { | 41 gpu::gles2::GLES2Interface* interface() const { |
| 41 return implementation_.get(); | 42 return implementation_.get(); |
| 42 } | 43 } |
| 43 gpu::ContextSupport* context_support() const { return implementation_.get(); } | 44 gpu::ContextSupport* context_support() const { return implementation_.get(); } |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 void ContextLost() override; | 47 // GpuControlClient implementation. |
| 48 void OnGpuControlLostContext() override; |
| 49 void OnGpuControlErrorMessage(const char* message, int32_t id) 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 MojoGLES2ContextLost lost_callback_; | 55 MojoGLES2ContextLost lost_callback_; |
| 53 void* closure_; | 56 void* closure_; |
| 54 | 57 |
| 55 DISALLOW_COPY_AND_ASSIGN(GLES2Context); | 58 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 |