OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_COMPOSITOR_COMPOSITOR_H_ | 5 #ifndef UI_COMPOSITOR_COMPOSITOR_H_ |
6 #define UI_COMPOSITOR_COMPOSITOR_H_ | 6 #define UI_COMPOSITOR_COMPOSITOR_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 // Compositor object to take care of GPU painting. | 152 // Compositor object to take care of GPU painting. |
153 // A Browser compositor object is responsible for generating the final | 153 // A Browser compositor object is responsible for generating the final |
154 // displayable form of pixels comprising a single widget's contents. It draws an | 154 // displayable form of pixels comprising a single widget's contents. It draws an |
155 // appropriately transformed texture for each transformed view in the widget's | 155 // appropriately transformed texture for each transformed view in the widget's |
156 // view hierarchy. | 156 // view hierarchy. |
157 class COMPOSITOR_EXPORT Compositor | 157 class COMPOSITOR_EXPORT Compositor |
158 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), | 158 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), |
159 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { | 159 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { |
160 public: | 160 public: |
161 Compositor(gfx::AcceleratedWidget widget, | 161 Compositor(ui::ContextFactory* context_factory, |
162 ui::ContextFactory* context_factory, | |
163 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 162 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
164 ~Compositor() override; | 163 ~Compositor() override; |
165 | 164 |
166 ui::ContextFactory* context_factory() { return context_factory_; } | 165 ui::ContextFactory* context_factory() { return context_factory_; } |
167 | 166 |
168 void SetOutputSurface(scoped_ptr<cc::OutputSurface> surface); | 167 void SetOutputSurface(scoped_ptr<cc::OutputSurface> surface); |
169 | 168 |
170 // Schedules a redraw of the layer tree associated with this compositor. | 169 // Schedules a redraw of the layer tree associated with this compositor. |
171 void ScheduleDraw(); | 170 void ScheduleDraw(); |
172 | 171 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 bool IsVisible(); | 222 bool IsVisible(); |
224 | 223 |
225 // The "authoritative" vsync interval, if provided, will override interval | 224 // The "authoritative" vsync interval, if provided, will override interval |
226 // reported from 3D context. This is typically the value reported by a more | 225 // reported from 3D context. This is typically the value reported by a more |
227 // reliable source, e.g, the platform display configuration. | 226 // reliable source, e.g, the platform display configuration. |
228 // In the particular case of ChromeOS -- this is the value queried through | 227 // In the particular case of ChromeOS -- this is the value queried through |
229 // XRandR, which is more reliable than the value queried through the 3D | 228 // XRandR, which is more reliable than the value queried through the 3D |
230 // context. | 229 // context. |
231 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval); | 230 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval); |
232 | 231 |
233 // Returns the widget for this compositor. | 232 // Sets and returns the widget for the compositor to render into. |
| 233 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); |
234 gfx::AcceleratedWidget widget() const { return widget_; } | 234 gfx::AcceleratedWidget widget() const { return widget_; } |
235 | 235 |
236 // Returns the vsync manager for this compositor. | 236 // Returns the vsync manager for this compositor. |
237 scoped_refptr<CompositorVSyncManager> vsync_manager() const; | 237 scoped_refptr<CompositorVSyncManager> vsync_manager() const; |
238 | 238 |
239 // Returns the main thread task runner this compositor uses. Users of the | 239 // Returns the main thread task runner this compositor uses. Users of the |
240 // compositor generally shouldn't use this. | 240 // compositor generally shouldn't use this. |
241 scoped_refptr<base::SingleThreadTaskRunner> task_runner() const { | 241 scoped_refptr<base::SingleThreadTaskRunner> task_runner() const { |
242 return task_runner_; | 242 return task_runner_; |
243 } | 243 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 cc::BeginFrameArgs missed_begin_frame_args_; | 367 cc::BeginFrameArgs missed_begin_frame_args_; |
368 | 368 |
369 base::WeakPtrFactory<Compositor> weak_ptr_factory_; | 369 base::WeakPtrFactory<Compositor> weak_ptr_factory_; |
370 | 370 |
371 DISALLOW_COPY_AND_ASSIGN(Compositor); | 371 DISALLOW_COPY_AND_ASSIGN(Compositor); |
372 }; | 372 }; |
373 | 373 |
374 } // namespace ui | 374 } // namespace ui |
375 | 375 |
376 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 376 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |