| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 << "The ContextFactory should not outlive the compositor thread."; | 524 << "The ContextFactory should not outlive the compositor thread."; |
| 523 g_compositor_thread->Stop(); | 525 g_compositor_thread->Stop(); |
| 524 delete g_compositor_thread; | 526 delete g_compositor_thread; |
| 525 g_compositor_thread = NULL; | 527 g_compositor_thread = NULL; |
| 526 } | 528 } |
| 527 | 529 |
| 528 DCHECK(g_compositor_initialized) << "Compositor::Initialize() didn't happen."; | 530 DCHECK(g_compositor_initialized) << "Compositor::Initialize() didn't happen."; |
| 529 g_compositor_initialized = false; | 531 g_compositor_initialized = false; |
| 530 } | 532 } |
| 531 | 533 |
| 534 const cc::LayerTreeSettings& Compositor::layer_tree_settings() const { |
| 535 return host_->settings(); |
| 536 } |
| 537 |
| 532 void Compositor::ScheduleDraw() { | 538 void Compositor::ScheduleDraw() { |
| 533 if (g_compositor_thread) | 539 if (g_compositor_thread) |
| 534 host_->Composite(base::TimeTicks::Now()); | 540 host_->Composite(base::TimeTicks::Now()); |
| 535 else if (delegate_) | 541 else if (delegate_) |
| 536 delegate_->ScheduleDraw(); | 542 delegate_->ScheduleDraw(); |
| 537 } | 543 } |
| 538 | 544 |
| 539 void Compositor::SetRootLayer(Layer* root_layer) { | 545 void Compositor::SetRootLayer(Layer* root_layer) { |
| 540 if (root_layer_ == root_layer) | 546 if (root_layer_ == root_layer) |
| 541 return; | 547 return; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 } | 773 } |
| 768 | 774 |
| 769 void Compositor::NotifyEnd() { | 775 void Compositor::NotifyEnd() { |
| 770 last_ended_frame_++; | 776 last_ended_frame_++; |
| 771 FOR_EACH_OBSERVER(CompositorObserver, | 777 FOR_EACH_OBSERVER(CompositorObserver, |
| 772 observer_list_, | 778 observer_list_, |
| 773 OnCompositingEnded(this)); | 779 OnCompositingEnded(this)); |
| 774 } | 780 } |
| 775 | 781 |
| 776 } // namespace ui | 782 } // namespace ui |
| OLD | NEW |