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

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

Issue 441343002: Revert 287747 "Make SingleThreadProxy a SchedulerClient" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 4 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/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "cc/trees/layer_tree_host_client.h" 16 #include "cc/trees/layer_tree_host_client.h"
17 #include "cc/trees/layer_tree_host_single_thread_client.h" 17 #include "cc/trees/layer_tree_host_single_thread_client.h"
18 #include "third_party/skia/include/core/SkColor.h" 18 #include "third_party/skia/include/core/SkColor.h"
19 #include "ui/compositor/compositor_animation_observer.h" 19 #include "ui/compositor/compositor_animation_observer.h"
20 #include "ui/compositor/compositor_export.h" 20 #include "ui/compositor/compositor_export.h"
21 #include "ui/compositor/compositor_observer.h" 21 #include "ui/compositor/compositor_observer.h"
22 #include "ui/compositor/layer_animator_collection.h" 22 #include "ui/compositor/layer_animator_collection.h"
23 #include "ui/gfx/native_widget_types.h" 23 #include "ui/gfx/native_widget_types.h"
24 #include "ui/gfx/size.h" 24 #include "ui/gfx/size.h"
25 #include "ui/gfx/vector2d.h" 25 #include "ui/gfx/vector2d.h"
26 26
27 class SkBitmap;
28
27 namespace base { 29 namespace base {
28 class MessageLoopProxy; 30 class MessageLoopProxy;
29 class RunLoop; 31 class RunLoop;
30 } 32 }
31 33
32 namespace cc { 34 namespace cc {
33 class ContextProvider; 35 class ContextProvider;
34 class Layer; 36 class Layer;
35 class LayerTreeDebugState; 37 class LayerTreeDebugState;
36 class LayerTreeHost; 38 class LayerTreeHost;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 152
151 // Called when we need the compositor to preserve the alpha channel in the 153 // 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 154 // output for situations when we want to render transparently atop something
153 // else, e.g. Aero glass. 155 // else, e.g. Aero glass.
154 void SetHostHasTransparentBackground(bool host_has_transparent_background); 156 void SetHostHasTransparentBackground(bool host_has_transparent_background);
155 157
156 // The scale factor of the device that this compositor is 158 // The scale factor of the device that this compositor is
157 // compositing layers on. 159 // compositing layers on.
158 float device_scale_factor() const { return device_scale_factor_; } 160 float device_scale_factor() const { return device_scale_factor_; }
159 161
162 // Draws the scene created by the layer tree and any visual effects.
163 void Draw();
164
160 // Where possible, draws are scissored to a damage region calculated from 165 // Where possible, draws are scissored to a damage region calculated from
161 // changes to layer properties. This bypasses that and indicates that 166 // changes to layer properties. This bypasses that and indicates that
162 // the whole frame needs to be drawn. 167 // the whole frame needs to be drawn.
163 void ScheduleFullRedraw(); 168 void ScheduleFullRedraw();
164 169
165 // Schedule redraw and append damage_rect to the damage region calculated 170 // Schedule redraw and append damage_rect to the damage region calculated
166 // from changes to layer properties. 171 // from changes to layer properties.
167 void ScheduleRedrawRect(const gfx::Rect& damage_rect); 172 void ScheduleRedrawRect(const gfx::Rect& damage_rect);
168 173
169 // Finishes all outstanding rendering on the GPU. 174 // Finishes all outstanding rendering on the GPU.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 float page_scale) OVERRIDE {} 227 float page_scale) OVERRIDE {}
223 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback) 228 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback)
224 OVERRIDE; 229 OVERRIDE;
225 virtual void DidInitializeOutputSurface() OVERRIDE {} 230 virtual void DidInitializeOutputSurface() OVERRIDE {}
226 virtual void WillCommit() OVERRIDE {} 231 virtual void WillCommit() OVERRIDE {}
227 virtual void DidCommit() OVERRIDE; 232 virtual void DidCommit() OVERRIDE;
228 virtual void DidCommitAndDrawFrame() OVERRIDE; 233 virtual void DidCommitAndDrawFrame() OVERRIDE;
229 virtual void DidCompleteSwapBuffers() OVERRIDE; 234 virtual void DidCompleteSwapBuffers() OVERRIDE;
230 235
231 // cc::LayerTreeHostSingleThreadClient implementation. 236 // cc::LayerTreeHostSingleThreadClient implementation.
237 virtual void ScheduleComposite() OVERRIDE;
238 virtual void ScheduleAnimation() OVERRIDE;
232 virtual void DidPostSwapBuffers() OVERRIDE; 239 virtual void DidPostSwapBuffers() OVERRIDE;
233 virtual void DidAbortSwapBuffers() OVERRIDE; 240 virtual void DidAbortSwapBuffers() OVERRIDE;
234 241
242 int last_started_frame() { return last_started_frame_; }
243 int last_ended_frame() { return last_ended_frame_; }
244
235 bool IsLocked() { return compositor_lock_ != NULL; } 245 bool IsLocked() { return compositor_lock_ != NULL; }
236 246
237 const cc::LayerTreeDebugState& GetLayerTreeDebugState() const; 247 const cc::LayerTreeDebugState& GetLayerTreeDebugState() const;
238 void SetLayerTreeDebugState(const cc::LayerTreeDebugState& debug_state); 248 void SetLayerTreeDebugState(const cc::LayerTreeDebugState& debug_state);
239 249
240 LayerAnimatorCollection* layer_animator_collection() { 250 LayerAnimatorCollection* layer_animator_collection() {
241 return &layer_animator_collection_; 251 return &layer_animator_collection_;
242 } 252 }
243 253
244 private: 254 private:
245 friend class base::RefCounted<Compositor>; 255 friend class base::RefCounted<Compositor>;
246 friend class CompositorLock; 256 friend class CompositorLock;
247 257
248 // Called by CompositorLock. 258 // Called by CompositorLock.
249 void UnlockCompositor(); 259 void UnlockCompositor();
250 260
251 // Called to release any pending CompositorLock 261 // Called to release any pending CompositorLock
252 void CancelCompositorLock(); 262 void CancelCompositorLock();
253 263
264 // Notifies the compositor that compositing is complete.
265 void NotifyEnd();
266
254 gfx::Size size_; 267 gfx::Size size_;
255 268
256 ui::ContextFactory* context_factory_; 269 ui::ContextFactory* context_factory_;
257 270
258 // The root of the Layer tree drawn by this compositor. 271 // The root of the Layer tree drawn by this compositor.
259 Layer* root_layer_; 272 Layer* root_layer_;
260 273
261 ObserverList<CompositorObserver> observer_list_; 274 ObserverList<CompositorObserver> observer_list_;
262 ObserverList<CompositorAnimationObserver> animation_observer_list_; 275 ObserverList<CompositorAnimationObserver> animation_observer_list_;
263 276
(...skipping 10 matching lines...) Expand all
274 // layers on. 287 // layers on.
275 float device_scale_factor_; 288 float device_scale_factor_;
276 289
277 int last_started_frame_; 290 int last_started_frame_;
278 int last_ended_frame_; 291 int last_ended_frame_;
279 292
280 bool disable_schedule_composite_; 293 bool disable_schedule_composite_;
281 294
282 CompositorLock* compositor_lock_; 295 CompositorLock* compositor_lock_;
283 296
297 // Prevent more than one draw from being scheduled.
298 bool defer_draw_scheduling_;
299
300 // Used to prevent Draw()s while a composite is in progress.
301 bool waiting_on_compositing_end_;
302 bool draw_on_compositing_end_;
303 enum SwapState { SWAP_NONE, SWAP_POSTED, SWAP_COMPLETED };
304 SwapState swap_state_;
305
284 LayerAnimatorCollection layer_animator_collection_; 306 LayerAnimatorCollection layer_animator_collection_;
285 307
308 base::WeakPtrFactory<Compositor> schedule_draw_factory_;
309
286 DISALLOW_COPY_AND_ASSIGN(Compositor); 310 DISALLOW_COPY_AND_ASSIGN(Compositor);
287 }; 311 };
288 312
289 } // namespace ui 313 } // namespace ui
290 314
291 #endif // UI_COMPOSITOR_COMPOSITOR_H_ 315 #endif // UI_COMPOSITOR_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « trunk/src/content/test/web_layer_tree_view_impl_for_testing.h ('k') | trunk/src/ui/compositor/compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698