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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(new ThreadProxy(layer_tree_host, | 52 return make_scoped_ptr( |
53 main_task_runner, | 53 new ThreadProxy(layer_tree_host, main_task_runner, impl_task_runner)); |
54 impl_task_runner)).PassAs<Proxy>(); | |
55 } | 54 } |
56 | 55 |
57 ThreadProxy::ThreadProxy( | 56 ThreadProxy::ThreadProxy( |
58 LayerTreeHost* layer_tree_host, | 57 LayerTreeHost* layer_tree_host, |
59 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 58 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
60 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) | 59 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) |
61 : Proxy(main_task_runner, impl_task_runner), | 60 : Proxy(main_task_runner, impl_task_runner), |
62 main_thread_only_vars_unsafe_(this, layer_tree_host->id()), | 61 main_thread_only_vars_unsafe_(this, layer_tree_host->id()), |
63 main_thread_or_blocked_vars_unsafe_(layer_tree_host), | 62 main_thread_or_blocked_vars_unsafe_(layer_tree_host), |
64 compositor_thread_vars_unsafe_( | 63 compositor_thread_vars_unsafe_( |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 | 955 |
957 void ThreadProxy::ScheduledActionCommit() { | 956 void ThreadProxy::ScheduledActionCommit() { |
958 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit"); | 957 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionCommit"); |
959 DCHECK(IsImplThread()); | 958 DCHECK(IsImplThread()); |
960 DCHECK(IsMainThreadBlocked()); | 959 DCHECK(IsMainThreadBlocked()); |
961 DCHECK(impl().commit_completion_event); | 960 DCHECK(impl().commit_completion_event); |
962 DCHECK(impl().current_resource_update_controller); | 961 DCHECK(impl().current_resource_update_controller); |
963 | 962 |
964 // Complete all remaining texture updates. | 963 // Complete all remaining texture updates. |
965 impl().current_resource_update_controller->Finalize(); | 964 impl().current_resource_update_controller->Finalize(); |
966 impl().current_resource_update_controller.reset(); | 965 impl().current_resource_update_controller = nullptr; |
967 | 966 |
968 if (impl().animations_frozen_until_next_draw) { | 967 if (impl().animations_frozen_until_next_draw) { |
969 impl().animation_time = std::max( | 968 impl().animation_time = std::max( |
970 impl().animation_time, blocked_main().last_monotonic_frame_begin_time); | 969 impl().animation_time, blocked_main().last_monotonic_frame_begin_time); |
971 } | 970 } |
972 impl().did_commit_after_animating = true; | 971 impl().did_commit_after_animating = true; |
973 | 972 |
974 blocked_main().main_thread_inside_commit = true; | 973 blocked_main().main_thread_inside_commit = true; |
975 impl().layer_tree_host_impl->BeginCommit(); | 974 impl().layer_tree_host_impl->BeginCommit(); |
976 layer_tree_host()->BeginCommitOnImplThread(impl().layer_tree_host_impl.get()); | 975 layer_tree_host()->BeginCommitOnImplThread(impl().layer_tree_host_impl.get()); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 } | 1241 } |
1243 completion->Signal(); | 1242 completion->Signal(); |
1244 } | 1243 } |
1245 | 1244 |
1246 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { | 1245 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
1247 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); | 1246 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
1248 DCHECK(IsImplThread()); | 1247 DCHECK(IsImplThread()); |
1249 DCHECK(IsMainThreadBlocked()); | 1248 DCHECK(IsMainThreadBlocked()); |
1250 layer_tree_host()->DeleteContentsTexturesOnImplThread( | 1249 layer_tree_host()->DeleteContentsTexturesOnImplThread( |
1251 impl().layer_tree_host_impl->resource_provider()); | 1250 impl().layer_tree_host_impl->resource_provider()); |
1252 impl().current_resource_update_controller.reset(); | 1251 impl().current_resource_update_controller = nullptr; |
1253 impl().layer_tree_host_impl->SetNeedsBeginFrame(false); | 1252 impl().layer_tree_host_impl->SetNeedsBeginFrame(false); |
1254 impl().scheduler.reset(); | 1253 impl().scheduler = nullptr; |
1255 impl().layer_tree_host_impl.reset(); | 1254 impl().layer_tree_host_impl = nullptr; |
1256 impl().weak_factory.InvalidateWeakPtrs(); | 1255 impl().weak_factory.InvalidateWeakPtrs(); |
1257 // We need to explicitly cancel the notifier, since it isn't using weak ptrs. | 1256 // We need to explicitly cancel the notifier, since it isn't using weak ptrs. |
1258 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep | 1257 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep |
1259 // the convention of having a weak ptr factory initialized last. Alternatively | 1258 // the convention of having a weak ptr factory initialized last. Alternatively |
1260 // we should moved the notifier (and RenewTreePriority) to LTHI. See | 1259 // we should moved the notifier (and RenewTreePriority) to LTHI. See |
1261 // crbug.com/411972 | 1260 // crbug.com/411972 |
1262 impl().smoothness_priority_expiration_notifier.Cancel(); | 1261 impl().smoothness_priority_expiration_notifier.Cancel(); |
1263 impl().contents_texture_manager = NULL; | 1262 impl().contents_texture_manager = NULL; |
1264 completion->Signal(); | 1263 completion->Signal(); |
1265 } | 1264 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 | 1400 |
1402 impl().timing_history.DidActivateSyncTree(); | 1401 impl().timing_history.DidActivateSyncTree(); |
1403 } | 1402 } |
1404 | 1403 |
1405 void ThreadProxy::DidManageTiles() { | 1404 void ThreadProxy::DidManageTiles() { |
1406 DCHECK(IsImplThread()); | 1405 DCHECK(IsImplThread()); |
1407 impl().scheduler->DidManageTiles(); | 1406 impl().scheduler->DidManageTiles(); |
1408 } | 1407 } |
1409 | 1408 |
1410 } // namespace cc | 1409 } // namespace cc |
OLD | NEW |