| 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 342 |
| 343 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { | 343 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { |
| 344 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); | 344 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); |
| 345 DCHECK(IsImplThread()); | 345 DCHECK(IsImplThread()); |
| 346 impl().scheduler->DidSwapBuffersComplete(); | 346 impl().scheduler->DidSwapBuffersComplete(); |
| 347 Proxy::MainThreadTaskRunner()->PostTask( | 347 Proxy::MainThreadTaskRunner()->PostTask( |
| 348 FROM_HERE, | 348 FROM_HERE, |
| 349 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); | 349 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); |
| 350 } | 350 } |
| 351 | 351 |
| 352 void ThreadProxy::SetNeedsBeginFrame(bool enable) { | 352 BeginFrameSource* ThreadProxy::ExternalBeginFrameSource() { |
| 353 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrame", "enable", enable); | 353 return impl().layer_tree_host_impl.get(); |
| 354 impl().layer_tree_host_impl->SetNeedsBeginFrame(enable); | |
| 355 UpdateBackgroundAnimateTicking(); | |
| 356 } | |
| 357 | |
| 358 void ThreadProxy::BeginFrame(const BeginFrameArgs& args) { | |
| 359 impl().scheduler->BeginFrame(args); | |
| 360 } | 354 } |
| 361 | 355 |
| 362 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { | 356 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { |
| 363 impl().layer_tree_host_impl->WillBeginImplFrame(args); | 357 impl().layer_tree_host_impl->WillBeginImplFrame(args); |
| 364 } | 358 } |
| 365 | 359 |
| 366 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 360 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
| 367 TRACE_EVENT1( | 361 TRACE_EVENT1( |
| 368 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 362 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
| 369 DCHECK(IsImplThread()); | 363 DCHECK(IsImplThread()); |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 completion->Signal(); | 1236 completion->Signal(); |
| 1243 } | 1237 } |
| 1244 | 1238 |
| 1245 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { | 1239 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
| 1246 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); | 1240 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
| 1247 DCHECK(IsImplThread()); | 1241 DCHECK(IsImplThread()); |
| 1248 DCHECK(IsMainThreadBlocked()); | 1242 DCHECK(IsMainThreadBlocked()); |
| 1249 layer_tree_host()->DeleteContentsTexturesOnImplThread( | 1243 layer_tree_host()->DeleteContentsTexturesOnImplThread( |
| 1250 impl().layer_tree_host_impl->resource_provider()); | 1244 impl().layer_tree_host_impl->resource_provider()); |
| 1251 impl().current_resource_update_controller = nullptr; | 1245 impl().current_resource_update_controller = nullptr; |
| 1252 impl().layer_tree_host_impl->SetNeedsBeginFrame(false); | 1246 impl().layer_tree_host_impl->SetNeedsBeginFrames(false); |
| 1253 impl().scheduler = nullptr; | 1247 impl().scheduler = nullptr; |
| 1254 impl().layer_tree_host_impl = nullptr; | 1248 impl().layer_tree_host_impl = nullptr; |
| 1255 impl().weak_factory.InvalidateWeakPtrs(); | 1249 impl().weak_factory.InvalidateWeakPtrs(); |
| 1256 // We need to explicitly cancel the notifier, since it isn't using weak ptrs. | 1250 // We need to explicitly cancel the notifier, since it isn't using weak ptrs. |
| 1257 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep | 1251 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep |
| 1258 // the convention of having a weak ptr factory initialized last. Alternatively | 1252 // the convention of having a weak ptr factory initialized last. Alternatively |
| 1259 // we should moved the notifier (and RenewTreePriority) to LTHI. See | 1253 // we should moved the notifier (and RenewTreePriority) to LTHI. See |
| 1260 // crbug.com/411972 | 1254 // crbug.com/411972 |
| 1261 impl().smoothness_priority_expiration_notifier.Cancel(); | 1255 impl().smoothness_priority_expiration_notifier.Cancel(); |
| 1262 impl().contents_texture_manager = NULL; | 1256 impl().contents_texture_manager = NULL; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1400 | 1394 |
| 1401 impl().timing_history.DidActivateSyncTree(); | 1395 impl().timing_history.DidActivateSyncTree(); |
| 1402 } | 1396 } |
| 1403 | 1397 |
| 1404 void ThreadProxy::DidManageTiles() { | 1398 void ThreadProxy::DidManageTiles() { |
| 1405 DCHECK(IsImplThread()); | 1399 DCHECK(IsImplThread()); |
| 1406 impl().scheduler->DidManageTiles(); | 1400 impl().scheduler->DidManageTiles(); |
| 1407 } | 1401 } |
| 1408 | 1402 |
| 1409 } // namespace cc | 1403 } // namespace cc |
| OLD | NEW |