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

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

Issue 2188133002: Scroll with Layers in views::ScrollView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-ScrollTrack
Patch Set: Add a test for the transform goop Created 4 years, 4 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
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/single_thread_proxy.h" 5 #include "cc/trees/single_thread_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/profiler/scoped_tracker.h" 9 #include "base/profiler/scoped_tracker.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 if (layer_tree_host_impl_->EvictedUIResourcesExist()) 247 if (layer_tree_host_impl_->EvictedUIResourcesExist())
248 layer_tree_host_->RecreateUIResources(); 248 layer_tree_host_->RecreateUIResources();
249 249
250 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 250 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
251 // is fixed. 251 // is fixed.
252 tracked_objects::ScopedTracker tracking_profile7( 252 tracked_objects::ScopedTracker tracking_profile7(
253 FROM_HERE_WITH_EXPLICIT_FUNCTION( 253 FROM_HERE_WITH_EXPLICIT_FUNCTION(
254 "461509 SingleThreadProxy::DoCommit7")); 254 "461509 SingleThreadProxy::DoCommit7"));
255 layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get()); 255 layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get());
256 256
257 #if DCHECK_IS_ON()
258 // In the single-threaded case, the scale and scroll deltas should never be
259 // touched on the impl layer tree.
260 std::unique_ptr<ScrollAndScaleSet> scroll_info =
261 layer_tree_host_impl_->ProcessScrollDeltas();
262 DCHECK(scroll_info->scrolls.empty());
263 DCHECK_EQ(1.f, scroll_info->page_scale_delta);
264 #endif
265
266 if (scheduler_on_impl_thread_) 257 if (scheduler_on_impl_thread_)
267 scheduler_on_impl_thread_->DidCommit(); 258 scheduler_on_impl_thread_->DidCommit();
268 259
269 layer_tree_host_impl_->CommitComplete(); 260 layer_tree_host_impl_->CommitComplete();
270 261
271 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 262 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509
272 // is fixed. 263 // is fixed.
273 tracked_objects::ScopedTracker tracking_profile8( 264 tracked_objects::ScopedTracker tracking_profile8(
274 FROM_HERE_WITH_EXPLICIT_FUNCTION( 265 FROM_HERE_WITH_EXPLICIT_FUNCTION(
275 "461509 SingleThreadProxy::DoCommit8")); 266 "461509 SingleThreadProxy::DoCommit8"));
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 // DoComposite could abort, but because this is a synchronous composite 573 // DoComposite could abort, but because this is a synchronous composite
583 // another draw will never be scheduled, so break remaining promises. 574 // another draw will never be scheduled, so break remaining promises.
584 layer_tree_host_impl_->active_tree()->BreakSwapPromises( 575 layer_tree_host_impl_->active_tree()->BreakSwapPromises(
585 SwapPromise::SWAP_FAILS); 576 SwapPromise::SWAP_FAILS);
586 577
587 DidFinishImplFrame(); 578 DidFinishImplFrame();
588 } 579 }
589 } 580 }
590 581
591 bool SingleThreadProxy::SupportsImplScrolling() const { 582 bool SingleThreadProxy::SupportsImplScrolling() const {
592 return false; 583 return false; // TODO(tapted): Should this return true?
Ian Vollick 2016/08/09 14:00:49 I think this should only return true if we're asyn
tapted 2016/08/10 05:39:04 Done.
593 } 584 }
594 585
595 bool SingleThreadProxy::ShouldComposite() const { 586 bool SingleThreadProxy::ShouldComposite() const {
596 DCHECK(task_runner_provider_->IsImplThread()); 587 DCHECK(task_runner_provider_->IsImplThread());
597 return layer_tree_host_impl_->visible() && 588 return layer_tree_host_impl_->visible() &&
598 layer_tree_host_impl_->CanDraw(); 589 layer_tree_host_impl_->CanDraw();
599 } 590 }
600 591
601 void SingleThreadProxy::ScheduleRequestNewOutputSurface() { 592 void SingleThreadProxy::ScheduleRequestNewOutputSurface() {
602 if (output_surface_creation_callback_.IsCancelled() && 593 if (output_surface_creation_callback_.IsCancelled() &&
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 // Prevent new commits from being requested inside DoBeginMainFrame. 786 // Prevent new commits from being requested inside DoBeginMainFrame.
796 // Note: We do not want to prevent SetNeedsAnimate from requesting 787 // Note: We do not want to prevent SetNeedsAnimate from requesting
797 // a commit here. 788 // a commit here.
798 commit_requested_ = true; 789 commit_requested_ = true;
799 790
800 DoBeginMainFrame(begin_frame_args); 791 DoBeginMainFrame(begin_frame_args);
801 } 792 }
802 793
803 void SingleThreadProxy::DoBeginMainFrame( 794 void SingleThreadProxy::DoBeginMainFrame(
804 const BeginFrameArgs& begin_frame_args) { 795 const BeginFrameArgs& begin_frame_args) {
796 std::unique_ptr<ScrollAndScaleSet> scroll_info =
797 layer_tree_host_impl_->ProcessScrollDeltas();
798 layer_tree_host_->ApplyScrollAndScale(scroll_info.get());
799
805 layer_tree_host_->WillBeginMainFrame(); 800 layer_tree_host_->WillBeginMainFrame();
806 layer_tree_host_->BeginMainFrame(begin_frame_args); 801 layer_tree_host_->BeginMainFrame(begin_frame_args);
807 layer_tree_host_->AnimateLayers(begin_frame_args.frame_time); 802 layer_tree_host_->AnimateLayers(begin_frame_args.frame_time);
808 layer_tree_host_->RequestMainFrameUpdate(); 803 layer_tree_host_->RequestMainFrameUpdate();
809 804
810 // New commits requested inside UpdateLayers should be respected. 805 // New commits requested inside UpdateLayers should be respected.
811 commit_requested_ = false; 806 commit_requested_ = false;
812 807
813 layer_tree_host_->UpdateLayers(); 808 layer_tree_host_->UpdateLayers();
814 809
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 void SingleThreadProxy::DidFinishImplFrame() { 878 void SingleThreadProxy::DidFinishImplFrame() {
884 layer_tree_host_impl_->DidFinishImplFrame(); 879 layer_tree_host_impl_->DidFinishImplFrame();
885 #if DCHECK_IS_ON() 880 #if DCHECK_IS_ON()
886 DCHECK(inside_impl_frame_) 881 DCHECK(inside_impl_frame_)
887 << "DidFinishImplFrame called while not inside an impl frame!"; 882 << "DidFinishImplFrame called while not inside an impl frame!";
888 inside_impl_frame_ = false; 883 inside_impl_frame_ = false;
889 #endif 884 #endif
890 } 885 }
891 886
892 } // namespace cc 887 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698