| 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_VIEW_MANAGER_GLES2_COMMAND_BUFFER_DRIVER_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_DRIVER_H_ |
| 6 #define COMPONENTS_VIEW_MANAGER_GLES2_COMMAND_BUFFER_DRIVER_H_ | 6 #define COMPONENTS_VIEW_MANAGER_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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 class GpuState; | 34 class GpuState; |
| 35 | 35 |
| 36 // This class receives CommandBuffer messages on the same thread as the native | 36 // This class receives CommandBuffer messages on the same thread as the native |
| 37 // viewport. | 37 // viewport. |
| 38 class CommandBufferDriver { | 38 class CommandBufferDriver { |
| 39 public: | 39 public: |
| 40 class Client { | 40 class Client { |
| 41 public: | 41 public: |
| 42 virtual ~Client(); | 42 virtual ~Client(); |
| 43 virtual void UpdateVSyncParameters(base::TimeTicks timebase, | |
| 44 base::TimeDelta interval) = 0; | |
| 45 virtual void DidLoseContext() = 0; | 43 virtual void DidLoseContext() = 0; |
| 46 }; | 44 }; |
| 47 // Offscreen. | 45 // Offscreen. |
| 48 explicit CommandBufferDriver(scoped_refptr<GpuState> gpu_state); | 46 explicit CommandBufferDriver(scoped_refptr<GpuState> gpu_state); |
| 49 | 47 |
| 50 // Onscreen. | 48 // Onscreen. |
| 51 CommandBufferDriver( | 49 CommandBufferDriver( |
| 52 gfx::AcceleratedWidget widget, | 50 gfx::AcceleratedWidget widget, |
| 53 scoped_refptr<GpuState> gpu_state, | 51 scoped_refptr<GpuState> gpu_state, |
| 54 const base::Callback<void(CommandBufferDriver*)>& destruct_callback); | 52 const base::Callback<void(CommandBufferDriver*)>& destruct_callback); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 80 void DestroyWindow(); | 78 void DestroyWindow(); |
| 81 | 79 |
| 82 private: | 80 private: |
| 83 bool MakeCurrent(); | 81 bool MakeCurrent(); |
| 84 bool DoInitialize(mojo::ScopedSharedBufferHandle shared_state); | 82 bool DoInitialize(mojo::ScopedSharedBufferHandle shared_state); |
| 85 void OnResize(gfx::Size size, float scale_factor); | 83 void OnResize(gfx::Size size, float scale_factor); |
| 86 bool OnWaitSyncPoint(uint32_t sync_point); | 84 bool OnWaitSyncPoint(uint32_t sync_point); |
| 87 void OnSyncPointRetired(); | 85 void OnSyncPointRetired(); |
| 88 void OnParseError(); | 86 void OnParseError(); |
| 89 void OnContextLost(uint32_t reason); | 87 void OnContextLost(uint32_t reason); |
| 90 void OnUpdateVSyncParameters(const base::TimeTicks timebase, | |
| 91 const base::TimeDelta interval); | |
| 92 void DestroyDecoder(); | 88 void DestroyDecoder(); |
| 93 | 89 |
| 94 scoped_ptr<Client> client_; | 90 scoped_ptr<Client> client_; |
| 95 mojo::CommandBufferSyncClientPtr sync_client_; | 91 mojo::CommandBufferSyncClientPtr sync_client_; |
| 96 mojo::CommandBufferLostContextObserverPtr loss_observer_; | 92 mojo::CommandBufferLostContextObserverPtr loss_observer_; |
| 97 gfx::AcceleratedWidget widget_; | 93 gfx::AcceleratedWidget widget_; |
| 98 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 94 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
| 99 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 95 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
| 100 scoped_ptr<gpu::GpuScheduler> scheduler_; | 96 scoped_ptr<gpu::GpuScheduler> scheduler_; |
| 101 scoped_refptr<gfx::GLContext> context_; | 97 scoped_refptr<gfx::GLContext> context_; |
| 102 scoped_refptr<gfx::GLSurface> surface_; | 98 scoped_refptr<gfx::GLSurface> surface_; |
| 103 scoped_refptr<GpuState> gpu_state_; | 99 scoped_refptr<GpuState> gpu_state_; |
| 104 | 100 |
| 105 scoped_refptr<base::SingleThreadTaskRunner> context_lost_task_runner_; | 101 scoped_refptr<base::SingleThreadTaskRunner> context_lost_task_runner_; |
| 106 base::Callback<void(int32_t)> context_lost_callback_; | 102 base::Callback<void(int32_t)> context_lost_callback_; |
| 107 | 103 |
| 108 base::Callback<void(CommandBufferDriver*)> destruct_callback_; | 104 base::Callback<void(CommandBufferDriver*)> destruct_callback_; |
| 109 | 105 |
| 110 base::WeakPtrFactory<CommandBufferDriver> weak_factory_; | 106 base::WeakPtrFactory<CommandBufferDriver> weak_factory_; |
| 111 | 107 |
| 112 DISALLOW_COPY_AND_ASSIGN(CommandBufferDriver); | 108 DISALLOW_COPY_AND_ASSIGN(CommandBufferDriver); |
| 113 }; | 109 }; |
| 114 | 110 |
| 115 } // namespace gles2 | 111 } // namespace gles2 |
| 116 | 112 |
| 117 #endif // COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_ | 113 #endif // COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_ |
| OLD | NEW |