| 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 root_web_layer_ = cc::Layer::Create(); | 378 root_web_layer_ = cc::Layer::Create(); |
| 379 root_web_layer_->SetAnchorPoint(gfx::PointF(0.f, 0.f)); | 379 root_web_layer_->SetAnchorPoint(gfx::PointF(0.f, 0.f)); |
| 380 | 380 |
| 381 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 381 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 382 | 382 |
| 383 cc::LayerTreeSettings settings; | 383 cc::LayerTreeSettings settings; |
| 384 settings.refresh_rate = | 384 settings.refresh_rate = |
| 385 ContextFactory::GetInstance()->DoesCreateTestContexts() | 385 ContextFactory::GetInstance()->DoesCreateTestContexts() |
| 386 ? kTestRefreshRate | 386 ? kTestRefreshRate |
| 387 : kDefaultRefreshRate; | 387 : kDefaultRefreshRate; |
| 388 settings.deadline_scheduling_enabled = |
| 389 cc::switches::IsDeadlineSchedulingEnabled(); |
| 388 settings.partial_swap_enabled = | 390 settings.partial_swap_enabled = |
| 389 !command_line->HasSwitch(cc::switches::kUIDisablePartialSwap); | 391 !command_line->HasSwitch(cc::switches::kUIDisablePartialSwap); |
| 390 settings.per_tile_painting_enabled = | 392 settings.per_tile_painting_enabled = |
| 391 command_line->HasSwitch(cc::switches::kUIEnablePerTilePainting); | 393 command_line->HasSwitch(cc::switches::kUIEnablePerTilePainting); |
| 392 | 394 |
| 393 // These flags should be mirrored by renderer versions in content/renderer/. | 395 // These flags should be mirrored by renderer versions in content/renderer/. |
| 394 settings.initial_debug_state.show_debug_borders = | 396 settings.initial_debug_state.show_debug_borders = |
| 395 command_line->HasSwitch(cc::switches::kUIShowCompositedLayerBorders); | 397 command_line->HasSwitch(cc::switches::kUIShowCompositedLayerBorders); |
| 396 settings.initial_debug_state.show_fps_counter = | 398 settings.initial_debug_state.show_fps_counter = |
| 397 command_line->HasSwitch(cc::switches::kUIShowFPSCounter); | 399 command_line->HasSwitch(cc::switches::kUIShowFPSCounter); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 << "The ContextFactory should not outlive the compositor thread."; | 527 << "The ContextFactory should not outlive the compositor thread."; |
| 526 g_compositor_thread->Stop(); | 528 g_compositor_thread->Stop(); |
| 527 delete g_compositor_thread; | 529 delete g_compositor_thread; |
| 528 g_compositor_thread = NULL; | 530 g_compositor_thread = NULL; |
| 529 } | 531 } |
| 530 | 532 |
| 531 DCHECK(g_compositor_initialized) << "Compositor::Initialize() didn't happen."; | 533 DCHECK(g_compositor_initialized) << "Compositor::Initialize() didn't happen."; |
| 532 g_compositor_initialized = false; | 534 g_compositor_initialized = false; |
| 533 } | 535 } |
| 534 | 536 |
| 537 const cc::LayerTreeSettings& Compositor::layer_tree_settings() const { |
| 538 return host_->settings(); |
| 539 } |
| 540 |
| 535 void Compositor::ScheduleDraw() { | 541 void Compositor::ScheduleDraw() { |
| 536 if (g_compositor_thread) | 542 if (g_compositor_thread) |
| 537 host_->Composite(base::TimeTicks::Now()); | 543 host_->Composite(base::TimeTicks::Now()); |
| 538 else if (delegate_) | 544 else if (delegate_) |
| 539 delegate_->ScheduleDraw(); | 545 delegate_->ScheduleDraw(); |
| 540 } | 546 } |
| 541 | 547 |
| 542 void Compositor::SetRootLayer(Layer* root_layer) { | 548 void Compositor::SetRootLayer(Layer* root_layer) { |
| 543 if (root_layer_ == root_layer) | 549 if (root_layer_ == root_layer) |
| 544 return; | 550 return; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 } | 776 } |
| 771 | 777 |
| 772 void Compositor::NotifyEnd() { | 778 void Compositor::NotifyEnd() { |
| 773 last_ended_frame_++; | 779 last_ended_frame_++; |
| 774 FOR_EACH_OBSERVER(CompositorObserver, | 780 FOR_EACH_OBSERVER(CompositorObserver, |
| 775 observer_list_, | 781 observer_list_, |
| 776 OnCompositingEnded(this)); | 782 OnCompositingEnded(this)); |
| 777 } | 783 } |
| 778 | 784 |
| 779 } // namespace ui | 785 } // namespace ui |
| OLD | NEW |