| 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 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2295 | 2288 |
| 2296 // When using software compositing, change to the limits specified for it. | 2289 // When using software compositing, change to the limits specified for it. |
| 2297 // Since this is a one way trip, we don't need to worry about going back to | 2290 // Since this is a one way trip, we don't need to worry about going back to |
| 2298 // GPU compositing. | 2291 // GPU compositing. |
| 2299 if (!compositor_frame_sink->context_provider()) | 2292 if (!compositor_frame_sink->context_provider()) |
| 2300 SetMemoryPolicy(settings_.software_memory_policy); | 2293 SetMemoryPolicy(settings_.software_memory_policy); |
| 2301 | 2294 |
| 2302 compositor_frame_sink_ = compositor_frame_sink; | 2295 compositor_frame_sink_ = compositor_frame_sink; |
| 2303 has_valid_compositor_frame_sink_ = true; | 2296 has_valid_compositor_frame_sink_ = true; |
| 2304 resource_provider_ = base::MakeUnique<ResourceProvider>( | 2297 resource_provider_ = base::MakeUnique<ResourceProvider>( |
| 2305 compositor_frame_sink_->context_provider(), shared_bitmap_manager_, | 2298 compositor_frame_sink_->context_provider(), |
| 2306 gpu_memory_buffer_manager_, | 2299 compositor_frame_sink_->shared_bitmap_manager(), |
| 2300 compositor_frame_sink_->gpu_memory_buffer_manager(), |
| 2307 task_runner_provider_->blocking_main_thread_task_runner(), | 2301 task_runner_provider_->blocking_main_thread_task_runner(), |
| 2308 settings_.renderer_settings.highp_threshold_min, | 2302 settings_.renderer_settings.highp_threshold_min, |
| 2309 settings_.renderer_settings.texture_id_allocation_chunk_size, | 2303 settings_.renderer_settings.texture_id_allocation_chunk_size, |
| 2310 compositor_frame_sink_->capabilities().delegated_sync_points_required, | 2304 compositor_frame_sink_->capabilities().delegated_sync_points_required, |
| 2311 settings_.renderer_settings.use_gpu_memory_buffer_resources, | 2305 settings_.renderer_settings.use_gpu_memory_buffer_resources, |
| 2312 settings_.enable_color_correct_rendering, | 2306 settings_.enable_color_correct_rendering, |
| 2313 settings_.renderer_settings.buffer_to_texture_target_map); | 2307 settings_.renderer_settings.buffer_to_texture_target_map); |
| 2314 | 2308 |
| 2315 // Make sure the main context visibility is restored. Worker context | 2309 // Make sure the main context visibility is restored. Worker context |
| 2316 // visibility will be set via the memory policy update in | 2310 // visibility will be set via the memory policy update in |
| (...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4084 if (is_visible) { | 4078 if (is_visible) { |
| 4085 worker_context_visibility_ = | 4079 worker_context_visibility_ = |
| 4086 worker_context->CacheController()->ClientBecameVisible(); | 4080 worker_context->CacheController()->ClientBecameVisible(); |
| 4087 } else { | 4081 } else { |
| 4088 worker_context->CacheController()->ClientBecameNotVisible( | 4082 worker_context->CacheController()->ClientBecameNotVisible( |
| 4089 std::move(worker_context_visibility_)); | 4083 std::move(worker_context_visibility_)); |
| 4090 } | 4084 } |
| 4091 } | 4085 } |
| 4092 | 4086 |
| 4093 } // namespace cc | 4087 } // namespace cc |
| OLD | NEW |