| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Benchmark base class, hooks up drawing callback and displaying FPS. | 82 // Benchmark base class, hooks up drawing callback and displaying FPS. |
| 83 class BenchCompositorObserver : public ui::CompositorObserver { | 83 class BenchCompositorObserver : public ui::CompositorObserver { |
| 84 public: | 84 public: |
| 85 explicit BenchCompositorObserver(int max_frames) | 85 explicit BenchCompositorObserver(int max_frames) |
| 86 : start_time_(), | 86 : start_time_(), |
| 87 frames_(0), | 87 frames_(0), |
| 88 max_frames_(max_frames) { | 88 max_frames_(max_frames) { |
| 89 } | 89 } |
| 90 virtual void OnCompositingStarted(Compositor* compositor) OVERRIDE {} | 90 virtual void OnCompositingStarted(Compositor* compositor) OVERRIDE {} |
| 91 | 91 |
| 92 virtual void OnCompositingWillEnd(Compositor* compositor) OVERRIDE {} |
| 93 |
| 92 virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE { | 94 virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE { |
| 93 if (start_time_.is_null()) { | 95 if (start_time_.is_null()) { |
| 94 start_time_ = TimeTicks::Now(); | 96 start_time_ = TimeTicks::Now(); |
| 95 } else { | 97 } else { |
| 96 ++frames_; | 98 ++frames_; |
| 97 if (frames_ % kFrames == 0) { | 99 if (frames_ % kFrames == 0) { |
| 98 TimeTicks now = TimeTicks::Now(); | 100 TimeTicks now = TimeTicks::Now(); |
| 99 double ms = (now - start_time_).InMillisecondsF() / kFrames; | 101 double ms = (now - start_time_).InMillisecondsF() / kFrames; |
| 100 LOG(INFO) << "FPS: " << 1000.f / ms << " (" << ms << " ms)"; | 102 LOG(INFO) << "FPS: " << 1000.f / ms << " (" << ms << " ms)"; |
| 101 start_time_ = now; | 103 start_time_ = now; |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 #endif | 325 #endif |
| 324 | 326 |
| 325 root_window->ShowRootWindow(); | 327 root_window->ShowRootWindow(); |
| 326 MessageLoopForUI::current()->Run(); | 328 MessageLoopForUI::current()->Run(); |
| 327 root_window.reset(); | 329 root_window.reset(); |
| 328 | 330 |
| 329 ui::CompositorTestSupport::Terminate(); | 331 ui::CompositorTestSupport::Terminate(); |
| 330 | 332 |
| 331 return 0; | 333 return 0; |
| 332 } | 334 } |
| OLD | NEW |