OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 has_no_damage(false), | 165 has_no_damage(false), |
166 may_contain_video(false) {} | 166 may_contain_video(false) {} |
167 | 167 |
168 LayerTreeHostImpl::FrameData::~FrameData() {} | 168 LayerTreeHostImpl::FrameData::~FrameData() {} |
169 | 169 |
170 std::unique_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( | 170 std::unique_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( |
171 const LayerTreeSettings& settings, | 171 const LayerTreeSettings& settings, |
172 LayerTreeHostImplClient* client, | 172 LayerTreeHostImplClient* client, |
173 TaskRunnerProvider* task_runner_provider, | 173 TaskRunnerProvider* task_runner_provider, |
174 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 174 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
175 SharedBitmapManager* shared_bitmap_manager, | |
176 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
177 TaskGraphRunner* task_graph_runner, | 175 TaskGraphRunner* task_graph_runner, |
178 std::unique_ptr<AnimationHost> animation_host, | 176 std::unique_ptr<AnimationHost> animation_host, |
179 int id) { | 177 int id) { |
180 return base::WrapUnique(new LayerTreeHostImpl( | 178 return base::WrapUnique(new LayerTreeHostImpl( |
181 settings, client, task_runner_provider, rendering_stats_instrumentation, | 179 settings, client, task_runner_provider, rendering_stats_instrumentation, |
182 shared_bitmap_manager, gpu_memory_buffer_manager, task_graph_runner, | 180 task_graph_runner, std::move(animation_host), id)); |
183 std::move(animation_host), id)); | |
184 } | 181 } |
185 | 182 |
186 LayerTreeHostImpl::LayerTreeHostImpl( | 183 LayerTreeHostImpl::LayerTreeHostImpl( |
187 const LayerTreeSettings& settings, | 184 const LayerTreeSettings& settings, |
188 LayerTreeHostImplClient* client, | 185 LayerTreeHostImplClient* client, |
189 TaskRunnerProvider* task_runner_provider, | 186 TaskRunnerProvider* task_runner_provider, |
190 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 187 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
191 SharedBitmapManager* shared_bitmap_manager, | |
192 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
193 TaskGraphRunner* task_graph_runner, | 188 TaskGraphRunner* task_graph_runner, |
194 std::unique_ptr<AnimationHost> animation_host, | 189 std::unique_ptr<AnimationHost> animation_host, |
195 int id) | 190 int id) |
196 : client_(client), | 191 : client_(client), |
197 task_runner_provider_(task_runner_provider), | 192 task_runner_provider_(task_runner_provider), |
198 current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), | 193 current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), |
199 compositor_frame_sink_(nullptr), | 194 compositor_frame_sink_(nullptr), |
200 need_update_gpu_rasterization_status_(false), | 195 need_update_gpu_rasterization_status_(false), |
201 content_is_suitable_for_gpu_rasterization_(true), | 196 content_is_suitable_for_gpu_rasterization_(true), |
202 has_gpu_rasterization_trigger_(false), | 197 has_gpu_rasterization_trigger_(false), |
(...skipping 23 matching lines...) Expand all Loading... |
226 pinch_gesture_end_should_clear_scrolling_layer_(false), | 221 pinch_gesture_end_should_clear_scrolling_layer_(false), |
227 fps_counter_( | 222 fps_counter_( |
228 FrameRateCounter::Create(task_runner_provider_->HasImplThread())), | 223 FrameRateCounter::Create(task_runner_provider_->HasImplThread())), |
229 memory_history_(MemoryHistory::Create()), | 224 memory_history_(MemoryHistory::Create()), |
230 debug_rect_history_(DebugRectHistory::Create()), | 225 debug_rect_history_(DebugRectHistory::Create()), |
231 max_memory_needed_bytes_(0), | 226 max_memory_needed_bytes_(0), |
232 resourceless_software_draw_(false), | 227 resourceless_software_draw_(false), |
233 animation_host_(std::move(animation_host)), | 228 animation_host_(std::move(animation_host)), |
234 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 229 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
235 micro_benchmark_controller_(this), | 230 micro_benchmark_controller_(this), |
236 shared_bitmap_manager_(shared_bitmap_manager), | |
237 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | |
238 task_graph_runner_(task_graph_runner), | 231 task_graph_runner_(task_graph_runner), |
239 id_(id), | 232 id_(id), |
240 requires_high_res_to_draw_(false), | 233 requires_high_res_to_draw_(false), |
241 is_likely_to_require_a_draw_(false), | 234 is_likely_to_require_a_draw_(false), |
242 has_valid_compositor_frame_sink_(false), | 235 has_valid_compositor_frame_sink_(false), |
243 mutator_(nullptr) { | 236 mutator_(nullptr) { |
244 DCHECK(animation_host_); | 237 DCHECK(animation_host_); |
245 animation_host_->SetMutatorHostClient(this); | 238 animation_host_->SetMutatorHostClient(this); |
246 | 239 |
247 DCHECK(task_runner_provider_->IsImplThread()); | 240 DCHECK(task_runner_provider_->IsImplThread()); |
(...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2298 | 2291 |
2299 // When using software compositing, change to the limits specified for it. | 2292 // When using software compositing, change to the limits specified for it. |
2300 // Since this is a one way trip, we don't need to worry about going back to | 2293 // Since this is a one way trip, we don't need to worry about going back to |
2301 // GPU compositing. | 2294 // GPU compositing. |
2302 if (!compositor_frame_sink->context_provider()) | 2295 if (!compositor_frame_sink->context_provider()) |
2303 SetMemoryPolicy(settings_.software_memory_policy); | 2296 SetMemoryPolicy(settings_.software_memory_policy); |
2304 | 2297 |
2305 compositor_frame_sink_ = compositor_frame_sink; | 2298 compositor_frame_sink_ = compositor_frame_sink; |
2306 has_valid_compositor_frame_sink_ = true; | 2299 has_valid_compositor_frame_sink_ = true; |
2307 resource_provider_ = base::MakeUnique<ResourceProvider>( | 2300 resource_provider_ = base::MakeUnique<ResourceProvider>( |
2308 compositor_frame_sink_->context_provider(), shared_bitmap_manager_, | 2301 compositor_frame_sink_->context_provider(), |
2309 gpu_memory_buffer_manager_, | 2302 compositor_frame_sink_->shared_bitmap_manager(), |
| 2303 compositor_frame_sink_->gpu_memory_buffer_manager(), |
2310 task_runner_provider_->blocking_main_thread_task_runner(), | 2304 task_runner_provider_->blocking_main_thread_task_runner(), |
2311 settings_.renderer_settings.highp_threshold_min, | 2305 settings_.renderer_settings.highp_threshold_min, |
2312 settings_.renderer_settings.texture_id_allocation_chunk_size, | 2306 settings_.renderer_settings.texture_id_allocation_chunk_size, |
2313 compositor_frame_sink_->capabilities().delegated_sync_points_required, | 2307 compositor_frame_sink_->capabilities().delegated_sync_points_required, |
2314 settings_.renderer_settings.use_gpu_memory_buffer_resources, | 2308 settings_.renderer_settings.use_gpu_memory_buffer_resources, |
2315 settings_.enable_color_correct_rendering, | 2309 settings_.enable_color_correct_rendering, |
2316 settings_.renderer_settings.buffer_to_texture_target_map); | 2310 settings_.renderer_settings.buffer_to_texture_target_map); |
2317 | 2311 |
2318 // Make sure the main context visibility is restored. Worker context | 2312 // Make sure the main context visibility is restored. Worker context |
2319 // visibility will be set via the memory policy update in | 2313 // visibility will be set via the memory policy update in |
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4088 if (is_visible) { | 4082 if (is_visible) { |
4089 worker_context_visibility_ = | 4083 worker_context_visibility_ = |
4090 worker_context->CacheController()->ClientBecameVisible(); | 4084 worker_context->CacheController()->ClientBecameVisible(); |
4091 } else { | 4085 } else { |
4092 worker_context->CacheController()->ClientBecameNotVisible( | 4086 worker_context->CacheController()->ClientBecameNotVisible( |
4093 std::move(worker_context_visibility_)); | 4087 std::move(worker_context_visibility_)); |
4094 } | 4088 } |
4095 } | 4089 } |
4096 | 4090 |
4097 } // namespace cc | 4091 } // namespace cc |
OLD | NEW |