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

Side by Side Diff: cc/trees/frame_rate_counter.h

Issue 2804943003: [vr] Add a frame rate counter for the vr UI (Closed)
Patch Set: rebase for real Created 3 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 CC_TREES_FRAME_RATE_COUNTER_H_ 5 #ifndef CC_TREES_FRAME_RATE_COUNTER_H_
6 #define CC_TREES_FRAME_RATE_COUNTER_H_ 6 #define CC_TREES_FRAME_RATE_COUNTER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "cc/base/ring_buffer.h" 14 #include "cc/base/ring_buffer.h"
15 #include "cc/cc_export.h"
15 16
16 namespace cc { 17 namespace cc {
17 18
18 // This class maintains a history of timestamps, and provides functionality to 19 // This class maintains a history of timestamps, and provides functionality to
19 // intelligently compute average frames per second. 20 // intelligently compute average frames per second.
20 class FrameRateCounter { 21 class CC_EXPORT FrameRateCounter {
21 public: 22 public:
22 static std::unique_ptr<FrameRateCounter> Create(bool has_impl_thread); 23 static std::unique_ptr<FrameRateCounter> Create(bool has_impl_thread);
23 24
24 size_t current_frame_number() const { return ring_buffer_.CurrentIndex(); } 25 size_t current_frame_number() const { return ring_buffer_.CurrentIndex(); }
25 int dropped_frame_count() const { return dropped_frame_count_; } 26 int dropped_frame_count() const { return dropped_frame_count_; }
26 size_t time_stamp_history_size() const { return ring_buffer_.BufferSize(); } 27 size_t time_stamp_history_size() const { return ring_buffer_.BufferSize(); }
27 28
28 void SaveTimeStamp(base::TimeTicks timestamp, bool software); 29 void SaveTimeStamp(base::TimeTicks timestamp, bool software);
29 30
30 // n = 0 returns the oldest frame interval retained in the history, while n = 31 // n = 0 returns the oldest frame interval retained in the history, while n =
(...skipping 20 matching lines...) Expand all
51 52
52 bool has_impl_thread_; 53 bool has_impl_thread_;
53 int dropped_frame_count_; 54 int dropped_frame_count_;
54 55
55 DISALLOW_COPY_AND_ASSIGN(FrameRateCounter); 56 DISALLOW_COPY_AND_ASSIGN(FrameRateCounter);
56 }; 57 };
57 58
58 } // namespace cc 59 } // namespace cc
59 60
60 #endif // CC_TREES_FRAME_RATE_COUNTER_H_ 61 #endif // CC_TREES_FRAME_RATE_COUNTER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/DEPS » ('j') | chrome/browser/android/vr_shell/vr_shell_gl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698