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 MOJO_SERVICES_GLES2_COMMAND_BUFFER_DRIVER_H_ | 5 #ifndef MOJO_SERVICES_GLES2_COMMAND_BUFFER_DRIVER_H_ |
6 #define MOJO_SERVICES_GLES2_COMMAND_BUFFER_DRIVER_H_ | 6 #define MOJO_SERVICES_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" |
| 11 #include "base/single_thread_task_runner.h" |
11 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
12 #include "mojo/services/public/interfaces/gpu/command_buffer.mojom.h" | 13 #include "mojo/services/public/interfaces/gpu/command_buffer.mojom.h" |
13 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
14 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
15 | 16 |
16 namespace gpu { | 17 namespace gpu { |
17 class CommandBufferService; | 18 class CommandBufferService; |
18 class GpuScheduler; | 19 class GpuScheduler; |
19 class GpuControlService; | 20 class GpuControlService; |
20 namespace gles2 { | 21 namespace gles2 { |
(...skipping 24 matching lines...) Expand all Loading... |
45 | 46 |
46 void Initialize(CommandBufferSyncClientPtr sync_client, | 47 void Initialize(CommandBufferSyncClientPtr sync_client, |
47 ScopedSharedBufferHandle shared_state); | 48 ScopedSharedBufferHandle shared_state); |
48 void SetGetBuffer(int32_t buffer); | 49 void SetGetBuffer(int32_t buffer); |
49 void Flush(int32_t put_offset); | 50 void Flush(int32_t put_offset); |
50 void MakeProgress(int32_t last_get_offset); | 51 void MakeProgress(int32_t last_get_offset); |
51 void RegisterTransferBuffer(int32_t id, | 52 void RegisterTransferBuffer(int32_t id, |
52 ScopedSharedBufferHandle transfer_buffer, | 53 ScopedSharedBufferHandle transfer_buffer, |
53 uint32_t size); | 54 uint32_t size); |
54 void DestroyTransferBuffer(int32_t id); | 55 void DestroyTransferBuffer(int32_t id); |
| 56 void Echo(const Callback<void()>& callback); |
55 | 57 |
56 void SetContextLostCallback(const base::Callback<void(int32_t)>& callback); | 58 void SetContextLostCallback( |
| 59 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 60 const base::Callback<void(int32_t)>& callback); |
57 | 61 |
58 private: | 62 private: |
59 bool DoInitialize(ScopedSharedBufferHandle shared_state); | 63 bool DoInitialize(ScopedSharedBufferHandle shared_state); |
60 void OnResize(gfx::Size size, float scale_factor); | 64 void OnResize(gfx::Size size, float scale_factor); |
61 void OnParseError(); | 65 void OnParseError(); |
62 void OnContextLost(uint32_t reason); | 66 void OnContextLost(uint32_t reason); |
63 | 67 |
64 CommandBufferSyncClientPtr sync_client_; | 68 CommandBufferSyncClientPtr sync_client_; |
65 | 69 |
66 gfx::AcceleratedWidget widget_; | 70 gfx::AcceleratedWidget widget_; |
67 gfx::Size size_; | 71 gfx::Size size_; |
68 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 72 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
69 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 73 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
70 scoped_ptr<gpu::GpuScheduler> scheduler_; | 74 scoped_ptr<gpu::GpuScheduler> scheduler_; |
71 scoped_refptr<gfx::GLContext> context_; | 75 scoped_refptr<gfx::GLContext> context_; |
72 scoped_refptr<gfx::GLSurface> surface_; | 76 scoped_refptr<gfx::GLSurface> surface_; |
73 scoped_refptr<gfx::GLShareGroup> share_group_; | 77 scoped_refptr<gfx::GLShareGroup> share_group_; |
74 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | 78 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; |
| 79 |
| 80 scoped_refptr<base::SingleThreadTaskRunner> context_lost_task_runner_; |
75 base::Callback<void(int32_t)> context_lost_callback_; | 81 base::Callback<void(int32_t)> context_lost_callback_; |
76 | 82 |
77 DISALLOW_COPY_AND_ASSIGN(CommandBufferDriver); | 83 DISALLOW_COPY_AND_ASSIGN(CommandBufferDriver); |
78 }; | 84 }; |
79 | 85 |
80 } // namespace mojo | 86 } // namespace mojo |
81 | 87 |
82 #endif // MOJO_SERVICES_GLES2_COMMAND_BUFFER_DRIVER_H_ | 88 #endif // MOJO_SERVICES_GLES2_COMMAND_BUFFER_DRIVER_H_ |
OLD | NEW |