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

Side by Side Diff: mojo/services/gfx/composition/cpp/frame_tracker.h

Issue 1943153002: Mozart: Move frame lag compensation to new class. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 7 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
(Empty)
1 // Copyright 2016 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 MOJO_SERVICES_GFX_COMPOSITION_CPP_SCHEDULING_H_
6 #define MOJO_SERVICES_GFX_COMPOSITION_CPP_SCHEDULING_H_
7
8 #include "mojo/services/gfx/composition/interfaces/scheduling.mojom.h"
9
10 namespace mojo {
11 namespace gfx {
12 namespace composition {
13
14 // Tracks frame scheduling information.
15 class FrameTracker {
16 public:
17 FrameTracker();
18 ~FrameTracker();
19
20 // Returns the number of frames that have been tracked.
21 uint64_t frame_count() const { return frame_count_; }
22
23 // Returns the current frame info.
24 // This value is not meaningful when |frame_count()| is zero.
25 const mojo::gfx::composition::FrameInfo& frame_info() const {
26 return frame_info_;
27 }
28
29 // Clears the frame tracker's state such that the next update will be
30 // treated as if it were the first.
31 void Clear();
32
33 // Updates |frame_info()| with new frame scheduling information
34 // from |raw_frame_info| and applies compensation for lag.
35 //
36 // |now| should come from a recent call to |mojo::GetTimeTicksNow()|.
37 //
38 // Whenever an application receives new frame scheduling information from the
39 // system, it should call this function before using it.
40 //
41 // Returns the time delta between the previous frame and the current frame
42 // in microseconds, or 0 if this is the first frame.
43 uint64_t Update(const mojo::gfx::composition::FrameInfo& raw_frame_info,
44 MojoTimeTicks now);
45
46 private:
47 uint64_t frame_count_ = 0u;
48 mojo::gfx::composition::FrameInfo frame_info_;
49
50 MOJO_DISALLOW_COPY_AND_ASSIGN(FrameTracker);
51 };
52
53 } // namespace composition
54 } // namespace gfx
55 } // namespace mojo
56
57 #endif // MOJO_SERVICES_GFX_COMPOSITION_CPP_SCHEDULING_H_
OLDNEW
« no previous file with comments | « mojo/services/gfx/composition/cpp/BUILD.gn ('k') | mojo/services/gfx/composition/cpp/frame_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698