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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } else { | 104 } else { |
105 ++frames_; | 105 ++frames_; |
106 if (frames_ % kFrames == 0) { | 106 if (frames_ % kFrames == 0) { |
107 TimeTicks now = TimeTicks::Now(); | 107 TimeTicks now = TimeTicks::Now(); |
108 double ms = (now - start_time_).InMillisecondsF() / kFrames; | 108 double ms = (now - start_time_).InMillisecondsF() / kFrames; |
109 LOG(INFO) << "FPS: " << 1000.f / ms << " (" << ms << " ms)"; | 109 LOG(INFO) << "FPS: " << 1000.f / ms << " (" << ms << " ms)"; |
110 start_time_ = now; | 110 start_time_ = now; |
111 } | 111 } |
112 } | 112 } |
113 if (max_frames_ && frames_ == max_frames_) { | 113 if (max_frames_ && frames_ == max_frames_) { |
114 MessageLoop::current()->Quit(); | 114 base::MessageLoop::current()->Quit(); |
115 } else { | 115 } else { |
116 Draw(); | 116 Draw(); |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 virtual void OnCompositingAborted(Compositor* compositor) OVERRIDE {} | 120 virtual void OnCompositingAborted(Compositor* compositor) OVERRIDE {} |
121 | 121 |
122 virtual void OnCompositingLockStateChanged( | 122 virtual void OnCompositingLockStateChanged( |
123 Compositor* compositor) OVERRIDE {} | 123 Compositor* compositor) OVERRIDE {} |
124 | 124 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 int main(int argc, char** argv) { | 295 int main(int argc, char** argv) { |
296 CommandLine::Init(argc, argv); | 296 CommandLine::Init(argc, argv); |
297 | 297 |
298 base::AtExitManager exit_manager; | 298 base::AtExitManager exit_manager; |
299 | 299 |
300 ui::RegisterPathProvider(); | 300 ui::RegisterPathProvider(); |
301 icu_util::Initialize(); | 301 icu_util::Initialize(); |
302 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); | 302 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); |
303 | 303 |
304 MessageLoop message_loop(MessageLoop::TYPE_UI); | 304 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); |
305 ui::CompositorTestSupport::Initialize(); | 305 ui::CompositorTestSupport::Initialize(); |
306 aura::Env::GetInstance(); | 306 aura::Env::GetInstance(); |
307 scoped_ptr<aura::TestScreen> test_screen( | 307 scoped_ptr<aura::TestScreen> test_screen( |
308 aura::TestScreen::CreateFullscreen()); | 308 aura::TestScreen::CreateFullscreen()); |
309 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get()); | 309 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get()); |
310 scoped_ptr<aura::RootWindow> root_window( | 310 scoped_ptr<aura::RootWindow> root_window( |
311 test_screen->CreateRootWindowForPrimaryDisplay()); | 311 test_screen->CreateRootWindowForPrimaryDisplay()); |
312 aura::client::SetCaptureClient( | 312 aura::client::SetCaptureClient( |
313 root_window.get(), | 313 root_window.get(), |
314 new aura::client::DefaultCaptureClient(root_window.get())); | 314 new aura::client::DefaultCaptureClient(root_window.get())); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 bench.reset(new WebGLBench(&page_background, | 350 bench.reset(new WebGLBench(&page_background, |
351 root_window->compositor(), | 351 root_window->compositor(), |
352 frames)); | 352 frames)); |
353 } | 353 } |
354 | 354 |
355 #ifndef NDEBUG | 355 #ifndef NDEBUG |
356 ui::PrintLayerHierarchy(root_window->layer(), gfx::Point(100, 100)); | 356 ui::PrintLayerHierarchy(root_window->layer(), gfx::Point(100, 100)); |
357 #endif | 357 #endif |
358 | 358 |
359 root_window->ShowRootWindow(); | 359 root_window->ShowRootWindow(); |
360 MessageLoopForUI::current()->Run(); | 360 base::MessageLoopForUI::current()->Run(); |
361 focus_client.reset(); | 361 focus_client.reset(); |
362 root_window.reset(); | 362 root_window.reset(); |
363 | 363 |
364 ui::CompositorTestSupport::Terminate(); | 364 ui::CompositorTestSupport::Terminate(); |
365 | 365 |
366 return 0; | 366 return 0; |
367 } | 367 } |
OLD | NEW |