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