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

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

Issue 337693005: cc: Control defer_commits logic by Scheduler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 5 years, 10 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
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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 DCHECK(IsMainThread()); 444 DCHECK(IsMainThread());
445 if (main().defer_commits == defer_commits) 445 if (main().defer_commits == defer_commits)
446 return; 446 return;
447 447
448 main().defer_commits = defer_commits; 448 main().defer_commits = defer_commits;
449 if (main().defer_commits) 449 if (main().defer_commits)
450 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this); 450 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this);
451 else 451 else
452 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this); 452 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this);
453 453
454 if (!main().defer_commits && main().pending_deferred_commit) { 454 Proxy::ImplThreadTaskRunner()->PostTask(
455 Proxy::MainThreadTaskRunner()->PostTask( 455 FROM_HERE,
456 FROM_HERE, 456 base::Bind(&ThreadProxy::SetDeferCommitsOnImplThread,
457 base::Bind(&ThreadProxy::BeginMainFrame, 457 impl_thread_weak_ptr_,
458 main_thread_weak_ptr_, 458 defer_commits));
459 base::Passed(&main().pending_deferred_commit))); 459 }
460 } 460
461 void ThreadProxy::SetDeferCommitsOnImplThread(bool defer_commits) const {
462 DCHECK(IsImplThread());
463 impl().scheduler->SetDeferCommits(defer_commits);
461 } 464 }
462 465
463 bool ThreadProxy::CommitRequested() const { 466 bool ThreadProxy::CommitRequested() const {
464 DCHECK(IsMainThread()); 467 DCHECK(IsMainThread());
465 return main().commit_requested; 468 return main().commit_requested;
466 } 469 }
467 470
468 bool ThreadProxy::BeginMainFrameRequested() const { 471 bool ThreadProxy::BeginMainFrameRequested() const {
469 DCHECK(IsMainThread()); 472 DCHECK(IsMainThread());
470 return main().commit_request_sent_to_impl_thread; 473 return main().commit_request_sent_to_impl_thread;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 696
694 void ThreadProxy::BeginMainFrame( 697 void ThreadProxy::BeginMainFrame(
695 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { 698 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) {
696 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( 699 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task(
697 benchmark_instrumentation::kDoBeginFrame, 700 benchmark_instrumentation::kDoBeginFrame,
698 begin_main_frame_state->begin_frame_id); 701 begin_main_frame_state->begin_frame_id);
699 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); 702 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame");
700 DCHECK(IsMainThread()); 703 DCHECK(IsMainThread());
701 704
702 if (main().defer_commits) { 705 if (main().defer_commits) {
703 main().pending_deferred_commit = begin_main_frame_state.Pass(); 706 TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit",
704 layer_tree_host()->DidDeferCommit(); 707 TRACE_EVENT_SCOPE_THREAD);
705 TRACE_EVENT_INSTANT0( 708 Proxy::ImplThreadTaskRunner()->PostTask(
706 "cc", "EarlyOut_DeferCommits", TRACE_EVENT_SCOPE_THREAD); 709 FROM_HERE, base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread,
710 impl_thread_weak_ptr_,
711 CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT));
707 return; 712 return;
708 } 713 }
709 714
710 // If the commit finishes, LayerTreeHost will transfer its swap promises to 715 // If the commit finishes, LayerTreeHost will transfer its swap promises to
711 // LayerTreeImpl. The destructor of ScopedSwapPromiseChecker aborts the 716 // LayerTreeImpl. The destructor of ScopedSwapPromiseChecker aborts the
712 // remaining swap promises. 717 // remaining swap promises.
713 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host()); 718 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host());
714 719
715 main().commit_requested = false; 720 main().commit_requested = false;
716 main().commit_request_sent_to_impl_thread = false; 721 main().commit_request_sent_to_impl_thread = false;
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 } 1364 }
1360 1365
1361 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { 1366 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() {
1362 DCHECK(IsImplThread()); 1367 DCHECK(IsImplThread());
1363 Proxy::MainThreadTaskRunner()->PostTask( 1368 Proxy::MainThreadTaskRunner()->PostTask(
1364 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation, 1369 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation,
1365 main_thread_weak_ptr_)); 1370 main_thread_weak_ptr_));
1366 } 1371 }
1367 1372
1368 } // namespace cc 1373 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_unittest_context.cc ('K') | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698