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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 surface_id_allocator_(context_factory->CreateSurfaceIdAllocator()), | 74 surface_id_allocator_(context_factory->CreateSurfaceIdAllocator()), |
75 task_runner_(task_runner), | 75 task_runner_(task_runner), |
76 vsync_manager_(new CompositorVSyncManager()), | 76 vsync_manager_(new CompositorVSyncManager()), |
77 device_scale_factor_(0.0f), | 77 device_scale_factor_(0.0f), |
78 last_started_frame_(0), | 78 last_started_frame_(0), |
79 last_ended_frame_(0), | 79 last_ended_frame_(0), |
80 locks_will_time_out_(true), | 80 locks_will_time_out_(true), |
81 compositor_lock_(NULL), | 81 compositor_lock_(NULL), |
82 layer_animator_collection_(this), | 82 layer_animator_collection_(this), |
83 weak_ptr_factory_(this) { | 83 weak_ptr_factory_(this) { |
84 root_web_layer_ = cc::Layer::Create(); | |
85 | |
86 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 84 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
87 | 85 |
88 cc::LayerTreeSettings settings; | 86 cc::LayerTreeSettings settings; |
87 | |
88 cc::LayerSettings ui_layer_settings; | |
89 if (command_line->HasSwitch( | |
90 switches::kUIEnableCompositorAnimationTimelines)) { | |
91 ui_layer_settings.use_compositor_animation_timelines = true; | |
92 } | |
93 Layer::SetUILayerSettings(ui_layer_settings); | |
piman
2015/05/12 20:06:54
I think we should do this initialization only once
loyso (OOO)
2015/05/19 04:21:48
Done.
| |
94 | |
95 settings.hud_layer_settings = Layer::UILayerSettings(); | |
96 | |
97 root_web_layer_ = cc::Layer::Create(Layer::UILayerSettings()); | |
98 | |
89 // When impl-side painting is enabled, this will ensure PictureLayers always | 99 // When impl-side painting is enabled, this will ensure PictureLayers always |
90 // can have LCD text, to match the previous behaviour with ContentLayers, | 100 // can have LCD text, to match the previous behaviour with ContentLayers, |
91 // where LCD-not-allowed notifications were ignored. | 101 // where LCD-not-allowed notifications were ignored. |
92 settings.layers_always_allowed_lcd_text = true; | 102 settings.layers_always_allowed_lcd_text = true; |
93 settings.renderer_settings.refresh_rate = | 103 settings.renderer_settings.refresh_rate = |
94 context_factory_->DoesCreateTestContexts() ? kTestRefreshRate | 104 context_factory_->DoesCreateTestContexts() ? kTestRefreshRate |
95 : kDefaultRefreshRate; | 105 : kDefaultRefreshRate; |
96 settings.main_frame_before_activation_enabled = false; | 106 settings.main_frame_before_activation_enabled = false; |
97 settings.throttle_frame_production = | 107 settings.throttle_frame_production = |
98 !command_line->HasSwitch(switches::kDisableGpuVsync); | 108 !command_line->HasSwitch(switches::kDisableGpuVsync); |
(...skipping 30 matching lines...) Expand all Loading... | |
129 settings.impl_side_painting = IsUIImplSidePaintingEnabled(); | 139 settings.impl_side_painting = IsUIImplSidePaintingEnabled(); |
130 settings.use_display_lists = IsUISlimmingPaintEnabled(); | 140 settings.use_display_lists = IsUISlimmingPaintEnabled(); |
131 settings.use_cached_picture_in_display_list = false; | 141 settings.use_cached_picture_in_display_list = false; |
132 settings.use_zero_copy = IsUIZeroCopyEnabled(); | 142 settings.use_zero_copy = IsUIZeroCopyEnabled(); |
133 settings.use_one_copy = IsUIOneCopyEnabled(); | 143 settings.use_one_copy = IsUIOneCopyEnabled(); |
134 settings.use_image_texture_target = context_factory_->GetImageTextureTarget(); | 144 settings.use_image_texture_target = context_factory_->GetImageTextureTarget(); |
135 // Note: gathering of pixel refs is only needed when using multiple | 145 // Note: gathering of pixel refs is only needed when using multiple |
136 // raster threads. | 146 // raster threads. |
137 settings.gather_pixel_refs = false; | 147 settings.gather_pixel_refs = false; |
138 | 148 |
139 settings.use_compositor_animation_timelines = | |
140 command_line->HasSwitch(switches::kUIEnableCompositorAnimationTimelines); | |
141 | |
142 base::TimeTicks before_create = base::TimeTicks::Now(); | 149 base::TimeTicks before_create = base::TimeTicks::Now(); |
143 | 150 |
144 cc::LayerTreeHost::InitParams params; | 151 cc::LayerTreeHost::InitParams params; |
145 params.client = this; | 152 params.client = this; |
146 params.shared_bitmap_manager = context_factory_->GetSharedBitmapManager(); | 153 params.shared_bitmap_manager = context_factory_->GetSharedBitmapManager(); |
147 params.gpu_memory_buffer_manager = | 154 params.gpu_memory_buffer_manager = |
148 context_factory_->GetGpuMemoryBufferManager(); | 155 context_factory_->GetGpuMemoryBufferManager(); |
149 params.task_graph_runner = context_factory_->GetTaskGraphRunner(); | 156 params.task_graph_runner = context_factory_->GetTaskGraphRunner(); |
150 params.settings = &settings; | 157 params.settings = &settings; |
151 params.main_task_runner = task_runner_; | 158 params.main_task_runner = task_runner_; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 observer_list_, | 438 observer_list_, |
432 OnCompositingLockStateChanged(this)); | 439 OnCompositingLockStateChanged(this)); |
433 } | 440 } |
434 | 441 |
435 void Compositor::CancelCompositorLock() { | 442 void Compositor::CancelCompositorLock() { |
436 if (compositor_lock_) | 443 if (compositor_lock_) |
437 compositor_lock_->CancelLock(); | 444 compositor_lock_->CancelLock(); |
438 } | 445 } |
439 | 446 |
440 } // namespace ui | 447 } // namespace ui |
OLD | NEW |