compositor_observer.h revision eb525c5499e34cc9c4b825d6d9e75bb07cc06ace
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
3// found in the LICENSE file.
4
5#ifndef UI_COMPOSITOR_COMPOSITOR_OBSERVER_H_
6#define UI_COMPOSITOR_COMPOSITOR_OBSERVER_H_
7
8#include "base/time/time.h"
9#include "ui/compositor/compositor_export.h"
10
11namespace ui {
12
13class Compositor;
14
15// A compositor observer is notified when compositing completes.
16class COMPOSITOR_EXPORT CompositorObserver {
17 public:
18  // A commit proxies information from the main thread to the compositor
19  // thread. It typically happens when some state changes that will require a
20  // composite. In the multi-threaded case, many commits may happen between
21  // two successive composites. In the single-threaded, a single commit
22  // between two composites (just before the composite as part of the
23  // composite cycle). If the compositor is locked, it will not send this
24  // this signal.
25  virtual void OnCompositingDidCommit(Compositor* compositor) = 0;
26
27  // Called when compositing started: it has taken all the layer changes into
28  // account and has issued the graphics commands.
29  virtual void OnCompositingStarted(Compositor* compositor,
30                                    base::TimeTicks start_time) = 0;
31
32  // Called when compositing completes: the present to screen has completed.
33  virtual void OnCompositingEnded(Compositor* compositor) = 0;
34
35  // Called when compositing is aborted (e.g. lost graphics context).
36  virtual void OnCompositingAborted(Compositor* compositor) = 0;
37
38  // Called when the compositor lock state changes.
39  virtual void OnCompositingLockStateChanged(Compositor* compositor) = 0;
40
41  // Called when the compositor has received updated VSync parameters.
42  virtual void OnUpdateVSyncParameters(Compositor* compositor,
43                                       base::TimeTicks timebase,
44                                       base::TimeDelta interval) = 0;
45
46 protected:
47  virtual ~CompositorObserver() {}
48};
49
50}  // namespace ui
51
52#endif  // UI_COMPOSITOR_COMPOSITOR_OBSERVER_H_
53