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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 last_ended_frame_(0), | 78 last_ended_frame_(0), |
79 disable_schedule_composite_(false), | 79 disable_schedule_composite_(false), |
80 compositor_lock_(NULL), | 80 compositor_lock_(NULL), |
81 layer_animator_collection_(this), | 81 layer_animator_collection_(this), |
82 weak_ptr_factory_(this) { | 82 weak_ptr_factory_(this) { |
83 root_web_layer_ = cc::Layer::Create(); | 83 root_web_layer_ = cc::Layer::Create(); |
84 | 84 |
85 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 85 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
86 | 86 |
87 cc::LayerTreeSettings settings; | 87 cc::LayerTreeSettings settings; |
88 | |
danakj
2015/03/13 17:45:53
don't add unrelated whitespace change
loyso (OOO)
2015/03/15 23:29:22
Done.
| |
88 // When impl-side painting is enabled, this will ensure PictureLayers always | 89 // When impl-side painting is enabled, this will ensure PictureLayers always |
89 // can have LCD text, to match the previous behaviour with ContentLayers, | 90 // can have LCD text, to match the previous behaviour with ContentLayers, |
90 // where LCD-not-allowed notifications were ignored. | 91 // where LCD-not-allowed notifications were ignored. |
91 settings.layers_always_allowed_lcd_text = true; | 92 settings.layers_always_allowed_lcd_text = true; |
92 settings.renderer_settings.refresh_rate = | 93 settings.renderer_settings.refresh_rate = |
93 context_factory_->DoesCreateTestContexts() ? kTestRefreshRate | 94 context_factory_->DoesCreateTestContexts() ? kTestRefreshRate |
94 : kDefaultRefreshRate; | 95 : kDefaultRefreshRate; |
95 settings.main_frame_before_activation_enabled = false; | 96 settings.main_frame_before_activation_enabled = false; |
96 settings.throttle_frame_production = | 97 settings.throttle_frame_production = |
97 !command_line->HasSwitch(switches::kDisableGpuVsync); | 98 !command_line->HasSwitch(switches::kDisableGpuVsync); |
(...skipping 25 matching lines...) Expand all Loading... | |
123 command_line->HasSwitch(cc::switches::kUIShowSurfaceDamageRects); | 124 command_line->HasSwitch(cc::switches::kUIShowSurfaceDamageRects); |
124 settings.initial_debug_state.show_screen_space_rects = | 125 settings.initial_debug_state.show_screen_space_rects = |
125 command_line->HasSwitch(cc::switches::kUIShowScreenSpaceRects); | 126 command_line->HasSwitch(cc::switches::kUIShowScreenSpaceRects); |
126 settings.initial_debug_state.show_replica_screen_space_rects = | 127 settings.initial_debug_state.show_replica_screen_space_rects = |
127 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); | 128 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); |
128 | 129 |
129 settings.initial_debug_state.SetRecordRenderingStats( | 130 settings.initial_debug_state.SetRecordRenderingStats( |
130 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); | 131 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); |
131 | 132 |
132 settings.impl_side_painting = IsUIImplSidePaintingEnabled(); | 133 settings.impl_side_painting = IsUIImplSidePaintingEnabled(); |
134 settings.use_compositor_animation_timelines = | |
135 command_line->HasSwitch(switches::kUIEnableCompositorAnimationTimelines); | |
136 settings.use_image_texture_target = context_factory_->GetImageTextureTarget(); | |
danakj
2015/03/13 17:45:53
please try to keep the diff minimal if it makes se
loyso (OOO)
2015/03/15 23:29:22
Done.
| |
137 settings.use_one_copy = IsUIOneCopyEnabled(); | |
133 settings.use_zero_copy = IsUIZeroCopyEnabled(); | 138 settings.use_zero_copy = IsUIZeroCopyEnabled(); |
134 settings.use_one_copy = IsUIOneCopyEnabled(); | |
135 settings.use_image_texture_target = context_factory_->GetImageTextureTarget(); | |
136 | 139 |
137 base::TimeTicks before_create = base::TimeTicks::Now(); | 140 base::TimeTicks before_create = base::TimeTicks::Now(); |
138 host_ = cc::LayerTreeHost::CreateSingleThreaded( | 141 host_ = cc::LayerTreeHost::CreateSingleThreaded( |
139 this, this, context_factory_->GetSharedBitmapManager(), | 142 this, this, context_factory_->GetSharedBitmapManager(), |
140 context_factory_->GetGpuMemoryBufferManager(), settings, task_runner_, | 143 context_factory_->GetGpuMemoryBufferManager(), settings, task_runner_, |
141 nullptr); | 144 nullptr); |
142 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", | 145 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", |
143 base::TimeTicks::Now() - before_create); | 146 base::TimeTicks::Now() - before_create); |
144 host_->SetRootLayer(root_web_layer_); | 147 host_->SetRootLayer(root_web_layer_); |
145 host_->set_surface_id_namespace(surface_id_allocator_->id_namespace()); | 148 host_->set_surface_id_namespace(surface_id_allocator_->id_namespace()); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 observer_list_, | 377 observer_list_, |
375 OnCompositingLockStateChanged(this)); | 378 OnCompositingLockStateChanged(this)); |
376 } | 379 } |
377 | 380 |
378 void Compositor::CancelCompositorLock() { | 381 void Compositor::CancelCompositorLock() { |
379 if (compositor_lock_) | 382 if (compositor_lock_) |
380 compositor_lock_->CancelLock(); | 383 compositor_lock_->CancelLock(); |
381 } | 384 } |
382 | 385 |
383 } // namespace ui | 386 } // namespace ui |
OLD | NEW |