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

Side by Side Diff: trunk/src/cc/trees/thread_proxy.cc

Issue 181383005: Revert 253439 "Make it possible to cancel commits following an a..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/cc/trees/layer_tree_host_unittest_animation.cc ('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/thread_proxy.h" 5 #include "cc/trees/thread_proxy.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 return main().renderer_capabilities_main_thread_copy; 374 return main().renderer_capabilities_main_thread_copy;
375 } 375 }
376 376
377 void ThreadProxy::SetNeedsAnimate() { 377 void ThreadProxy::SetNeedsAnimate() {
378 DCHECK(IsMainThread()); 378 DCHECK(IsMainThread());
379 if (main().animate_requested) 379 if (main().animate_requested)
380 return; 380 return;
381 381
382 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimate"); 382 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimate");
383 main().animate_requested = true; 383 main().animate_requested = true;
384 main().can_cancel_commit = true; 384 main().can_cancel_commit = false;
385 SendCommitRequestToImplThreadIfNeeded(); 385 SendCommitRequestToImplThreadIfNeeded();
386 } 386 }
387 387
388 void ThreadProxy::SetNeedsUpdateLayers() { 388 void ThreadProxy::SetNeedsUpdateLayers() {
389 DCHECK(IsMainThread()); 389 DCHECK(IsMainThread());
390 390
391 if (main().commit_request_sent_to_impl_thread) 391 if (main().commit_request_sent_to_impl_thread)
392 return; 392 return;
393 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsUpdateLayers"); 393 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsUpdateLayers");
394 394
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 make_scoped_ptr(new ResourceUpdateQueue); 904 make_scoped_ptr(new ResourceUpdateQueue);
905 905
906 bool updated = layer_tree_host()->UpdateLayers(queue.get()); 906 bool updated = layer_tree_host()->UpdateLayers(queue.get());
907 907
908 // Once single buffered layers are committed, they cannot be modified until 908 // Once single buffered layers are committed, they cannot be modified until
909 // they are drawn by the impl thread. 909 // they are drawn by the impl thread.
910 main().textures_acquired = false; 910 main().textures_acquired = false;
911 911
912 layer_tree_host()->WillCommit(); 912 layer_tree_host()->WillCommit();
913 913
914 // Before calling animate, we set main().animate_requested to false. If it is
915 // true now, it means SetNeedAnimate was called again, but during a state when
916 // main().commit_request_sent_to_impl_thread = true. We need to force that
917 // call to happen again now so that the commit request is sent to the impl
918 // thread.
919 if (main().animate_requested) {
920 // Forces SetNeedsAnimate to consider posting a commit task.
921 main().animate_requested = false;
922 SetNeedsAnimate();
923 }
924
925 if (!updated && can_cancel_this_commit) { 914 if (!updated && can_cancel_this_commit) {
926 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoUpdates", TRACE_EVENT_SCOPE_THREAD); 915 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoUpdates", TRACE_EVENT_SCOPE_THREAD);
927 bool did_handle = true; 916 bool did_handle = true;
928 Proxy::ImplThreadTaskRunner()->PostTask( 917 Proxy::ImplThreadTaskRunner()->PostTask(
929 FROM_HERE, 918 FROM_HERE,
930 base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread, 919 base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread,
931 impl_thread_weak_ptr_, 920 impl_thread_weak_ptr_,
932 did_handle)); 921 did_handle));
933 922
934 // Although the commit is internally aborted, this is because it has been 923 // Although the commit is internally aborted, this is because it has been
935 // detected to be a no-op. From the perspective of an embedder, this commit 924 // detected to be a no-op. From the perspective of an embedder, this commit
936 // went through, and input should no longer be throttled, etc. 925 // went through, and input should no longer be throttled, etc.
937 layer_tree_host()->CommitComplete(); 926 layer_tree_host()->CommitComplete();
938 layer_tree_host()->DidBeginMainFrame(); 927 layer_tree_host()->DidBeginMainFrame();
939 return; 928 return;
940 } 929 }
941 930
931 // Before calling animate, we set main().animate_requested to false. If it is
932 // true
933 // now, it means SetNeedAnimate was called again, but during a state when
934 // main().commit_request_sent_to_impl_thread = true. We need to force that
935 // call to
936 // happen again now so that the commit request is sent to the impl thread.
937 if (main().animate_requested) {
938 // Forces SetNeedsAnimate to consider posting a commit task.
939 main().animate_requested = false;
940 SetNeedsAnimate();
941 }
942
942 scoped_refptr<ContextProvider> offscreen_context_provider; 943 scoped_refptr<ContextProvider> offscreen_context_provider;
943 if (main().renderer_capabilities_main_thread_copy.using_offscreen_context3d && 944 if (main().renderer_capabilities_main_thread_copy.using_offscreen_context3d &&
944 layer_tree_host()->needs_offscreen_context()) { 945 layer_tree_host()->needs_offscreen_context()) {
945 offscreen_context_provider = 946 offscreen_context_provider =
946 layer_tree_host()->client()->OffscreenContextProvider(); 947 layer_tree_host()->client()->OffscreenContextProvider();
947 if (offscreen_context_provider.get()) 948 if (offscreen_context_provider.get())
948 main().created_offscreen_context_provider = true; 949 main().created_offscreen_context_provider = true;
949 } 950 }
950 951
951 // Notify the impl thread that the main thread is ready to commit. This will 952 // Notify the impl thread that the main thread is ready to commit. This will
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 1733
1733 impl().timing_history.DidActivatePendingTree(); 1734 impl().timing_history.DidActivatePendingTree();
1734 } 1735 }
1735 1736
1736 void ThreadProxy::DidManageTiles() { 1737 void ThreadProxy::DidManageTiles() {
1737 DCHECK(IsImplThread()); 1738 DCHECK(IsImplThread());
1738 impl().scheduler->DidManageTiles(); 1739 impl().scheduler->DidManageTiles();
1739 } 1740 }
1740 1741
1741 } // namespace cc 1742 } // namespace cc
OLDNEW
« no previous file with comments | « trunk/src/cc/trees/layer_tree_host_unittest_animation.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698