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" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
14 #include "components/view_manager/public/interfaces/command_buffer.mojom.h" | 14 #include "components/view_manager/public/interfaces/command_buffer.mojom.h" |
15 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
17 | 17 |
18 namespace gpu { | 18 namespace gpu { |
19 class CommandBufferService; | 19 class CommandBufferService; |
20 class GpuScheduler; | 20 class GpuScheduler; |
21 class GpuControlService; | 21 class GpuControlService; |
22 class SyncPointManager; | |
23 namespace gles2 { | 22 namespace gles2 { |
24 class GLES2Decoder; | 23 class GLES2Decoder; |
25 class MailboxManager; | |
26 } | 24 } |
27 } | 25 } |
28 | 26 |
29 namespace gfx { | 27 namespace gfx { |
30 class GLContext; | 28 class GLContext; |
31 class GLShareGroup; | |
32 class GLSurface; | 29 class GLSurface; |
33 } | 30 } |
34 | 31 |
35 namespace gles2 { | 32 namespace gles2 { |
36 | 33 |
| 34 class GpuState; |
| 35 |
37 // 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 |
38 // viewport. | 37 // viewport. |
39 class CommandBufferDriver { | 38 class CommandBufferDriver { |
40 public: | 39 public: |
41 class Client { | 40 class Client { |
42 public: | 41 public: |
43 virtual ~Client(); | 42 virtual ~Client(); |
44 virtual void UpdateVSyncParameters(base::TimeTicks timebase, | 43 virtual void UpdateVSyncParameters(base::TimeTicks timebase, |
45 base::TimeDelta interval) = 0; | 44 base::TimeDelta interval) = 0; |
46 virtual void DidLoseContext() = 0; | 45 virtual void DidLoseContext() = 0; |
47 }; | 46 }; |
48 // Offscreen. | 47 // Offscreen. |
49 CommandBufferDriver(gfx::GLShareGroup* share_group, | 48 explicit CommandBufferDriver(scoped_refptr<GpuState> gpu_state); |
50 gpu::gles2::MailboxManager* mailbox_manager, | 49 |
51 gpu::SyncPointManager* sync_point_manager); | |
52 // Onscreen. | 50 // Onscreen. |
53 CommandBufferDriver( | 51 CommandBufferDriver( |
54 gfx::AcceleratedWidget widget, | 52 gfx::AcceleratedWidget widget, |
55 gfx::GLShareGroup* share_group, | 53 scoped_refptr<GpuState> gpu_state, |
56 gpu::gles2::MailboxManager* mailbox_manager, | |
57 gpu::SyncPointManager* sync_point_manager, | |
58 const base::Callback<void(CommandBufferDriver*)>& destruct_callback); | 54 const base::Callback<void(CommandBufferDriver*)>& destruct_callback); |
59 ~CommandBufferDriver(); | 55 ~CommandBufferDriver(); |
60 | 56 |
61 void set_client(scoped_ptr<Client> client) { client_ = client.Pass(); } | 57 void set_client(scoped_ptr<Client> client) { client_ = client.Pass(); } |
62 | 58 |
63 void Initialize(mojo::CommandBufferSyncClientPtr sync_client, | 59 void Initialize(mojo::CommandBufferSyncClientPtr sync_client, |
64 mojo::CommandBufferLostContextObserverPtr loss_observer, | 60 mojo::CommandBufferLostContextObserverPtr loss_observer, |
65 mojo::ScopedSharedBufferHandle shared_state); | 61 mojo::ScopedSharedBufferHandle shared_state); |
66 void SetGetBuffer(int32_t buffer); | 62 void SetGetBuffer(int32_t buffer); |
67 void Flush(int32_t put_offset); | 63 void Flush(int32_t put_offset); |
(...skipping 29 matching lines...) Expand all Loading... |
97 | 93 |
98 scoped_ptr<Client> client_; | 94 scoped_ptr<Client> client_; |
99 mojo::CommandBufferSyncClientPtr sync_client_; | 95 mojo::CommandBufferSyncClientPtr sync_client_; |
100 mojo::CommandBufferLostContextObserverPtr loss_observer_; | 96 mojo::CommandBufferLostContextObserverPtr loss_observer_; |
101 gfx::AcceleratedWidget widget_; | 97 gfx::AcceleratedWidget widget_; |
102 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 98 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
103 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 99 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
104 scoped_ptr<gpu::GpuScheduler> scheduler_; | 100 scoped_ptr<gpu::GpuScheduler> scheduler_; |
105 scoped_refptr<gfx::GLContext> context_; | 101 scoped_refptr<gfx::GLContext> context_; |
106 scoped_refptr<gfx::GLSurface> surface_; | 102 scoped_refptr<gfx::GLSurface> surface_; |
107 scoped_refptr<gfx::GLShareGroup> share_group_; | 103 scoped_refptr<GpuState> gpu_state_; |
108 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; | |
109 scoped_refptr<gpu::SyncPointManager> sync_point_manager_; | |
110 | 104 |
111 scoped_refptr<base::SingleThreadTaskRunner> context_lost_task_runner_; | 105 scoped_refptr<base::SingleThreadTaskRunner> context_lost_task_runner_; |
112 base::Callback<void(int32_t)> context_lost_callback_; | 106 base::Callback<void(int32_t)> context_lost_callback_; |
113 | 107 |
114 base::Callback<void(CommandBufferDriver*)> destruct_callback_; | 108 base::Callback<void(CommandBufferDriver*)> destruct_callback_; |
115 | 109 |
116 base::WeakPtrFactory<CommandBufferDriver> weak_factory_; | 110 base::WeakPtrFactory<CommandBufferDriver> weak_factory_; |
117 | 111 |
118 DISALLOW_COPY_AND_ASSIGN(CommandBufferDriver); | 112 DISALLOW_COPY_AND_ASSIGN(CommandBufferDriver); |
119 }; | 113 }; |
120 | 114 |
121 } // namespace gles2 | 115 } // namespace gles2 |
122 | 116 |
123 #endif // COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_ | 117 #endif // COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_ |
OLD | NEW |