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

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: More danakj review Created 6 years, 10 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/gfx/native_widget_types.h" 20 #include "ui/gfx/native_widget_types.h"
21 #include "ui/gfx/size.h" 21 #include "ui/gfx/size.h"
22 #include "ui/gfx/vector2d.h" 22 #include "ui/gfx/vector2d.h"
23 23
24 class SkBitmap;
25
26 namespace base { 24 namespace base {
27 class MessageLoopProxy; 25 class MessageLoopProxy;
28 class RunLoop; 26 class RunLoop;
29 } 27 }
30 28
31 namespace cc { 29 namespace cc {
32 class ContextProvider; 30 class ContextProvider;
33 class Layer; 31 class Layer;
34 class LayerTreeDebugState; 32 class LayerTreeDebugState;
35 class LayerTreeHost; 33 class LayerTreeHost;
36 } 34 }
37 35
38 namespace gfx { 36 namespace gfx {
39 class Rect; 37 class Rect;
40 class Size; 38 class Size;
41 } 39 }
42 40
43 namespace gpu { 41 namespace gpu {
44 struct Mailbox; 42 struct Mailbox;
45 } 43 }
46 44
47 namespace ui { 45 namespace ui {
48 46
49 class Compositor; 47 class Compositor;
50 class CompositorVSyncManager; 48 class CompositorVSyncManager;
51 class Layer; 49 class Layer;
52 class PostedSwapQueue;
53 class Reflector; 50 class Reflector;
54 class Texture; 51 class Texture;
55 struct LatencyInfo; 52 struct LatencyInfo;
56 53
57 // This class abstracts the creation of the 3D context for the compositor. It is 54 // This class abstracts the creation of the 3D context for the compositor. It is
58 // a global object. 55 // a global object.
59 class COMPOSITOR_EXPORT ContextFactory { 56 class COMPOSITOR_EXPORT ContextFactory {
60 public: 57 public:
61 virtual ~ContextFactory() {} 58 virtual ~ContextFactory() {}
62 59
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 189
193 // Called when we need the compositor to preserve the alpha channel in the 190 // Called when we need the compositor to preserve the alpha channel in the
194 // output for situations when we want to render transparently atop something 191 // output for situations when we want to render transparently atop something
195 // else, e.g. Aero glass. 192 // else, e.g. Aero glass.
196 void SetHostHasTransparentBackground(bool host_has_transparent_background); 193 void SetHostHasTransparentBackground(bool host_has_transparent_background);
197 194
198 // The scale factor of the device that this compositor is 195 // The scale factor of the device that this compositor is
199 // compositing layers on. 196 // compositing layers on.
200 float device_scale_factor() const { return device_scale_factor_; } 197 float device_scale_factor() const { return device_scale_factor_; }
201 198
202 // Draws the scene created by the layer tree and any visual effects.
203 void Draw();
204
205 // Where possible, draws are scissored to a damage region calculated from 199 // Where possible, draws are scissored to a damage region calculated from
206 // changes to layer properties. This bypasses that and indicates that 200 // changes to layer properties. This bypasses that and indicates that
207 // the whole frame needs to be drawn. 201 // the whole frame needs to be drawn.
208 void ScheduleFullRedraw(); 202 void ScheduleFullRedraw();
209 203
210 // Schedule redraw and append damage_rect to the damage region calculated 204 // Schedule redraw and append damage_rect to the damage region calculated
211 // from changes to layer properties. 205 // from changes to layer properties.
212 void ScheduleRedrawRect(const gfx::Rect& damage_rect); 206 void ScheduleRedrawRect(const gfx::Rect& damage_rect);
213 207
214 void SetLatencyInfo(const LatencyInfo& latency_info); 208 void SetLatencyInfo(const LatencyInfo& latency_info);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 private: 279 private:
286 friend class base::RefCounted<Compositor>; 280 friend class base::RefCounted<Compositor>;
287 friend class CompositorLock; 281 friend class CompositorLock;
288 282
289 // Called by CompositorLock. 283 // Called by CompositorLock.
290 void UnlockCompositor(); 284 void UnlockCompositor();
291 285
292 // Called to release any pending CompositorLock 286 // Called to release any pending CompositorLock
293 void CancelCompositorLock(); 287 void CancelCompositorLock();
294 288
295 // Notifies the compositor that compositing is complete.
296 void NotifyEnd();
297
298 gfx::Size size_; 289 gfx::Size size_;
299 290
300 // The root of the Layer tree drawn by this compositor. 291 // The root of the Layer tree drawn by this compositor.
301 Layer* root_layer_; 292 Layer* root_layer_;
302 293
303 ObserverList<CompositorObserver> observer_list_; 294 ObserverList<CompositorObserver> observer_list_;
304 295
305 gfx::AcceleratedWidget widget_; 296 gfx::AcceleratedWidget widget_;
306 scoped_refptr<cc::Layer> root_web_layer_; 297 scoped_refptr<cc::Layer> root_web_layer_;
307 scoped_ptr<cc::LayerTreeHost> host_; 298 scoped_ptr<cc::LayerTreeHost> host_;
308 299
309 // The manager of vsync parameters for this compositor. 300 // The manager of vsync parameters for this compositor.
310 scoped_refptr<CompositorVSyncManager> vsync_manager_; 301 scoped_refptr<CompositorVSyncManager> vsync_manager_;
311 302
312 // Used to verify that we have at most one draw swap in flight.
313 scoped_ptr<PostedSwapQueue> posted_swaps_;
314
315 // The device scale factor of the monitor that this compositor is compositing 303 // The device scale factor of the monitor that this compositor is compositing
316 // layers on. 304 // layers on.
317 float device_scale_factor_; 305 float device_scale_factor_;
318 306
319 int last_started_frame_; 307 int last_started_frame_;
320 int last_ended_frame_; 308 int last_ended_frame_;
321 309
322 bool next_draw_is_resize_;
323
324 bool disable_schedule_composite_; 310 bool disable_schedule_composite_;
325 311
326 CompositorLock* compositor_lock_; 312 CompositorLock* compositor_lock_;
327 313
328 // Prevent more than one draw from being scheduled.
329 bool defer_draw_scheduling_;
330
331 // Used to prevent Draw()s while a composite is in progress.
332 bool waiting_on_compositing_end_;
333 bool draw_on_compositing_end_;
334
335 base::WeakPtrFactory<Compositor> schedule_draw_factory_; 314 base::WeakPtrFactory<Compositor> schedule_draw_factory_;
336 315
337 DISALLOW_COPY_AND_ASSIGN(Compositor); 316 DISALLOW_COPY_AND_ASSIGN(Compositor);
338 }; 317 };
339 318
340 } // namespace ui 319 } // namespace ui
341 320
342 #endif // UI_COMPOSITOR_COMPOSITOR_H_ 321 #endif // UI_COMPOSITOR_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698