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

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

Issue 139053002: cc: Release main thread earlier (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename inside_commit Created 6 years, 11 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 <string> 7 #include <string>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 commit_requested_(false), 85 commit_requested_(false),
86 commit_request_sent_to_impl_thread_(false), 86 commit_request_sent_to_impl_thread_(false),
87 created_offscreen_context_provider_(false), 87 created_offscreen_context_provider_(false),
88 layer_tree_host_unsafe_(layer_tree_host), 88 layer_tree_host_unsafe_(layer_tree_host),
89 contents_texture_manager_unsafe_(NULL), 89 contents_texture_manager_unsafe_(NULL),
90 started_(false), 90 started_(false),
91 textures_acquired_(true), 91 textures_acquired_(true),
92 in_composite_and_readback_(false), 92 in_composite_and_readback_(false),
93 manage_tiles_pending_(false), 93 manage_tiles_pending_(false),
94 commit_waits_for_activation_(false), 94 commit_waits_for_activation_(false),
95 inside_commit_(false), 95 main_thread_inside_commit_(false),
96 begin_main_frame_sent_completion_event_on_impl_thread_(NULL), 96 begin_main_frame_sent_completion_event_on_impl_thread_(NULL),
97 readback_request_on_impl_thread_(NULL), 97 readback_request_on_impl_thread_(NULL),
98 commit_completion_event_on_impl_thread_(NULL), 98 commit_completion_event_on_impl_thread_(NULL),
99 completion_event_for_commit_held_on_tree_activation_(NULL), 99 completion_event_for_commit_held_on_tree_activation_(NULL),
100 texture_acquisition_completion_event_on_impl_thread_(NULL), 100 texture_acquisition_completion_event_on_impl_thread_(NULL),
101 next_frame_is_newly_committed_frame_on_impl_thread_(false), 101 next_frame_is_newly_committed_frame_on_impl_thread_(false),
102 throttle_frame_production_( 102 throttle_frame_production_(
103 layer_tree_host->settings().throttle_frame_production), 103 layer_tree_host->settings().throttle_frame_production),
104 begin_impl_frame_scheduling_enabled_( 104 begin_impl_frame_scheduling_enabled_(
105 layer_tree_host->settings().begin_impl_frame_scheduling_enabled), 105 layer_tree_host->settings().begin_impl_frame_scheduling_enabled),
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedraw"); 513 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedraw");
514 Proxy::ImplThreadTaskRunner()->PostTask( 514 Proxy::ImplThreadTaskRunner()->PostTask(
515 FROM_HERE, 515 FROM_HERE,
516 base::Bind(&ThreadProxy::SetNeedsRedrawRectOnImplThread, 516 base::Bind(&ThreadProxy::SetNeedsRedrawRectOnImplThread,
517 impl_thread_weak_ptr_, 517 impl_thread_weak_ptr_,
518 damage_rect)); 518 damage_rect));
519 } 519 }
520 520
521 void ThreadProxy::SetNextCommitWaitsForActivation() { 521 void ThreadProxy::SetNextCommitWaitsForActivation() {
522 DCHECK(IsMainThread()); 522 DCHECK(IsMainThread());
523 DCHECK(!inside_commit_); 523 DCHECK(!main_thread_inside_commit_);
524 commit_waits_for_activation_ = true; 524 commit_waits_for_activation_ = true;
525 } 525 }
526 526
527 void ThreadProxy::SetDeferCommits(bool defer_commits) { 527 void ThreadProxy::SetDeferCommits(bool defer_commits) {
528 DCHECK(IsMainThread()); 528 DCHECK(IsMainThread());
529 DCHECK_NE(defer_commits_, defer_commits); 529 DCHECK_NE(defer_commits_, defer_commits);
530 defer_commits_ = defer_commits; 530 defer_commits_ = defer_commits;
531 531
532 if (defer_commits_) 532 if (defer_commits_)
533 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this); 533 TRACE_EVENT_ASYNC_BEGIN0("cc", "ThreadProxy::SetDeferCommits", this);
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 void ThreadProxy::ScheduledActionCommit() { 1011 void ThreadProxy::ScheduledActionCommit() {
1012 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit"); 1012 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit");
1013 DCHECK(IsImplThread()); 1013 DCHECK(IsImplThread());
1014 DCHECK(commit_completion_event_on_impl_thread_); 1014 DCHECK(commit_completion_event_on_impl_thread_);
1015 DCHECK(current_resource_update_controller_on_impl_thread_); 1015 DCHECK(current_resource_update_controller_on_impl_thread_);
1016 1016
1017 // Complete all remaining texture updates. 1017 // Complete all remaining texture updates.
1018 current_resource_update_controller_on_impl_thread_->Finalize(); 1018 current_resource_update_controller_on_impl_thread_->Finalize();
1019 current_resource_update_controller_on_impl_thread_.reset(); 1019 current_resource_update_controller_on_impl_thread_.reset();
1020 1020
1021 inside_commit_ = true; 1021 main_thread_inside_commit_ = true;
1022 layer_tree_host_impl_->BeginCommit(); 1022 layer_tree_host_impl_->BeginCommit();
1023 layer_tree_host()->BeginCommitOnImplThread(layer_tree_host_impl_.get()); 1023 layer_tree_host()->BeginCommitOnImplThread(layer_tree_host_impl_.get());
1024 layer_tree_host()->FinishCommitOnImplThread(layer_tree_host_impl_.get()); 1024 layer_tree_host()->FinishCommitOnImplThread(layer_tree_host_impl_.get());
1025 layer_tree_host_impl_->CommitComplete(); 1025 main_thread_inside_commit_ = false;
1026 inside_commit_ = false;
1027
1028 SetInputThrottledUntilCommitOnImplThread(false);
1029
1030 UpdateBackgroundAnimateTicking();
1031
1032 next_frame_is_newly_committed_frame_on_impl_thread_ = true;
1033 1026
1034 if (layer_tree_host()->settings().impl_side_painting && 1027 if (layer_tree_host()->settings().impl_side_painting &&
1035 commit_waits_for_activation_) { 1028 commit_waits_for_activation_) {
1036 // For some layer types in impl-side painting, the commit is held until 1029 // For some layer types in impl-side painting, the commit is held until
1037 // the pending tree is activated. It's also possible that the 1030 // the pending tree is activated. It's also possible that the
1038 // pending tree has already activated if there was no work to be done. 1031 // pending tree has already activated if there was no work to be done.
1039 TRACE_EVENT_INSTANT0("cc", "HoldCommit", TRACE_EVENT_SCOPE_THREAD); 1032 TRACE_EVENT_INSTANT0("cc", "HoldCommit", TRACE_EVENT_SCOPE_THREAD);
1040 completion_event_for_commit_held_on_tree_activation_ = 1033 completion_event_for_commit_held_on_tree_activation_ =
1041 commit_completion_event_on_impl_thread_; 1034 commit_completion_event_on_impl_thread_;
1042 commit_completion_event_on_impl_thread_ = NULL; 1035 commit_completion_event_on_impl_thread_ = NULL;
1043 } else { 1036 } else {
1044 commit_completion_event_on_impl_thread_->Signal(); 1037 commit_completion_event_on_impl_thread_->Signal();
1045 commit_completion_event_on_impl_thread_ = NULL; 1038 commit_completion_event_on_impl_thread_ = NULL;
1046 } 1039 }
1047 1040
1041 // Delay this step until afer the main thread has been released as it's
1042 // often a good bit of work to update the tree and prepare the new frame.
1043 layer_tree_host_impl_->CommitComplete();
1044
1045 SetInputThrottledUntilCommitOnImplThread(false);
1046
1047 UpdateBackgroundAnimateTicking();
1048
1049 next_frame_is_newly_committed_frame_on_impl_thread_ = true;
1048 commit_waits_for_activation_ = false; 1050 commit_waits_for_activation_ = false;
1049 1051
1050 commit_complete_time_ = base::TimeTicks::HighResNow(); 1052 commit_complete_time_ = base::TimeTicks::HighResNow();
1051 begin_main_frame_to_commit_duration_history_.InsertSample( 1053 begin_main_frame_to_commit_duration_history_.InsertSample(
1052 commit_complete_time_ - begin_main_frame_sent_time_); 1054 commit_complete_time_ - begin_main_frame_sent_time_);
1053 1055
1054 // SetVisible kicks off the next scheduler action, so this must be last. 1056 // SetVisible kicks off the next scheduler action, so this must be last.
1055 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); 1057 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
1056 } 1058 }
1057 1059
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 commit_to_activate_duration_history_.InsertSample( 1648 commit_to_activate_duration_history_.InsertSample(
1647 base::TimeTicks::HighResNow() - commit_complete_time_); 1649 base::TimeTicks::HighResNow() - commit_complete_time_);
1648 } 1650 }
1649 1651
1650 void ThreadProxy::DidManageTiles() { 1652 void ThreadProxy::DidManageTiles() {
1651 DCHECK(IsImplThread()); 1653 DCHECK(IsImplThread());
1652 scheduler_on_impl_thread_->DidManageTiles(); 1654 scheduler_on_impl_thread_->DidManageTiles();
1653 } 1655 }
1654 1656
1655 } // namespace cc 1657 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_unittest_delegated.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