| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 micro_benchmark_controller_(this), | 235 micro_benchmark_controller_(this), |
| 236 task_graph_runner_(task_graph_runner), | 236 task_graph_runner_(task_graph_runner), |
| 237 id_(id), | 237 id_(id), |
| 238 requires_high_res_to_draw_(false), | 238 requires_high_res_to_draw_(false), |
| 239 is_likely_to_require_a_draw_(false), | 239 is_likely_to_require_a_draw_(false), |
| 240 has_valid_compositor_frame_sink_(false), | 240 has_valid_compositor_frame_sink_(false), |
| 241 mutator_(nullptr), | 241 mutator_(nullptr), |
| 242 scroll_animating_latched_node_id_(ScrollTree::kInvalidNodeId), | 242 scroll_animating_latched_node_id_(ScrollTree::kInvalidNodeId), |
| 243 has_scrolled_by_wheel_(false), | 243 has_scrolled_by_wheel_(false), |
| 244 has_scrolled_by_touch_(false), | 244 has_scrolled_by_touch_(false), |
| 245 touchpad_and_wheel_scroll_latching_enabled_(false) { | 245 touchpad_and_wheel_scroll_latching_enabled_(false), |
| 246 impl_thread_phase_(ImplThreadPhase::IDLE) { |
| 246 DCHECK(mutator_host_); | 247 DCHECK(mutator_host_); |
| 247 mutator_host_->SetMutatorHostClient(this); | 248 mutator_host_->SetMutatorHostClient(this); |
| 248 | 249 |
| 249 DCHECK(task_runner_provider_->IsImplThread()); | 250 DCHECK(task_runner_provider_->IsImplThread()); |
| 250 DidVisibilityChange(this, visible_); | 251 DidVisibilityChange(this, visible_); |
| 251 | 252 |
| 252 SetDebugState(settings.initial_debug_state); | 253 SetDebugState(settings.initial_debug_state); |
| 253 | 254 |
| 254 // LTHI always has an active tree. | 255 // LTHI always has an active tree. |
| 255 active_tree_ = base::MakeUnique<LayerTreeImpl>( | 256 active_tree_ = base::MakeUnique<LayerTreeImpl>( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 if (compositor_frame_sink_) | 334 if (compositor_frame_sink_) |
| 334 compositor_frame_sink_->ForceReclaimResources(); | 335 compositor_frame_sink_->ForceReclaimResources(); |
| 335 | 336 |
| 336 if (!CommitToActiveTree()) | 337 if (!CommitToActiveTree()) |
| 337 CreatePendingTree(); | 338 CreatePendingTree(); |
| 338 } | 339 } |
| 339 | 340 |
| 340 void LayerTreeHostImpl::CommitComplete() { | 341 void LayerTreeHostImpl::CommitComplete() { |
| 341 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); | 342 TRACE_EVENT0("cc", "LayerTreeHostImpl::CommitComplete"); |
| 342 | 343 |
| 344 // In high latency mode commit cannot finish within the same frame. We need to |
| 345 // flush input here to make sure they got picked up by |PrepareTiles()|. |
| 346 if (input_handler_client_ && impl_thread_phase_ == ImplThreadPhase::IDLE) |
| 347 input_handler_client_->DeliverInputForBeginFrame(); |
| 348 |
| 343 UpdateSyncTreeAfterCommitOrImplSideInvalidation(); | 349 UpdateSyncTreeAfterCommitOrImplSideInvalidation(); |
| 344 micro_benchmark_controller_.DidCompleteCommit(); | 350 micro_benchmark_controller_.DidCompleteCommit(); |
| 345 } | 351 } |
| 346 | 352 |
| 347 void LayerTreeHostImpl::UpdateSyncTreeAfterCommitOrImplSideInvalidation() { | 353 void LayerTreeHostImpl::UpdateSyncTreeAfterCommitOrImplSideInvalidation() { |
| 348 sync_tree()->InvalidateRegionForImages( | 354 sync_tree()->InvalidateRegionForImages( |
| 349 tile_manager_.TakeImagesToInvalidateOnSyncTree()); | 355 tile_manager_.TakeImagesToInvalidateOnSyncTree()); |
| 350 | 356 |
| 351 if (CommitToActiveTree()) { | 357 if (CommitToActiveTree()) { |
| 352 // We have to activate animations here or "IsActive()" is true on the layers | 358 // We have to activate animations here or "IsActive()" is true on the layers |
| (...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 SetNeedsRedraw(); | 1909 SetNeedsRedraw(); |
| 1904 } | 1910 } |
| 1905 | 1911 |
| 1906 if (input_handler_client_) | 1912 if (input_handler_client_) |
| 1907 input_handler_client_->DeliverInputForBeginFrame(); | 1913 input_handler_client_->DeliverInputForBeginFrame(); |
| 1908 | 1914 |
| 1909 Animate(); | 1915 Animate(); |
| 1910 | 1916 |
| 1911 for (auto* it : video_frame_controllers_) | 1917 for (auto* it : video_frame_controllers_) |
| 1912 it->OnBeginFrame(args); | 1918 it->OnBeginFrame(args); |
| 1919 |
| 1920 impl_thread_phase_ = ImplThreadPhase::INSIDE_IMPL_FRAME; |
| 1913 } | 1921 } |
| 1914 | 1922 |
| 1915 void LayerTreeHostImpl::DidFinishImplFrame() { | 1923 void LayerTreeHostImpl::DidFinishImplFrame() { |
| 1924 impl_thread_phase_ = ImplThreadPhase::IDLE; |
| 1916 current_begin_frame_tracker_.Finish(); | 1925 current_begin_frame_tracker_.Finish(); |
| 1917 decoded_image_tracker_.NotifyFrameFinished(); | 1926 decoded_image_tracker_.NotifyFrameFinished(); |
| 1918 } | 1927 } |
| 1919 | 1928 |
| 1920 void LayerTreeHostImpl::UpdateViewportContainerSizes() { | 1929 void LayerTreeHostImpl::UpdateViewportContainerSizes() { |
| 1921 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); | 1930 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); |
| 1922 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); | 1931 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); |
| 1923 | 1932 |
| 1924 if (!inner_container) | 1933 if (!inner_container) |
| 1925 return; | 1934 return; |
| (...skipping 2370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4296 } | 4305 } |
| 4297 | 4306 |
| 4298 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { | 4307 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { |
| 4299 if (is_wheel_scroll) | 4308 if (is_wheel_scroll) |
| 4300 has_scrolled_by_wheel_ = true; | 4309 has_scrolled_by_wheel_ = true; |
| 4301 else | 4310 else |
| 4302 has_scrolled_by_touch_ = true; | 4311 has_scrolled_by_touch_ = true; |
| 4303 } | 4312 } |
| 4304 | 4313 |
| 4305 } // namespace cc | 4314 } // namespace cc |
| OLD | NEW |