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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 weak_ptr_factory_(this) { | 87 weak_ptr_factory_(this) { |
88 root_web_layer_ = cc::Layer::Create(); | 88 root_web_layer_ = cc::Layer::Create(); |
89 | 89 |
90 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 90 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
91 | 91 |
92 cc::LayerTreeSettings settings; | 92 cc::LayerTreeSettings settings; |
93 // When impl-side painting is enabled, this will ensure PictureLayers always | 93 // When impl-side painting is enabled, this will ensure PictureLayers always |
94 // can have LCD text, to match the previous behaviour with ContentLayers, | 94 // can have LCD text, to match the previous behaviour with ContentLayers, |
95 // where LCD-not-allowed notifications were ignored. | 95 // where LCD-not-allowed notifications were ignored. |
96 settings.layers_always_allowed_lcd_text = true; | 96 settings.layers_always_allowed_lcd_text = true; |
97 settings.refresh_rate = | 97 settings.renderer_settings.refresh_rate = |
98 context_factory_->DoesCreateTestContexts() | 98 context_factory_->DoesCreateTestContexts() ? kTestRefreshRate |
99 ? kTestRefreshRate | 99 : kDefaultRefreshRate; |
100 : kDefaultRefreshRate; | |
101 settings.main_frame_before_activation_enabled = false; | 100 settings.main_frame_before_activation_enabled = false; |
102 settings.throttle_frame_production = | 101 settings.throttle_frame_production = |
103 !command_line->HasSwitch(switches::kDisableGpuVsync); | 102 !command_line->HasSwitch(switches::kDisableGpuVsync); |
104 #if !defined(OS_MACOSX) | 103 #if !defined(OS_MACOSX) |
105 settings.partial_swap_enabled = | 104 settings.renderer_settings.partial_swap_enabled = |
106 !command_line->HasSwitch(cc::switches::kUIDisablePartialSwap); | 105 !command_line->HasSwitch(cc::switches::kUIDisablePartialSwap); |
107 #endif | 106 #endif |
108 #if defined(OS_CHROMEOS) | 107 #if defined(OS_CHROMEOS) |
109 settings.per_tile_painting_enabled = true; | 108 settings.per_tile_painting_enabled = true; |
110 #endif | 109 #endif |
111 #if defined(OS_WIN) | 110 #if defined(OS_WIN) |
112 settings.disable_hi_res_timer_tasks_on_battery = true; | 111 settings.disable_hi_res_timer_tasks_on_battery = true; |
113 #endif | 112 #endif |
114 | 113 |
115 // These flags should be mirrored by renderer versions in content/renderer/. | 114 // These flags should be mirrored by renderer versions in content/renderer/. |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 413 |
415 const cc::LayerTreeDebugState& Compositor::GetLayerTreeDebugState() const { | 414 const cc::LayerTreeDebugState& Compositor::GetLayerTreeDebugState() const { |
416 return host_->debug_state(); | 415 return host_->debug_state(); |
417 } | 416 } |
418 | 417 |
419 void Compositor::SetLayerTreeDebugState( | 418 void Compositor::SetLayerTreeDebugState( |
420 const cc::LayerTreeDebugState& debug_state) { | 419 const cc::LayerTreeDebugState& debug_state) { |
421 host_->SetDebugState(debug_state); | 420 host_->SetDebugState(debug_state); |
422 } | 421 } |
423 | 422 |
| 423 const cc::RendererSettings& Compositor::GetRendererSettings() const { |
| 424 return host_->settings().renderer_settings; |
| 425 } |
| 426 |
424 scoped_refptr<CompositorLock> Compositor::GetCompositorLock() { | 427 scoped_refptr<CompositorLock> Compositor::GetCompositorLock() { |
425 if (!compositor_lock_) { | 428 if (!compositor_lock_) { |
426 compositor_lock_ = new CompositorLock(this); | 429 compositor_lock_ = new CompositorLock(this); |
427 if (compositor_thread_loop_.get()) | 430 if (compositor_thread_loop_.get()) |
428 host_->SetDeferCommits(true); | 431 host_->SetDeferCommits(true); |
429 FOR_EACH_OBSERVER(CompositorObserver, | 432 FOR_EACH_OBSERVER(CompositorObserver, |
430 observer_list_, | 433 observer_list_, |
431 OnCompositingLockStateChanged(this)); | 434 OnCompositingLockStateChanged(this)); |
432 } | 435 } |
433 return compositor_lock_; | 436 return compositor_lock_; |
(...skipping 24 matching lines...) Expand all Loading... |
458 // Call ScheduleDraw() instead of Draw() in order to allow other | 461 // Call ScheduleDraw() instead of Draw() in order to allow other |
459 // CompositorObservers to be notified before starting another | 462 // CompositorObservers to be notified before starting another |
460 // draw cycle. | 463 // draw cycle. |
461 ScheduleDraw(); | 464 ScheduleDraw(); |
462 } | 465 } |
463 FOR_EACH_OBSERVER( | 466 FOR_EACH_OBSERVER( |
464 CompositorObserver, observer_list_, OnCompositingEnded(this)); | 467 CompositorObserver, observer_list_, OnCompositingEnded(this)); |
465 } | 468 } |
466 | 469 |
467 } // namespace ui | 470 } // namespace ui |
OLD | NEW |