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

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 6 years 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 DCHECK(IsMainThread()); 430 DCHECK(IsMainThread());
431 if (main().defer_commits == defer_commits) 431 if (main().defer_commits == defer_commits)
432 return; 432 return;
433 433
434 main().defer_commits = defer_commits; 434 main().defer_commits = defer_commits;
435 if (main().defer_commits) 435 if (main().defer_commits)
436 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this); 436 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this);
437 else 437 else
438 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this); 438 TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::SetDeferCommits", this);
439 439
440 if (!main().defer_commits && main().pending_deferred_commit) { 440 Proxy::ImplThreadTaskRunner()->PostTask(
441 Proxy::MainThreadTaskRunner()->PostTask( 441 FROM_HERE,
442 FROM_HERE, 442 base::Bind(&ThreadProxy::SetDeferCommitsOnImplThread,
443 base::Bind(&ThreadProxy::BeginMainFrame, 443 impl_thread_weak_ptr_,
444 main_thread_weak_ptr_, 444 defer_commits));
445 base::Passed(&main().pending_deferred_commit))); 445
446 } 446 // When defer commit is turned off, we should start new BeginMainFrame to
447 // handle previous deferred BeginMainFrame.
448 if (!main().defer_commits)
449 SetNeedsCommit();
450 }
451
452 void ThreadProxy::SetDeferCommitsOnImplThread(bool defer_commits) const {
453 DCHECK(IsImplThread());
454 impl().scheduler->SetDeferCommits(defer_commits);
447 } 455 }
448 456
449 bool ThreadProxy::CommitRequested() const { 457 bool ThreadProxy::CommitRequested() const {
450 DCHECK(IsMainThread()); 458 DCHECK(IsMainThread());
451 return main().commit_requested; 459 return main().commit_requested;
452 } 460 }
453 461
454 bool ThreadProxy::BeginMainFrameRequested() const { 462 bool ThreadProxy::BeginMainFrameRequested() const {
455 DCHECK(IsMainThread()); 463 DCHECK(IsMainThread());
456 return main().commit_request_sent_to_impl_thread; 464 return main().commit_request_sent_to_impl_thread;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 687
680 void ThreadProxy::BeginMainFrame( 688 void ThreadProxy::BeginMainFrame(
681 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { 689 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) {
682 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( 690 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task(
683 benchmark_instrumentation::kDoBeginFrame, 691 benchmark_instrumentation::kDoBeginFrame,
684 begin_main_frame_state->begin_frame_id); 692 begin_main_frame_state->begin_frame_id);
685 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); 693 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame");
686 DCHECK(IsMainThread()); 694 DCHECK(IsMainThread());
687 695
688 if (main().defer_commits) { 696 if (main().defer_commits) {
689 main().pending_deferred_commit = begin_main_frame_state.Pass(); 697 TRACE_EVENT_INSTANT0("cc",
690 layer_tree_host()->DidDeferCommit(); 698 "EarlyOut_DeferCommits",
691 TRACE_EVENT_INSTANT0( 699 TRACE_EVENT_SCOPE_THREAD);
692 "cc", "EarlyOut_DeferCommits", TRACE_EVENT_SCOPE_THREAD); 700
701 bool did_handle = false;
702 Proxy::ImplThreadTaskRunner()->PostTask(
703 FROM_HERE,
704 base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread,
705 impl_thread_weak_ptr_,
706 did_handle));
693 return; 707 return;
694 } 708 }
695 709
696 // If the commit finishes, LayerTreeHost will transfer its swap promises to 710 // If the commit finishes, LayerTreeHost will transfer its swap promises to
697 // LayerTreeImpl. The destructor of ScopedSwapPromiseChecker aborts the 711 // LayerTreeImpl. The destructor of ScopedSwapPromiseChecker aborts the
698 // remaining swap promises. 712 // remaining swap promises.
699 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host()); 713 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host());
700 714
701 main().commit_requested = false; 715 main().commit_requested = false;
702 main().commit_request_sent_to_impl_thread = false; 716 main().commit_request_sent_to_impl_thread = false;
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 1355
1342 impl().timing_history.DidActivateSyncTree(); 1356 impl().timing_history.DidActivateSyncTree();
1343 } 1357 }
1344 1358
1345 void ThreadProxy::DidManageTiles() { 1359 void ThreadProxy::DidManageTiles() {
1346 DCHECK(IsImplThread()); 1360 DCHECK(IsImplThread());
1347 impl().scheduler->DidManageTiles(); 1361 impl().scheduler->DidManageTiles();
1348 } 1362 }
1349 1363
1350 } // namespace cc 1364 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_unittest.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