Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2841263002: [VSync Queue] Flush input in CommitComplete() (Closed)
Patch Set: danakj's comment: Also flush input in CommitComplete() Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 if (input_handler_client_ && impl_thread_phase_ == ImplThreadPhase::IDLE)
sunnyps 2017/05/03 18:37:13 nit: can you please add a comment explaining why w
chongz 2017/05/03 20:32:33 Done.
345 input_handler_client_->DeliverInputForBeginFrame();
346
343 UpdateSyncTreeAfterCommitOrImplSideInvalidation(); 347 UpdateSyncTreeAfterCommitOrImplSideInvalidation();
344 micro_benchmark_controller_.DidCompleteCommit(); 348 micro_benchmark_controller_.DidCompleteCommit();
345 } 349 }
346 350
347 void LayerTreeHostImpl::UpdateSyncTreeAfterCommitOrImplSideInvalidation() { 351 void LayerTreeHostImpl::UpdateSyncTreeAfterCommitOrImplSideInvalidation() {
348 sync_tree()->InvalidateRegionForImages( 352 sync_tree()->InvalidateRegionForImages(
349 tile_manager_.TakeImagesToInvalidateOnSyncTree()); 353 tile_manager_.TakeImagesToInvalidateOnSyncTree());
350 354
351 if (CommitToActiveTree()) { 355 if (CommitToActiveTree()) {
352 // We have to activate animations here or "IsActive()" is true on the layers 356 // 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
1903 SetNeedsRedraw(); 1907 SetNeedsRedraw();
1904 } 1908 }
1905 1909
1906 if (input_handler_client_) 1910 if (input_handler_client_)
1907 input_handler_client_->DeliverInputForBeginFrame(); 1911 input_handler_client_->DeliverInputForBeginFrame();
1908 1912
1909 Animate(); 1913 Animate();
1910 1914
1911 for (auto* it : video_frame_controllers_) 1915 for (auto* it : video_frame_controllers_)
1912 it->OnBeginFrame(args); 1916 it->OnBeginFrame(args);
1917
1918 impl_thread_phase_ = ImplThreadPhase::INSIDE_IMPL_FRAME;
1913 } 1919 }
1914 1920
1915 void LayerTreeHostImpl::DidFinishImplFrame() { 1921 void LayerTreeHostImpl::DidFinishImplFrame() {
1922 impl_thread_phase_ = ImplThreadPhase::IDLE;
1916 current_begin_frame_tracker_.Finish(); 1923 current_begin_frame_tracker_.Finish();
1917 decoded_image_tracker_.NotifyFrameFinished(); 1924 decoded_image_tracker_.NotifyFrameFinished();
1918 } 1925 }
1919 1926
1920 void LayerTreeHostImpl::UpdateViewportContainerSizes() { 1927 void LayerTreeHostImpl::UpdateViewportContainerSizes() {
1921 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); 1928 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer();
1922 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); 1929 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer();
1923 1930
1924 if (!inner_container) 1931 if (!inner_container)
1925 return; 1932 return;
(...skipping 2370 matching lines...) Expand 10 before | Expand all | Expand 10 after
4296 } 4303 }
4297 4304
4298 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) { 4305 void LayerTreeHostImpl::UpdateScrollSourceInfo(bool is_wheel_scroll) {
4299 if (is_wheel_scroll) 4306 if (is_wheel_scroll)
4300 has_scrolled_by_wheel_ = true; 4307 has_scrolled_by_wheel_ = true;
4301 else 4308 else
4302 has_scrolled_by_touch_ = true; 4309 has_scrolled_by_touch_ = true;
4303 } 4310 }
4304 4311
4305 } // namespace cc 4312 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698