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

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

Issue 1841083007: Remove SendBeginFramesToChildren plumbing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scheduler_output_surface_client_set_beginframesource
Patch Set: Remove some comments Created 4 years, 8 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
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 explicit CompositorLock(Compositor* compositor); 139 explicit CompositorLock(Compositor* compositor);
140 ~CompositorLock(); 140 ~CompositorLock();
141 141
142 void CancelLock(); 142 void CancelLock();
143 143
144 Compositor* compositor_; 144 Compositor* compositor_;
145 DISALLOW_COPY_AND_ASSIGN(CompositorLock); 145 DISALLOW_COPY_AND_ASSIGN(CompositorLock);
146 }; 146 };
147 147
148 // This class observes BeginFrame notification from LayerTreeHost.
149 class COMPOSITOR_EXPORT CompositorBeginFrameObserver {
150 public:
151 virtual ~CompositorBeginFrameObserver() {}
152 virtual void OnSendBeginFrame(const cc::BeginFrameArgs& args) = 0;
153 };
154
155 // Compositor object to take care of GPU painting. 148 // Compositor object to take care of GPU painting.
156 // A Browser compositor object is responsible for generating the final 149 // A Browser compositor object is responsible for generating the final
157 // displayable form of pixels comprising a single widget's contents. It draws an 150 // displayable form of pixels comprising a single widget's contents. It draws an
158 // appropriately transformed texture for each transformed view in the widget's 151 // appropriately transformed texture for each transformed view in the widget's
159 // view hierarchy. 152 // view hierarchy.
160 class COMPOSITOR_EXPORT Compositor 153 class COMPOSITOR_EXPORT Compositor
161 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), 154 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient),
162 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) { 155 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient) {
163 public: 156 public:
164 Compositor(ui::ContextFactory* context_factory, 157 Compositor(ui::ContextFactory* context_factory,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // Compositor does not own observers. It is the responsibility of the 247 // Compositor does not own observers. It is the responsibility of the
255 // observer to remove itself when it is done observing. 248 // observer to remove itself when it is done observing.
256 void AddObserver(CompositorObserver* observer); 249 void AddObserver(CompositorObserver* observer);
257 void RemoveObserver(CompositorObserver* observer); 250 void RemoveObserver(CompositorObserver* observer);
258 bool HasObserver(const CompositorObserver* observer) const; 251 bool HasObserver(const CompositorObserver* observer) const;
259 252
260 void AddAnimationObserver(CompositorAnimationObserver* observer); 253 void AddAnimationObserver(CompositorAnimationObserver* observer);
261 void RemoveAnimationObserver(CompositorAnimationObserver* observer); 254 void RemoveAnimationObserver(CompositorAnimationObserver* observer);
262 bool HasAnimationObserver(const CompositorAnimationObserver* observer) const; 255 bool HasAnimationObserver(const CompositorAnimationObserver* observer) const;
263 256
264 void AddBeginFrameObserver(CompositorBeginFrameObserver* observer);
265 void RemoveBeginFrameObserver(CompositorBeginFrameObserver* observer);
266
267 // Change the timeout behavior for all future locks that are created. Locks 257 // Change the timeout behavior for all future locks that are created. Locks
268 // should time out if there is an expectation that the compositor will be 258 // should time out if there is an expectation that the compositor will be
269 // responsive. 259 // responsive.
270 void SetLocksWillTimeOut(bool locks_will_time_out) { 260 void SetLocksWillTimeOut(bool locks_will_time_out) {
271 locks_will_time_out_ = locks_will_time_out; 261 locks_will_time_out_ = locks_will_time_out;
272 } 262 }
273 263
274 // Creates a compositor lock. Returns NULL if it is not possible to lock at 264 // Creates a compositor lock. Returns NULL if it is not possible to lock at
275 // this time (i.e. we're waiting to complete a previous unlock). 265 // this time (i.e. we're waiting to complete a previous unlock).
276 scoped_refptr<CompositorLock> GetCompositorLock(); 266 scoped_refptr<CompositorLock> GetCompositorLock();
(...skipping 22 matching lines...) Expand all
299 float page_scale, 289 float page_scale,
300 float top_controls_delta) override {} 290 float top_controls_delta) override {}
301 void RequestNewOutputSurface() override; 291 void RequestNewOutputSurface() override;
302 void DidInitializeOutputSurface() override; 292 void DidInitializeOutputSurface() override;
303 void DidFailToInitializeOutputSurface() override; 293 void DidFailToInitializeOutputSurface() override;
304 void WillCommit() override {} 294 void WillCommit() override {}
305 void DidCommit() override; 295 void DidCommit() override;
306 void DidCommitAndDrawFrame() override; 296 void DidCommitAndDrawFrame() override;
307 void DidCompleteSwapBuffers() override; 297 void DidCompleteSwapBuffers() override;
308 void DidCompletePageScaleAnimation() override {} 298 void DidCompletePageScaleAnimation() override {}
309 void SendBeginFramesToChildren(const cc::BeginFrameArgs& args) override;
310 void RecordFrameTimingEvents( 299 void RecordFrameTimingEvents(
311 scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events, 300 scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events,
312 scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events) 301 scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events)
313 override {} 302 override {}
314 303
315 // cc::LayerTreeHostSingleThreadClient implementation. 304 // cc::LayerTreeHostSingleThreadClient implementation.
316 void DidPostSwapBuffers() override; 305 void DidPostSwapBuffers() override;
317 void DidAbortSwapBuffers() override; 306 void DidAbortSwapBuffers() override;
318 307
319 bool IsLocked() { return compositor_lock_ != NULL; } 308 bool IsLocked() { return compositor_lock_ != NULL; }
(...skipping 24 matching lines...) Expand all
344 333
345 gfx::Size size_; 334 gfx::Size size_;
346 335
347 ui::ContextFactory* context_factory_; 336 ui::ContextFactory* context_factory_;
348 337
349 // The root of the Layer tree drawn by this compositor. 338 // The root of the Layer tree drawn by this compositor.
350 Layer* root_layer_; 339 Layer* root_layer_;
351 340
352 base::ObserverList<CompositorObserver, true> observer_list_; 341 base::ObserverList<CompositorObserver, true> observer_list_;
353 base::ObserverList<CompositorAnimationObserver> animation_observer_list_; 342 base::ObserverList<CompositorAnimationObserver> animation_observer_list_;
354 base::ObserverList<CompositorBeginFrameObserver, true>
355 begin_frame_observer_list_;
356 343
357 gfx::AcceleratedWidget widget_; 344 gfx::AcceleratedWidget widget_;
358 bool widget_valid_; 345 bool widget_valid_;
359 bool output_surface_requested_; 346 bool output_surface_requested_;
360 scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; 347 scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_;
361 scoped_refptr<cc::Layer> root_web_layer_; 348 scoped_refptr<cc::Layer> root_web_layer_;
362 scoped_ptr<cc::LayerTreeHost> host_; 349 scoped_ptr<cc::LayerTreeHost> host_;
363 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 350 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
364 351
365 // The manager of vsync parameters for this compositor. 352 // The manager of vsync parameters for this compositor.
366 scoped_refptr<CompositorVSyncManager> vsync_manager_; 353 scoped_refptr<CompositorVSyncManager> vsync_manager_;
367 354
368 // The device scale factor of the monitor that this compositor is compositing 355 // The device scale factor of the monitor that this compositor is compositing
369 // layers on. 356 // layers on.
370 float device_scale_factor_; 357 float device_scale_factor_;
371 358
372 int last_started_frame_; 359 int last_started_frame_;
373 int last_ended_frame_; 360 int last_ended_frame_;
374 361
375 bool locks_will_time_out_; 362 bool locks_will_time_out_;
376 CompositorLock* compositor_lock_; 363 CompositorLock* compositor_lock_;
377 364
378 LayerAnimatorCollection layer_animator_collection_; 365 LayerAnimatorCollection layer_animator_collection_;
379 scoped_refptr<cc::AnimationTimeline> animation_timeline_; 366 scoped_refptr<cc::AnimationTimeline> animation_timeline_;
380 367
381 // Used to send to any new CompositorBeginFrameObserver immediately.
382 cc::BeginFrameArgs missed_begin_frame_args_;
383
384 base::WeakPtrFactory<Compositor> weak_ptr_factory_; 368 base::WeakPtrFactory<Compositor> weak_ptr_factory_;
385 369
386 DISALLOW_COPY_AND_ASSIGN(Compositor); 370 DISALLOW_COPY_AND_ASSIGN(Compositor);
387 }; 371 };
388 372
389 } // namespace ui 373 } // namespace ui
390 374
391 #endif // UI_COMPOSITOR_COMPOSITOR_H_ 375 #endif // UI_COMPOSITOR_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698