| OLD | NEW |
| 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 30 matching lines...) Expand all Loading... |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 struct ThreadProxy::SchedulerStateRequest { | 43 struct ThreadProxy::SchedulerStateRequest { |
| 44 CompletionEvent completion; | 44 CompletionEvent completion; |
| 45 scoped_ptr<base::Value> state; | 45 scoped_ptr<base::Value> state; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 scoped_ptr<Proxy> ThreadProxy::Create( | 48 scoped_ptr<Proxy> ThreadProxy::Create( |
| 49 LayerTreeHost* layer_tree_host, | 49 LayerTreeHost* layer_tree_host, |
| 50 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 50 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 51 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { | 51 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| 52 return make_scoped_ptr( | 52 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
| 53 new ThreadProxy(layer_tree_host, main_task_runner, impl_task_runner)); | 53 return make_scoped_ptr(new ThreadProxy(layer_tree_host, |
| 54 main_task_runner, |
| 55 impl_task_runner, |
| 56 external_begin_frame_source.Pass())); |
| 54 } | 57 } |
| 55 | 58 |
| 56 ThreadProxy::ThreadProxy( | 59 ThreadProxy::ThreadProxy( |
| 57 LayerTreeHost* layer_tree_host, | 60 LayerTreeHost* layer_tree_host, |
| 58 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 61 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 59 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) | 62 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| 63 scoped_ptr<BeginFrameSource> external_begin_frame_source) |
| 60 : Proxy(main_task_runner, impl_task_runner), | 64 : Proxy(main_task_runner, impl_task_runner), |
| 61 main_thread_only_vars_unsafe_(this, layer_tree_host->id()), | 65 main_thread_only_vars_unsafe_(this, layer_tree_host->id()), |
| 62 main_thread_or_blocked_vars_unsafe_(layer_tree_host), | 66 main_thread_or_blocked_vars_unsafe_(layer_tree_host), |
| 63 compositor_thread_vars_unsafe_( | 67 compositor_thread_vars_unsafe_( |
| 64 this, | 68 this, |
| 65 layer_tree_host->id(), | 69 layer_tree_host->id(), |
| 66 layer_tree_host->rendering_stats_instrumentation()) { | 70 layer_tree_host->rendering_stats_instrumentation(), |
| 71 external_begin_frame_source.Pass()) { |
| 67 TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); | 72 TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); |
| 68 DCHECK(IsMainThread()); | 73 DCHECK(IsMainThread()); |
| 69 DCHECK(this->layer_tree_host()); | 74 DCHECK(this->layer_tree_host()); |
| 70 } | 75 } |
| 71 | 76 |
| 72 ThreadProxy::MainThreadOnly::MainThreadOnly(ThreadProxy* proxy, | 77 ThreadProxy::MainThreadOnly::MainThreadOnly(ThreadProxy* proxy, |
| 73 int layer_tree_host_id) | 78 int layer_tree_host_id) |
| 74 : layer_tree_host_id(layer_tree_host_id), | 79 : layer_tree_host_id(layer_tree_host_id), |
| 75 animate_requested(false), | 80 animate_requested(false), |
| 76 commit_requested(false), | 81 commit_requested(false), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 92 ThreadProxy::MainThreadOrBlockedMainThread::~MainThreadOrBlockedMainThread() {} | 97 ThreadProxy::MainThreadOrBlockedMainThread::~MainThreadOrBlockedMainThread() {} |
| 93 | 98 |
| 94 PrioritizedResourceManager* | 99 PrioritizedResourceManager* |
| 95 ThreadProxy::MainThreadOrBlockedMainThread::contents_texture_manager() { | 100 ThreadProxy::MainThreadOrBlockedMainThread::contents_texture_manager() { |
| 96 return layer_tree_host->contents_texture_manager(); | 101 return layer_tree_host->contents_texture_manager(); |
| 97 } | 102 } |
| 98 | 103 |
| 99 ThreadProxy::CompositorThreadOnly::CompositorThreadOnly( | 104 ThreadProxy::CompositorThreadOnly::CompositorThreadOnly( |
| 100 ThreadProxy* proxy, | 105 ThreadProxy* proxy, |
| 101 int layer_tree_host_id, | 106 int layer_tree_host_id, |
| 102 RenderingStatsInstrumentation* rendering_stats_instrumentation) | 107 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 108 scoped_ptr<BeginFrameSource> external_begin_frame_source) |
| 103 : layer_tree_host_id(layer_tree_host_id), | 109 : layer_tree_host_id(layer_tree_host_id), |
| 104 contents_texture_manager(NULL), | 110 contents_texture_manager(NULL), |
| 105 commit_completion_event(NULL), | 111 commit_completion_event(NULL), |
| 106 completion_event_for_commit_held_on_tree_activation(NULL), | 112 completion_event_for_commit_held_on_tree_activation(NULL), |
| 107 next_frame_is_newly_committed_frame(false), | 113 next_frame_is_newly_committed_frame(false), |
| 108 inside_draw(false), | 114 inside_draw(false), |
| 109 input_throttled_until_commit(false), | 115 input_throttled_until_commit(false), |
| 110 smoothness_priority_expiration_notifier( | 116 smoothness_priority_expiration_notifier( |
| 111 proxy->ImplThreadTaskRunner(), | 117 proxy->ImplThreadTaskRunner(), |
| 112 base::Bind(&ThreadProxy::RenewTreePriority, base::Unretained(proxy)), | 118 base::Bind(&ThreadProxy::RenewTreePriority, base::Unretained(proxy)), |
| 113 base::TimeDelta::FromMilliseconds( | 119 base::TimeDelta::FromMilliseconds( |
| 114 kSmoothnessTakesPriorityExpirationDelay * 1000)), | 120 kSmoothnessTakesPriorityExpirationDelay * 1000)), |
| 115 timing_history(rendering_stats_instrumentation), | 121 timing_history(rendering_stats_instrumentation), |
| 122 external_begin_frame_source(external_begin_frame_source.Pass()), |
| 116 weak_factory(proxy) { | 123 weak_factory(proxy) { |
| 117 } | 124 } |
| 118 | 125 |
| 119 ThreadProxy::CompositorThreadOnly::~CompositorThreadOnly() {} | 126 ThreadProxy::CompositorThreadOnly::~CompositorThreadOnly() {} |
| 120 | 127 |
| 121 ThreadProxy::~ThreadProxy() { | 128 ThreadProxy::~ThreadProxy() { |
| 122 TRACE_EVENT0("cc", "ThreadProxy::~ThreadProxy"); | 129 TRACE_EVENT0("cc", "ThreadProxy::~ThreadProxy"); |
| 123 DCHECK(IsMainThread()); | 130 DCHECK(IsMainThread()); |
| 124 DCHECK(!main().started); | 131 DCHECK(!main().started); |
| 125 } | 132 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 &completion, | 176 &completion, |
| 170 visible)); | 177 visible)); |
| 171 completion.Wait(); | 178 completion.Wait(); |
| 172 } | 179 } |
| 173 | 180 |
| 174 void ThreadProxy::SetVisibleOnImplThread(CompletionEvent* completion, | 181 void ThreadProxy::SetVisibleOnImplThread(CompletionEvent* completion, |
| 175 bool visible) { | 182 bool visible) { |
| 176 TRACE_EVENT0("cc", "ThreadProxy::SetVisibleOnImplThread"); | 183 TRACE_EVENT0("cc", "ThreadProxy::SetVisibleOnImplThread"); |
| 177 impl().layer_tree_host_impl->SetVisible(visible); | 184 impl().layer_tree_host_impl->SetVisible(visible); |
| 178 impl().scheduler->SetVisible(visible); | 185 impl().scheduler->SetVisible(visible); |
| 179 UpdateBackgroundAnimateTicking(); | |
| 180 completion->Signal(); | 186 completion->Signal(); |
| 181 } | 187 } |
| 182 | 188 |
| 183 void ThreadProxy::UpdateBackgroundAnimateTicking() { | |
| 184 bool should_background_tick = | |
| 185 !impl().scheduler->WillDrawIfNeeded() && | |
| 186 impl().layer_tree_host_impl->active_tree()->root_layer(); | |
| 187 impl().layer_tree_host_impl->UpdateBackgroundAnimateTicking( | |
| 188 should_background_tick); | |
| 189 } | |
| 190 | |
| 191 void ThreadProxy::DidLoseOutputSurface() { | 189 void ThreadProxy::DidLoseOutputSurface() { |
| 192 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurface"); | 190 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurface"); |
| 193 DCHECK(IsMainThread()); | 191 DCHECK(IsMainThread()); |
| 194 layer_tree_host()->DidLoseOutputSurface(); | 192 layer_tree_host()->DidLoseOutputSurface(); |
| 195 | 193 |
| 196 { | 194 { |
| 197 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 195 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
| 198 | 196 |
| 199 // Return lost resources to their owners immediately. | 197 // Return lost resources to their owners immediately. |
| 200 BlockingTaskRunner::CapturePostTasks blocked( | 198 BlockingTaskRunner::CapturePostTasks blocked( |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 336 |
| 339 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { | 337 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { |
| 340 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); | 338 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); |
| 341 DCHECK(IsImplThread()); | 339 DCHECK(IsImplThread()); |
| 342 impl().scheduler->DidSwapBuffersComplete(); | 340 impl().scheduler->DidSwapBuffersComplete(); |
| 343 Proxy::MainThreadTaskRunner()->PostTask( | 341 Proxy::MainThreadTaskRunner()->PostTask( |
| 344 FROM_HERE, | 342 FROM_HERE, |
| 345 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); | 343 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); |
| 346 } | 344 } |
| 347 | 345 |
| 348 BeginFrameSource* ThreadProxy::ExternalBeginFrameSource() { | |
| 349 return impl().layer_tree_host_impl.get(); | |
| 350 } | |
| 351 | |
| 352 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { | 346 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { |
| 353 impl().layer_tree_host_impl->WillBeginImplFrame(args); | 347 impl().layer_tree_host_impl->WillBeginImplFrame(args); |
| 354 } | 348 } |
| 355 | 349 |
| 356 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 350 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
| 357 TRACE_EVENT1( | 351 TRACE_EVENT1( |
| 358 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 352 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
| 359 DCHECK(IsImplThread()); | 353 DCHECK(IsImplThread()); |
| 360 impl().scheduler->SetCanDraw(can_draw); | 354 impl().scheduler->SetCanDraw(can_draw); |
| 361 UpdateBackgroundAnimateTicking(); | |
| 362 } | 355 } |
| 363 | 356 |
| 364 void ThreadProxy::NotifyReadyToActivate() { | 357 void ThreadProxy::NotifyReadyToActivate() { |
| 365 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToActivate"); | 358 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToActivate"); |
| 366 impl().scheduler->NotifyReadyToActivate(); | 359 impl().scheduler->NotifyReadyToActivate(); |
| 367 } | 360 } |
| 368 | 361 |
| 362 void ThreadProxy::NotifyReadyToDraw() { |
| 363 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToDraw"); |
| 364 impl().scheduler->NotifyReadyToDraw(); |
| 365 } |
| 366 |
| 369 void ThreadProxy::SetNeedsCommitOnImplThread() { | 367 void ThreadProxy::SetNeedsCommitOnImplThread() { |
| 370 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); | 368 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); |
| 371 DCHECK(IsImplThread()); | 369 DCHECK(IsImplThread()); |
| 372 impl().scheduler->SetNeedsCommit(); | 370 impl().scheduler->SetNeedsCommit(); |
| 373 } | 371 } |
| 374 | 372 |
| 375 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread( | 373 void ThreadProxy::PostAnimationEventsToMainThreadOnImplThread( |
| 376 scoped_ptr<AnimationEventsVector> events) { | 374 scoped_ptr<AnimationEventsVector> events) { |
| 377 TRACE_EVENT0("cc", | 375 TRACE_EVENT0("cc", |
| 378 "ThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); | 376 "ThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 blocking_main_thread_task_runner()); | 842 blocking_main_thread_task_runner()); |
| 845 | 843 |
| 846 CompletionEvent completion; | 844 CompletionEvent completion; |
| 847 Proxy::ImplThreadTaskRunner()->PostTask( | 845 Proxy::ImplThreadTaskRunner()->PostTask( |
| 848 FROM_HERE, | 846 FROM_HERE, |
| 849 base::Bind(&ThreadProxy::StartCommitOnImplThread, | 847 base::Bind(&ThreadProxy::StartCommitOnImplThread, |
| 850 impl_thread_weak_ptr_, | 848 impl_thread_weak_ptr_, |
| 851 &completion, | 849 &completion, |
| 852 queue.release())); | 850 queue.release())); |
| 853 completion.Wait(); | 851 completion.Wait(); |
| 854 | |
| 855 RenderingStatsInstrumentation* stats_instrumentation = | |
| 856 layer_tree_host()->rendering_stats_instrumentation(); | |
| 857 benchmark_instrumentation::IssueMainThreadRenderingStatsEvent( | |
| 858 stats_instrumentation->main_thread_rendering_stats()); | |
| 859 stats_instrumentation->AccumulateAndClearMainThreadStats(); | |
| 860 } | 852 } |
| 861 | 853 |
| 862 layer_tree_host()->CommitComplete(); | 854 layer_tree_host()->CommitComplete(); |
| 863 layer_tree_host()->DidBeginMainFrame(); | 855 layer_tree_host()->DidBeginMainFrame(); |
| 864 } | 856 } |
| 865 | 857 |
| 866 void ThreadProxy::StartCommitOnImplThread(CompletionEvent* completion, | 858 void ThreadProxy::StartCommitOnImplThread(CompletionEvent* completion, |
| 867 ResourceUpdateQueue* raw_queue) { | 859 ResourceUpdateQueue* raw_queue) { |
| 868 TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread"); | 860 TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread"); |
| 869 DCHECK(!impl().commit_completion_event); | 861 DCHECK(!impl().commit_completion_event); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 if (did_handle) | 918 if (did_handle) |
| 927 SetInputThrottledUntilCommitOnImplThread(false); | 919 SetInputThrottledUntilCommitOnImplThread(false); |
| 928 impl().layer_tree_host_impl->BeginMainFrameAborted(did_handle); | 920 impl().layer_tree_host_impl->BeginMainFrameAborted(did_handle); |
| 929 impl().scheduler->BeginMainFrameAborted(did_handle); | 921 impl().scheduler->BeginMainFrameAborted(did_handle); |
| 930 } | 922 } |
| 931 | 923 |
| 932 void ThreadProxy::ScheduledActionAnimate() { | 924 void ThreadProxy::ScheduledActionAnimate() { |
| 933 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate"); | 925 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionAnimate"); |
| 934 DCHECK(IsImplThread()); | 926 DCHECK(IsImplThread()); |
| 935 | 927 |
| 928 // Don't animate if there is no root layer. |
| 929 // TODO(mithro): Both Animate and UpdateAnimationState already have a |
| 930 // "!active_tree_->root_layer()" check? |
| 931 if (!impl().layer_tree_host_impl->active_tree()->root_layer()) { |
| 932 return; |
| 933 } |
| 934 |
| 936 impl().animation_time = | 935 impl().animation_time = |
| 937 impl().layer_tree_host_impl->CurrentBeginFrameArgs().frame_time; | 936 impl().layer_tree_host_impl->CurrentBeginFrameArgs().frame_time; |
| 938 impl().layer_tree_host_impl->Animate(impl().animation_time); | 937 impl().layer_tree_host_impl->Animate(impl().animation_time); |
| 938 |
| 939 // If animations are not visible, update the state now as |
| 940 // ScheduledActionDrawAndSwapIfPossible will never be called. |
| 941 if (!impl().layer_tree_host_impl->AnimationsAreVisible()) { |
| 942 impl().layer_tree_host_impl->UpdateAnimationState(true); |
| 943 } |
| 939 } | 944 } |
| 940 | 945 |
| 941 void ThreadProxy::ScheduledActionCommit() { | 946 void ThreadProxy::ScheduledActionCommit() { |
| 942 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit"); | 947 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit"); |
| 943 DCHECK(IsImplThread()); | 948 DCHECK(IsImplThread()); |
| 944 DCHECK(IsMainThreadBlocked()); | 949 DCHECK(IsMainThreadBlocked()); |
| 945 DCHECK(impl().commit_completion_event); | 950 DCHECK(impl().commit_completion_event); |
| 946 DCHECK(impl().current_resource_update_controller); | 951 DCHECK(impl().current_resource_update_controller); |
| 947 | 952 |
| 948 // Complete all remaining texture updates. | 953 // Complete all remaining texture updates. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 972 impl().commit_completion_event->Signal(); | 977 impl().commit_completion_event->Signal(); |
| 973 impl().commit_completion_event = NULL; | 978 impl().commit_completion_event = NULL; |
| 974 } | 979 } |
| 975 | 980 |
| 976 // Delay this step until afer the main thread has been released as it's | 981 // Delay this step until afer the main thread has been released as it's |
| 977 // often a good bit of work to update the tree and prepare the new frame. | 982 // often a good bit of work to update the tree and prepare the new frame. |
| 978 impl().layer_tree_host_impl->CommitComplete(); | 983 impl().layer_tree_host_impl->CommitComplete(); |
| 979 | 984 |
| 980 SetInputThrottledUntilCommitOnImplThread(false); | 985 SetInputThrottledUntilCommitOnImplThread(false); |
| 981 | 986 |
| 982 UpdateBackgroundAnimateTicking(); | |
| 983 | |
| 984 impl().next_frame_is_newly_committed_frame = true; | 987 impl().next_frame_is_newly_committed_frame = true; |
| 985 | 988 |
| 986 impl().timing_history.DidCommit(); | 989 impl().timing_history.DidCommit(); |
| 987 } | 990 } |
| 988 | 991 |
| 989 void ThreadProxy::ScheduledActionUpdateVisibleTiles() { | 992 void ThreadProxy::ScheduledActionUpdateVisibleTiles() { |
| 990 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionUpdateVisibleTiles"); | 993 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionUpdateVisibleTiles"); |
| 991 DCHECK(IsImplThread()); | 994 DCHECK(IsImplThread()); |
| 992 impl().layer_tree_host_impl->UpdateVisibleTiles(); | 995 impl().layer_tree_host_impl->UpdateVisibleTiles(); |
| 993 } | 996 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 DCHECK(IsMainThread()); | 1145 DCHECK(IsMainThread()); |
| 1143 layer_tree_host()->SetAnimationEvents(events.Pass()); | 1146 layer_tree_host()->SetAnimationEvents(events.Pass()); |
| 1144 } | 1147 } |
| 1145 | 1148 |
| 1146 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { | 1149 void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { |
| 1147 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); | 1150 TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); |
| 1148 DCHECK(IsImplThread()); | 1151 DCHECK(IsImplThread()); |
| 1149 impl().layer_tree_host_impl = | 1152 impl().layer_tree_host_impl = |
| 1150 layer_tree_host()->CreateLayerTreeHostImpl(this); | 1153 layer_tree_host()->CreateLayerTreeHostImpl(this); |
| 1151 SchedulerSettings scheduler_settings(layer_tree_host()->settings()); | 1154 SchedulerSettings scheduler_settings(layer_tree_host()->settings()); |
| 1152 impl().scheduler = Scheduler::Create(this, | 1155 impl().scheduler = Scheduler::Create( |
| 1153 scheduler_settings, | 1156 this, |
| 1154 impl().layer_tree_host_id, | 1157 scheduler_settings, |
| 1155 ImplThreadTaskRunner(), | 1158 impl().layer_tree_host_id, |
| 1156 base::PowerMonitor::Get()); | 1159 ImplThreadTaskRunner(), |
| 1160 base::PowerMonitor::Get(), |
| 1161 impl().external_begin_frame_source.Pass()); |
| 1157 impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible()); | 1162 impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible()); |
| 1158 | |
| 1159 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); | 1163 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); |
| 1160 completion->Signal(); | 1164 completion->Signal(); |
| 1161 } | 1165 } |
| 1162 | 1166 |
| 1163 void ThreadProxy::DeleteContentsTexturesOnImplThread( | 1167 void ThreadProxy::DeleteContentsTexturesOnImplThread( |
| 1164 CompletionEvent* completion) { | 1168 CompletionEvent* completion) { |
| 1165 TRACE_EVENT0("cc", "ThreadProxy::DeleteContentsTexturesOnImplThread"); | 1169 TRACE_EVENT0("cc", "ThreadProxy::DeleteContentsTexturesOnImplThread"); |
| 1166 DCHECK(IsImplThread()); | 1170 DCHECK(IsImplThread()); |
| 1167 DCHECK(IsMainThreadBlocked()); | 1171 DCHECK(IsMainThreadBlocked()); |
| 1168 layer_tree_host()->DeleteContentsTexturesOnImplThread( | 1172 layer_tree_host()->DeleteContentsTexturesOnImplThread( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 completion->Signal(); | 1210 completion->Signal(); |
| 1207 } | 1211 } |
| 1208 | 1212 |
| 1209 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { | 1213 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
| 1210 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); | 1214 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
| 1211 DCHECK(IsImplThread()); | 1215 DCHECK(IsImplThread()); |
| 1212 DCHECK(IsMainThreadBlocked()); | 1216 DCHECK(IsMainThreadBlocked()); |
| 1213 layer_tree_host()->DeleteContentsTexturesOnImplThread( | 1217 layer_tree_host()->DeleteContentsTexturesOnImplThread( |
| 1214 impl().layer_tree_host_impl->resource_provider()); | 1218 impl().layer_tree_host_impl->resource_provider()); |
| 1215 impl().current_resource_update_controller = nullptr; | 1219 impl().current_resource_update_controller = nullptr; |
| 1216 impl().layer_tree_host_impl->SetNeedsBeginFrames(false); | |
| 1217 impl().scheduler = nullptr; | 1220 impl().scheduler = nullptr; |
| 1218 impl().layer_tree_host_impl = nullptr; | 1221 impl().layer_tree_host_impl = nullptr; |
| 1219 impl().weak_factory.InvalidateWeakPtrs(); | 1222 impl().weak_factory.InvalidateWeakPtrs(); |
| 1220 // We need to explicitly shutdown the notifier to destroy any weakptrs it is | 1223 // We need to explicitly shutdown the notifier to destroy any weakptrs it is |
| 1221 // holding while still on the compositor thread. This also ensures any | 1224 // holding while still on the compositor thread. This also ensures any |
| 1222 // callbacks holding a ThreadProxy pointer are cancelled. | 1225 // callbacks holding a ThreadProxy pointer are cancelled. |
| 1223 impl().smoothness_priority_expiration_notifier.Shutdown(); | 1226 impl().smoothness_priority_expiration_notifier.Shutdown(); |
| 1224 impl().contents_texture_manager = NULL; | 1227 impl().contents_texture_manager = NULL; |
| 1225 completion->Signal(); | 1228 completion->Signal(); |
| 1226 } | 1229 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 DCHECK(IsImplThread()); | 1354 DCHECK(IsImplThread()); |
| 1352 | 1355 |
| 1353 if (impl().completion_event_for_commit_held_on_tree_activation) { | 1356 if (impl().completion_event_for_commit_held_on_tree_activation) { |
| 1354 TRACE_EVENT_INSTANT0( | 1357 TRACE_EVENT_INSTANT0( |
| 1355 "cc", "ReleaseCommitbyActivation", TRACE_EVENT_SCOPE_THREAD); | 1358 "cc", "ReleaseCommitbyActivation", TRACE_EVENT_SCOPE_THREAD); |
| 1356 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting); | 1359 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting); |
| 1357 impl().completion_event_for_commit_held_on_tree_activation->Signal(); | 1360 impl().completion_event_for_commit_held_on_tree_activation->Signal(); |
| 1358 impl().completion_event_for_commit_held_on_tree_activation = NULL; | 1361 impl().completion_event_for_commit_held_on_tree_activation = NULL; |
| 1359 } | 1362 } |
| 1360 | 1363 |
| 1361 UpdateBackgroundAnimateTicking(); | |
| 1362 | |
| 1363 impl().timing_history.DidActivateSyncTree(); | 1364 impl().timing_history.DidActivateSyncTree(); |
| 1364 } | 1365 } |
| 1365 | 1366 |
| 1366 void ThreadProxy::DidManageTiles() { | 1367 void ThreadProxy::DidManageTiles() { |
| 1367 DCHECK(IsImplThread()); | 1368 DCHECK(IsImplThread()); |
| 1368 impl().scheduler->DidManageTiles(); | 1369 impl().scheduler->DidManageTiles(); |
| 1369 } | 1370 } |
| 1370 | 1371 |
| 1371 } // namespace cc | 1372 } // namespace cc |
| OLD | NEW |