| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_GLES2_COMMAND_BUFFER_DRIVER_H_ | 5 #ifndef COMPONENTS_MUS_GLES2_COMMAND_BUFFER_DRIVER_H_ |
| 6 #define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_DRIVER_H_ | 6 #define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_DRIVER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 virtual void DidLoseContext() = 0; | 42 virtual void DidLoseContext() = 0; |
| 43 }; | 43 }; |
| 44 explicit CommandBufferDriver(scoped_refptr<GpuState> gpu_state); | 44 explicit CommandBufferDriver(scoped_refptr<GpuState> gpu_state); |
| 45 | 45 |
| 46 ~CommandBufferDriver(); | 46 ~CommandBufferDriver(); |
| 47 | 47 |
| 48 void set_client(scoped_ptr<Client> client) { client_ = client.Pass(); } | 48 void set_client(scoped_ptr<Client> client) { client_ = client.Pass(); } |
| 49 | 49 |
| 50 void Initialize(mojo::CommandBufferSyncClientPtr sync_client, | 50 void Initialize(mojo::CommandBufferSyncClientPtr sync_client, |
| 51 mojo::CommandBufferLostContextObserverPtr loss_observer, | 51 mojo::CommandBufferLostContextObserverPtr loss_observer, |
| 52 mojo::ScopedSharedBufferHandle shared_state); | 52 mojo::ScopedSharedBufferHandle shared_state, |
| 53 mojo::Array<int32_t> attribs); |
| 53 void SetGetBuffer(int32_t buffer); | 54 void SetGetBuffer(int32_t buffer); |
| 54 void Flush(int32_t put_offset); | 55 void Flush(int32_t put_offset); |
| 55 void MakeProgress(int32_t last_get_offset); | 56 void MakeProgress(int32_t last_get_offset); |
| 56 void RegisterTransferBuffer(int32_t id, | 57 void RegisterTransferBuffer(int32_t id, |
| 57 mojo::ScopedSharedBufferHandle transfer_buffer, | 58 mojo::ScopedSharedBufferHandle transfer_buffer, |
| 58 uint32_t size); | 59 uint32_t size); |
| 59 void DestroyTransferBuffer(int32_t id); | 60 void DestroyTransferBuffer(int32_t id); |
| 60 void Echo(const mojo::Callback<void()>& callback); | 61 void Echo(const mojo::Callback<void()>& callback); |
| 61 void CreateImage(int32_t id, | 62 void CreateImage(int32_t id, |
| 62 mojo::ScopedHandle memory_handle, | 63 mojo::ScopedHandle memory_handle, |
| 63 int32_t type, | 64 int32_t type, |
| 64 mojo::SizePtr size, | 65 mojo::SizePtr size, |
| 65 int32_t format, | 66 int32_t format, |
| 66 int32_t internal_format); | 67 int32_t internal_format); |
| 67 void DestroyImage(int32_t id); | 68 void DestroyImage(int32_t id); |
| 68 | 69 |
| 69 private: | 70 private: |
| 70 bool MakeCurrent(); | 71 bool MakeCurrent(); |
| 71 bool DoInitialize(mojo::ScopedSharedBufferHandle shared_state); | 72 bool DoInitialize(mojo::ScopedSharedBufferHandle shared_state, |
| 73 mojo::Array<int32_t> attribs); |
| 72 void OnResize(gfx::Size size, float scale_factor); | 74 void OnResize(gfx::Size size, float scale_factor); |
| 73 bool OnWaitSyncPoint(uint32_t sync_point); | 75 bool OnWaitSyncPoint(uint32_t sync_point); |
| 74 void OnSyncPointRetired(); | 76 void OnSyncPointRetired(); |
| 75 void OnParseError(); | 77 void OnParseError(); |
| 76 void OnContextLost(uint32_t reason); | 78 void OnContextLost(uint32_t reason); |
| 77 void DestroyDecoder(); | 79 void DestroyDecoder(); |
| 78 | 80 |
| 79 scoped_ptr<Client> client_; | 81 scoped_ptr<Client> client_; |
| 80 mojo::CommandBufferSyncClientPtr sync_client_; | 82 mojo::CommandBufferSyncClientPtr sync_client_; |
| 81 mojo::CommandBufferLostContextObserverPtr loss_observer_; | 83 mojo::CommandBufferLostContextObserverPtr loss_observer_; |
| 82 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 84 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
| 83 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 85 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
| 84 scoped_ptr<gpu::GpuScheduler> scheduler_; | 86 scoped_ptr<gpu::GpuScheduler> scheduler_; |
| 85 scoped_refptr<gfx::GLContext> context_; | 87 scoped_refptr<gfx::GLContext> context_; |
| 86 scoped_refptr<gfx::GLSurface> surface_; | 88 scoped_refptr<gfx::GLSurface> surface_; |
| 87 scoped_refptr<GpuState> gpu_state_; | 89 scoped_refptr<GpuState> gpu_state_; |
| 88 | 90 |
| 89 scoped_refptr<base::SingleThreadTaskRunner> context_lost_task_runner_; | 91 scoped_refptr<base::SingleThreadTaskRunner> context_lost_task_runner_; |
| 90 base::Callback<void(int32_t)> context_lost_callback_; | 92 base::Callback<void(int32_t)> context_lost_callback_; |
| 91 | 93 |
| 92 base::WeakPtrFactory<CommandBufferDriver> weak_factory_; | 94 base::WeakPtrFactory<CommandBufferDriver> weak_factory_; |
| 93 | 95 |
| 94 DISALLOW_COPY_AND_ASSIGN(CommandBufferDriver); | 96 DISALLOW_COPY_AND_ASSIGN(CommandBufferDriver); |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 } // namespace gles2 | 99 } // namespace gles2 |
| 98 | 100 |
| 99 #endif // COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_ | 101 #endif // COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_ |
| OLD | NEW |