| 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(); | 84 root_web_layer_ = cc::Layer::Create(Layer::UILayerSettings()); |
| 85 | 85 |
| 86 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 86 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 87 | 87 |
| 88 cc::LayerTreeSettings settings; | 88 cc::LayerTreeSettings settings; |
| 89 settings.hud_layer_settings = Layer::UILayerSettings(); |
| 90 |
| 89 // When impl-side painting is enabled, this will ensure PictureLayers always | 91 // When impl-side painting is enabled, this will ensure PictureLayers always |
| 90 // can have LCD text, to match the previous behaviour with ContentLayers, | 92 // can have LCD text, to match the previous behaviour with ContentLayers, |
| 91 // where LCD-not-allowed notifications were ignored. | 93 // where LCD-not-allowed notifications were ignored. |
| 92 settings.layers_always_allowed_lcd_text = true; | 94 settings.layers_always_allowed_lcd_text = true; |
| 93 settings.renderer_settings.refresh_rate = | 95 settings.renderer_settings.refresh_rate = |
| 94 context_factory_->DoesCreateTestContexts() ? kTestRefreshRate | 96 context_factory_->DoesCreateTestContexts() ? kTestRefreshRate |
| 95 : kDefaultRefreshRate; | 97 : kDefaultRefreshRate; |
| 96 settings.main_frame_before_activation_enabled = false; | 98 settings.main_frame_before_activation_enabled = false; |
| 97 settings.throttle_frame_production = | 99 settings.throttle_frame_production = |
| 98 !command_line->HasSwitch(switches::kDisableGpuVsync); | 100 !command_line->HasSwitch(switches::kDisableGpuVsync); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 129 settings.impl_side_painting = IsUIImplSidePaintingEnabled(); | 131 settings.impl_side_painting = IsUIImplSidePaintingEnabled(); |
| 130 settings.use_display_lists = IsUISlimmingPaintEnabled(); | 132 settings.use_display_lists = IsUISlimmingPaintEnabled(); |
| 131 settings.use_cached_picture_in_display_list = false; | 133 settings.use_cached_picture_in_display_list = false; |
| 132 settings.use_zero_copy = IsUIZeroCopyEnabled(); | 134 settings.use_zero_copy = IsUIZeroCopyEnabled(); |
| 133 settings.use_one_copy = IsUIOneCopyEnabled(); | 135 settings.use_one_copy = IsUIOneCopyEnabled(); |
| 134 settings.use_image_texture_target = context_factory_->GetImageTextureTarget(); | 136 settings.use_image_texture_target = context_factory_->GetImageTextureTarget(); |
| 135 // Note: gathering of pixel refs is only needed when using multiple | 137 // Note: gathering of pixel refs is only needed when using multiple |
| 136 // raster threads. | 138 // raster threads. |
| 137 settings.gather_pixel_refs = false; | 139 settings.gather_pixel_refs = false; |
| 138 | 140 |
| 139 settings.use_compositor_animation_timelines = | |
| 140 command_line->HasSwitch(switches::kUIEnableCompositorAnimationTimelines); | |
| 141 | |
| 142 base::TimeTicks before_create = base::TimeTicks::Now(); | 141 base::TimeTicks before_create = base::TimeTicks::Now(); |
| 143 | 142 |
| 144 cc::LayerTreeHost::InitParams params; | 143 cc::LayerTreeHost::InitParams params; |
| 145 params.client = this; | 144 params.client = this; |
| 146 params.shared_bitmap_manager = context_factory_->GetSharedBitmapManager(); | 145 params.shared_bitmap_manager = context_factory_->GetSharedBitmapManager(); |
| 147 params.gpu_memory_buffer_manager = | 146 params.gpu_memory_buffer_manager = |
| 148 context_factory_->GetGpuMemoryBufferManager(); | 147 context_factory_->GetGpuMemoryBufferManager(); |
| 149 params.task_graph_runner = context_factory_->GetTaskGraphRunner(); | 148 params.task_graph_runner = context_factory_->GetTaskGraphRunner(); |
| 150 params.settings = &settings; | 149 params.settings = &settings; |
| 151 params.main_task_runner = task_runner_; | 150 params.main_task_runner = task_runner_; |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 observer_list_, | 430 observer_list_, |
| 432 OnCompositingLockStateChanged(this)); | 431 OnCompositingLockStateChanged(this)); |
| 433 } | 432 } |
| 434 | 433 |
| 435 void Compositor::CancelCompositorLock() { | 434 void Compositor::CancelCompositorLock() { |
| 436 if (compositor_lock_) | 435 if (compositor_lock_) |
| 437 compositor_lock_->CancelLock(); | 436 compositor_lock_->CancelLock(); |
| 438 } | 437 } |
| 439 | 438 |
| 440 } // namespace ui | 439 } // namespace ui |
| OLD | NEW |