OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 int commands_per_update); | 56 int commands_per_update); |
57 | 57 |
58 virtual ~GpuScheduler(); | 58 virtual ~GpuScheduler(); |
59 | 59 |
60 // Perform platform specific and common initialization. | 60 // Perform platform specific and common initialization. |
61 bool Initialize(gfx::PluginWindowHandle hwnd, | 61 bool Initialize(gfx::PluginWindowHandle hwnd, |
62 const gfx::Size& size, | 62 const gfx::Size& size, |
63 const gles2::DisallowedExtensions& disallowed_extensions, | 63 const gles2::DisallowedExtensions& disallowed_extensions, |
64 const char* allowed_extensions, | 64 const char* allowed_extensions, |
65 const std::vector<int32>& attribs, | 65 const std::vector<int32>& attribs, |
66 GpuScheduler* parent, | |
67 uint32 parent_texture_id, | |
68 gfx::GLShareGroup* share_group); | 66 gfx::GLShareGroup* share_group); |
69 | 67 |
70 void Destroy(); | 68 void Destroy(); |
71 void DestroyCommon(); | 69 void DestroyCommon(); |
72 | 70 |
| 71 bool SetParent(GpuScheduler* parent_scheduler, uint32 parent_texture_id); |
| 72 |
73 void PutChanged(bool sync); | 73 void PutChanged(bool sync); |
74 | 74 |
75 // Sets whether commands should be processed by this scheduler. Setting to | 75 // Sets whether commands should be processed by this scheduler. Setting to |
76 // false unschedules. Setting to true reschedules. Whether or not the | 76 // false unschedules. Setting to true reschedules. Whether or not the |
77 // scheduler is currently scheduled is "reference counted". Every call with | 77 // scheduler is currently scheduled is "reference counted". Every call with |
78 // false must eventually be paired by a call with true. | 78 // false must eventually be paired by a call with true. |
79 void SetScheduled(bool is_scheduled); | 79 void SetScheduled(bool is_scheduled); |
80 | 80 |
81 // Returns whether the scheduler is currently scheduled to process commands. | 81 // Returns whether the scheduler is currently scheduled to process commands. |
82 bool IsScheduled(); | 82 bool IsScheduled(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 gles2::GLES2Decoder* decoder() const { return decoder_.get(); } | 145 gles2::GLES2Decoder* decoder() const { return decoder_.get(); } |
146 | 146 |
147 protected: | 147 protected: |
148 // Perform common initialization. Takes ownership of GLSurface and GLContext. | 148 // Perform common initialization. Takes ownership of GLSurface and GLContext. |
149 bool InitializeCommon( | 149 bool InitializeCommon( |
150 const scoped_refptr<gfx::GLSurface>& surface, | 150 const scoped_refptr<gfx::GLSurface>& surface, |
151 const scoped_refptr<gfx::GLContext>& context, | 151 const scoped_refptr<gfx::GLContext>& context, |
152 const gfx::Size& size, | 152 const gfx::Size& size, |
153 const gles2::DisallowedExtensions& disallowed_extensions, | 153 const gles2::DisallowedExtensions& disallowed_extensions, |
154 const char* allowed_extensions, | 154 const char* allowed_extensions, |
155 const std::vector<int32>& attribs, | 155 const std::vector<int32>& attribs); |
156 gles2::GLES2Decoder* parent_decoder, | |
157 uint32 parent_texture_id); | |
158 | 156 |
159 | 157 |
160 private: | 158 private: |
161 // Helper which causes a call to ProcessCommands to be scheduled later. | 159 // Helper which causes a call to ProcessCommands to be scheduled later. |
162 void ScheduleProcessCommands(); | 160 void ScheduleProcessCommands(); |
163 | 161 |
164 // Called via a callback just before we are supposed to call the | 162 // Called via a callback just before we are supposed to call the |
165 // user's resize callback. | 163 // user's resize callback. |
166 void WillResize(gfx::Size size); | 164 void WillResize(gfx::Size size); |
167 | 165 |
(...skipping 25 matching lines...) Expand all Loading... |
193 | 191 |
194 ScopedRunnableMethodFactory<GpuScheduler> method_factory_; | 192 ScopedRunnableMethodFactory<GpuScheduler> method_factory_; |
195 scoped_ptr<Callback1<gfx::Size>::Type> wrapped_resize_callback_; | 193 scoped_ptr<Callback1<gfx::Size>::Type> wrapped_resize_callback_; |
196 scoped_ptr<Callback0::Type> wrapped_swap_buffers_callback_; | 194 scoped_ptr<Callback0::Type> wrapped_swap_buffers_callback_; |
197 scoped_ptr<Callback0::Type> command_processed_callback_; | 195 scoped_ptr<Callback0::Type> command_processed_callback_; |
198 }; | 196 }; |
199 | 197 |
200 } // namespace gpu | 198 } // namespace gpu |
201 | 199 |
202 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ | 200 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ |
OLD | NEW |