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