Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: ui/compositor/compositor.h

Issue 134623005: Make SingleThreadProxy a SchedulerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <string> 8 #include <string>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "cc/trees/layer_tree_host_client.h" 15 #include "cc/trees/layer_tree_host_client.h"
16 #include "cc/trees/layer_tree_host_single_thread_client.h" 16 #include "cc/trees/layer_tree_host_single_thread_client.h"
17 #include "third_party/skia/include/core/SkColor.h" 17 #include "third_party/skia/include/core/SkColor.h"
18 #include "ui/compositor/compositor_export.h" 18 #include "ui/compositor/compositor_export.h"
19 #include "ui/compositor/compositor_observer.h" 19 #include "ui/compositor/compositor_observer.h"
20 #include "ui/compositor/layer_animator_collection.h" 20 #include "ui/compositor/layer_animator_collection.h"
21 #include "ui/gfx/native_widget_types.h" 21 #include "ui/gfx/native_widget_types.h"
22 #include "ui/gfx/size.h" 22 #include "ui/gfx/size.h"
23 #include "ui/gfx/vector2d.h" 23 #include "ui/gfx/vector2d.h"
24 24
25 class SkBitmap;
26
27 namespace base { 25 namespace base {
28 class MessageLoopProxy; 26 class MessageLoopProxy;
29 class RunLoop; 27 class RunLoop;
30 } 28 }
31 29
32 namespace cc { 30 namespace cc {
33 class ContextProvider; 31 class ContextProvider;
34 class Layer; 32 class Layer;
35 class LayerTreeDebugState; 33 class LayerTreeDebugState;
36 class LayerTreeHost; 34 class LayerTreeHost;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 148
151 // Called when we need the compositor to preserve the alpha channel in the 149 // Called when we need the compositor to preserve the alpha channel in the
152 // output for situations when we want to render transparently atop something 150 // output for situations when we want to render transparently atop something
153 // else, e.g. Aero glass. 151 // else, e.g. Aero glass.
154 void SetHostHasTransparentBackground(bool host_has_transparent_background); 152 void SetHostHasTransparentBackground(bool host_has_transparent_background);
155 153
156 // The scale factor of the device that this compositor is 154 // The scale factor of the device that this compositor is
157 // compositing layers on. 155 // compositing layers on.
158 float device_scale_factor() const { return device_scale_factor_; } 156 float device_scale_factor() const { return device_scale_factor_; }
159 157
160 // Draws the scene created by the layer tree and any visual effects.
161 void Draw();
162
163 // Where possible, draws are scissored to a damage region calculated from 158 // Where possible, draws are scissored to a damage region calculated from
164 // changes to layer properties. This bypasses that and indicates that 159 // changes to layer properties. This bypasses that and indicates that
165 // the whole frame needs to be drawn. 160 // the whole frame needs to be drawn.
166 void ScheduleFullRedraw(); 161 void ScheduleFullRedraw();
167 162
168 // Schedule redraw and append damage_rect to the damage region calculated 163 // Schedule redraw and append damage_rect to the damage region calculated
169 // from changes to layer properties. 164 // from changes to layer properties.
170 void ScheduleRedrawRect(const gfx::Rect& damage_rect); 165 void ScheduleRedrawRect(const gfx::Rect& damage_rect);
171 166
172 // Finishes all outstanding rendering on the GPU. 167 // Finishes all outstanding rendering on the GPU.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 private: 246 private:
252 friend class base::RefCounted<Compositor>; 247 friend class base::RefCounted<Compositor>;
253 friend class CompositorLock; 248 friend class CompositorLock;
254 249
255 // Called by CompositorLock. 250 // Called by CompositorLock.
256 void UnlockCompositor(); 251 void UnlockCompositor();
257 252
258 // Called to release any pending CompositorLock 253 // Called to release any pending CompositorLock
259 void CancelCompositorLock(); 254 void CancelCompositorLock();
260 255
261 // Notifies the compositor that compositing is complete.
262 void NotifyEnd();
263
264 gfx::Size size_; 256 gfx::Size size_;
265 257
266 ui::ContextFactory* context_factory_; 258 ui::ContextFactory* context_factory_;
267 259
268 // The root of the Layer tree drawn by this compositor. 260 // The root of the Layer tree drawn by this compositor.
269 Layer* root_layer_; 261 Layer* root_layer_;
270 262
271 ObserverList<CompositorObserver> observer_list_; 263 ObserverList<CompositorObserver> observer_list_;
272 264
273 gfx::AcceleratedWidget widget_; 265 gfx::AcceleratedWidget widget_;
274 scoped_refptr<cc::Layer> root_web_layer_; 266 scoped_refptr<cc::Layer> root_web_layer_;
275 scoped_ptr<cc::LayerTreeHost> host_; 267 scoped_ptr<cc::LayerTreeHost> host_;
276 scoped_refptr<base::MessageLoopProxy> compositor_thread_loop_; 268 scoped_refptr<base::MessageLoopProxy> compositor_thread_loop_;
277 269
278 // The manager of vsync parameters for this compositor. 270 // The manager of vsync parameters for this compositor.
279 scoped_refptr<CompositorVSyncManager> vsync_manager_; 271 scoped_refptr<CompositorVSyncManager> vsync_manager_;
280 272
281 // The device scale factor of the monitor that this compositor is compositing 273 // The device scale factor of the monitor that this compositor is compositing
282 // layers on. 274 // layers on.
283 float device_scale_factor_; 275 float device_scale_factor_;
284 276
285 int last_started_frame_; 277 int last_started_frame_;
286 int last_ended_frame_; 278 int last_ended_frame_;
287 279
288 bool disable_schedule_composite_; 280 bool disable_schedule_composite_;
289 281
290 CompositorLock* compositor_lock_; 282 CompositorLock* compositor_lock_;
291 283
292 // Prevent more than one draw from being scheduled.
293 bool defer_draw_scheduling_;
294
295 // Used to prevent Draw()s while a composite is in progress.
296 bool waiting_on_compositing_end_;
297 bool draw_on_compositing_end_;
298 enum SwapState { SWAP_NONE, SWAP_POSTED, SWAP_COMPLETED };
299 SwapState swap_state_;
300
301 LayerAnimatorCollection layer_animator_collection_; 284 LayerAnimatorCollection layer_animator_collection_;
302 285
303 base::WeakPtrFactory<Compositor> schedule_draw_factory_; 286 base::WeakPtrFactory<Compositor> schedule_draw_factory_;
304 287
305 DISALLOW_COPY_AND_ASSIGN(Compositor); 288 DISALLOW_COPY_AND_ASSIGN(Compositor);
306 }; 289 };
307 290
308 } // namespace ui 291 } // namespace ui
309 292
310 #endif // UI_COMPOSITOR_COMPOSITOR_H_ 293 #endif // UI_COMPOSITOR_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698