OLD | NEW |
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 #include "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/i18n/icu_util.h" | 8 #include "base/i18n/icu_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 // Benchmark base class, hooks up drawing callback and displaying FPS. | 87 // Benchmark base class, hooks up drawing callback and displaying FPS. |
88 class BenchCompositorObserver : public ui::CompositorObserver { | 88 class BenchCompositorObserver : public ui::CompositorObserver { |
89 public: | 89 public: |
90 explicit BenchCompositorObserver(int max_frames) | 90 explicit BenchCompositorObserver(int max_frames) |
91 : start_time_(), | 91 : start_time_(), |
92 frames_(0), | 92 frames_(0), |
93 max_frames_(max_frames) { | 93 max_frames_(max_frames) { |
94 } | 94 } |
95 | 95 |
96 virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE {} | |
97 | |
98 virtual void OnCompositingWillStart(Compositor* compositor) OVERRIDE {} | |
99 | |
100 virtual void OnCompositingStarted(Compositor* compositor) OVERRIDE {} | 96 virtual void OnCompositingStarted(Compositor* compositor) OVERRIDE {} |
101 | 97 |
102 virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE { | 98 virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE { |
103 if (start_time_.is_null()) { | 99 if (start_time_.is_null()) { |
104 start_time_ = TimeTicks::Now(); | 100 start_time_ = TimeTicks::Now(); |
105 } else { | 101 } else { |
106 ++frames_; | 102 ++frames_; |
107 if (frames_ % kFrames == 0) { | 103 if (frames_ % kFrames == 0) { |
108 TimeTicks now = TimeTicks::Now(); | 104 TimeTicks now = TimeTicks::Now(); |
109 double ms = (now - start_time_).InMillisecondsF() / kFrames; | 105 double ms = (now - start_time_).InMillisecondsF() / kFrames; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 #endif | 338 #endif |
343 | 339 |
344 root_window->ShowRootWindow(); | 340 root_window->ShowRootWindow(); |
345 MessageLoopForUI::current()->Run(); | 341 MessageLoopForUI::current()->Run(); |
346 root_window.reset(); | 342 root_window.reset(); |
347 | 343 |
348 ui::CompositorTestSupport::Terminate(); | 344 ui::CompositorTestSupport::Terminate(); |
349 | 345 |
350 return 0; | 346 return 0; |
351 } | 347 } |
OLD | NEW |