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

Side by Side Diff: ui/aura/bench/bench_main.cc

Issue 10690168: Aura: Resize locks with --ui-enable-threaded-compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OSX compile fix. Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/texture_image_transport_surface.cc ('k') | ui/aura/root_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 {} 96 virtual void OnCompositingDidCommit(ui::Compositor* compositor) OVERRIDE {}
97 97
98 virtual void OnCompositingWillStart(Compositor* compositor) OVERRIDE {}
99
100 virtual void OnCompositingStarted(Compositor* compositor) OVERRIDE {} 98 virtual void OnCompositingStarted(Compositor* compositor) OVERRIDE {}
101 99
102 virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE { 100 virtual void OnCompositingEnded(Compositor* compositor) OVERRIDE {
103 if (start_time_.is_null()) { 101 if (start_time_.is_null()) {
104 start_time_ = TimeTicks::Now(); 102 start_time_ = TimeTicks::Now();
105 } else { 103 } else {
106 ++frames_; 104 ++frames_;
107 if (frames_ % kFrames == 0) { 105 if (frames_ % kFrames == 0) {
108 TimeTicks now = TimeTicks::Now(); 106 TimeTicks now = TimeTicks::Now();
109 double ms = (now - start_time_).InMillisecondsF() / kFrames; 107 double ms = (now - start_time_).InMillisecondsF() / kFrames;
110 LOG(INFO) << "FPS: " << 1000.f / ms << " (" << ms << " ms)"; 108 LOG(INFO) << "FPS: " << 1000.f / ms << " (" << ms << " ms)";
111 start_time_ = now; 109 start_time_ = now;
112 } 110 }
113 } 111 }
114 if (max_frames_ && frames_ == max_frames_) { 112 if (max_frames_ && frames_ == max_frames_) {
115 MessageLoop::current()->Quit(); 113 MessageLoop::current()->Quit();
116 } else { 114 } else {
117 Draw(); 115 Draw();
118 } 116 }
119 } 117 }
120 118
121 virtual void OnCompositingAborted(Compositor* compositor) OVERRIDE {} 119 virtual void OnCompositingAborted(Compositor* compositor) OVERRIDE {}
122 120
121 virtual void OnCompositingLockStateChanged(
122 Compositor* compositor) OVERRIDE {}
123
123 virtual void Draw() {} 124 virtual void Draw() {}
124 125
125 int frames() const { return frames_; } 126 int frames() const { return frames_; }
126 127
127 private: 128 private:
128 TimeTicks start_time_; 129 TimeTicks start_time_;
129 int frames_; 130 int frames_;
130 int max_frames_; 131 int max_frames_;
131 132
132 DISALLOW_COPY_AND_ASSIGN(BenchCompositorObserver); 133 DISALLOW_COPY_AND_ASSIGN(BenchCompositorObserver);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 351
351 root_window->ShowRootWindow(); 352 root_window->ShowRootWindow();
352 MessageLoopForUI::current()->Run(); 353 MessageLoopForUI::current()->Run();
353 focus_manager.reset(); 354 focus_manager.reset();
354 root_window.reset(); 355 root_window.reset();
355 356
356 ui::CompositorTestSupport::Terminate(); 357 ui::CompositorTestSupport::Terminate();
357 358
358 return 0; 359 return 0;
359 } 360 }
OLDNEW
« no previous file with comments | « content/common/gpu/texture_image_transport_surface.cc ('k') | ui/aura/root_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698