| 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 "ui/compositor/compositor.h" | 5 #include "ui/compositor/compositor.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 device_scale_factor_(0.0f), | 293 device_scale_factor_(0.0f), |
| 294 last_started_frame_(0), | 294 last_started_frame_(0), |
| 295 last_ended_frame_(0), | 295 last_ended_frame_(0), |
| 296 disable_schedule_composite_(false), | 296 disable_schedule_composite_(false), |
| 297 compositor_lock_(NULL) { | 297 compositor_lock_(NULL) { |
| 298 root_web_layer_ = cc::Layer::create(); | 298 root_web_layer_ = cc::Layer::create(); |
| 299 root_web_layer_->setAnchorPoint(gfx::PointF(0.f, 0.f)); | 299 root_web_layer_->setAnchorPoint(gfx::PointF(0.f, 0.f)); |
| 300 | 300 |
| 301 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 301 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 302 cc::LayerTreeSettings settings; | 302 cc::LayerTreeSettings settings; |
| 303 settings.showPlatformLayerTree = | 303 settings.initialDebugState.showFPSCounter = |
| 304 command_line->HasSwitch(switches::kUIShowFPSCounter); |
| 305 settings.initialDebugState.showPlatformLayerTree = |
| 304 command_line->HasSwitch(switches::kUIShowLayerTree); | 306 command_line->HasSwitch(switches::kUIShowLayerTree); |
| 305 settings.refreshRate = | 307 settings.refreshRate = |
| 306 test_compositor_enabled ? kTestRefreshRate : kDefaultRefreshRate; | 308 test_compositor_enabled ? kTestRefreshRate : kDefaultRefreshRate; |
| 307 settings.showDebugBorders = | 309 settings.initialDebugState.showDebugBorders = |
| 308 command_line->HasSwitch(switches::kUIShowLayerBorders); | 310 command_line->HasSwitch(switches::kUIShowLayerBorders); |
| 309 settings.partialSwapEnabled = | 311 settings.partialSwapEnabled = |
| 310 command_line->HasSwitch(switches::kUIEnablePartialSwap); | 312 command_line->HasSwitch(switches::kUIEnablePartialSwap); |
| 311 settings.perTilePaintingEnabled = | 313 settings.perTilePaintingEnabled = |
| 312 command_line->HasSwitch(switches::kUIEnablePerTilePainting); | 314 command_line->HasSwitch(switches::kUIEnablePerTilePainting); |
| 313 | 315 |
| 314 scoped_ptr<cc::Thread> thread; | 316 scoped_ptr<cc::Thread> thread; |
| 315 if (g_compositor_thread) { | 317 if (g_compositor_thread) { |
| 316 thread = cc::ThreadImpl::createForDifferentThread( | 318 thread = cc::ThreadImpl::createForDifferentThread( |
| 317 g_compositor_thread->message_loop_proxy()); | 319 g_compositor_thread->message_loop_proxy()); |
| 318 } | 320 } |
| 319 | 321 |
| 320 host_ = cc::LayerTreeHost::create(this, settings, thread.Pass()); | 322 host_ = cc::LayerTreeHost::create(this, settings, thread.Pass()); |
| 321 host_->setShowFPSCounter( | |
| 322 command_line->HasSwitch(switches::kUIShowFPSCounter)); | |
| 323 host_->setRootLayer(root_web_layer_); | 323 host_->setRootLayer(root_web_layer_); |
| 324 host_->setSurfaceReady(); | 324 host_->setSurfaceReady(); |
| 325 } | 325 } |
| 326 | 326 |
| 327 Compositor::~Compositor() { | 327 Compositor::~Compositor() { |
| 328 CancelCompositorLock(); | 328 CancelCompositorLock(); |
| 329 DCHECK(!compositor_lock_); | 329 DCHECK(!compositor_lock_); |
| 330 | 330 |
| 331 // Don't call |CompositorDelegate::ScheduleDraw| from this point. | 331 // Don't call |CompositorDelegate::ScheduleDraw| from this point. |
| 332 delegate_ = NULL; | 332 delegate_ = NULL; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 | 592 |
| 593 COMPOSITOR_EXPORT void DisableTestCompositor() { | 593 COMPOSITOR_EXPORT void DisableTestCompositor() { |
| 594 test_compositor_enabled = false; | 594 test_compositor_enabled = false; |
| 595 } | 595 } |
| 596 | 596 |
| 597 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 597 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
| 598 return test_compositor_enabled; | 598 return test_compositor_enabled; |
| 599 } | 599 } |
| 600 | 600 |
| 601 } // namespace ui | 601 } // namespace ui |
| OLD | NEW |