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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 } | 434 } |
435 | 435 |
436 void ThreadProxy::OnSwapBuffersCompleteOnImplThread() { | 436 void ThreadProxy::OnSwapBuffersCompleteOnImplThread() { |
437 TRACE_EVENT0("cc", "ThreadProxy::OnSwapBuffersCompleteOnImplThread"); | 437 TRACE_EVENT0("cc", "ThreadProxy::OnSwapBuffersCompleteOnImplThread"); |
438 DCHECK(IsImplThread()); | 438 DCHECK(IsImplThread()); |
439 Proxy::MainThreadTaskRunner()->PostTask( | 439 Proxy::MainThreadTaskRunner()->PostTask( |
440 FROM_HERE, | 440 FROM_HERE, |
441 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); | 441 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); |
442 } | 442 } |
443 | 443 |
444 void ThreadProxy::SetNeedsBeginImplFrame(bool enable) { | 444 void ThreadProxy::SetNeedsBeginFrame(bool enable) { |
445 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginImplFrame", "enable", enable); | 445 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrame", "enable", enable); |
446 DCHECK(IsImplThread()); | 446 impl().layer_tree_host_impl->SetNeedsBeginFrame(enable); |
447 impl().layer_tree_host_impl->SetNeedsBeginImplFrame(enable); | |
448 UpdateBackgroundAnimateTicking(); | 447 UpdateBackgroundAnimateTicking(); |
449 } | 448 } |
450 | 449 |
451 void ThreadProxy::BeginImplFrame(const BeginFrameArgs& args) { | 450 void ThreadProxy::BeginFrame(const BeginFrameArgs& args) { |
452 TRACE_EVENT0("cc", "ThreadProxy::BeginImplFrame"); | 451 impl().scheduler->BeginFrame(args); |
453 DCHECK(IsImplThread()); | 452 } |
454 | 453 |
455 // Sample the frame time now. This time will be used for updating animations | 454 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { |
456 // when we draw. | 455 impl().layer_tree_host_impl->WillBeginImplFrame(args); |
457 impl().layer_tree_host_impl->UpdateCurrentFrameTime(); | |
458 | |
459 impl().scheduler->BeginImplFrame(args); | |
460 } | 456 } |
461 | 457 |
462 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 458 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
463 TRACE_EVENT1( | 459 TRACE_EVENT1( |
464 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 460 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
465 DCHECK(IsImplThread()); | 461 DCHECK(IsImplThread()); |
466 impl().scheduler->SetCanDraw(can_draw); | 462 impl().scheduler->SetCanDraw(can_draw); |
467 UpdateBackgroundAnimateTicking(); | 463 UpdateBackgroundAnimateTicking(); |
468 } | 464 } |
469 | 465 |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 impl().layer_tree_host_impl->resource_provider()->Finish(); | 1485 impl().layer_tree_host_impl->resource_provider()->Finish(); |
1490 completion->Signal(); | 1486 completion->Signal(); |
1491 } | 1487 } |
1492 | 1488 |
1493 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { | 1489 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
1494 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); | 1490 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
1495 DCHECK(IsImplThread()); | 1491 DCHECK(IsImplThread()); |
1496 layer_tree_host()->DeleteContentsTexturesOnImplThread( | 1492 layer_tree_host()->DeleteContentsTexturesOnImplThread( |
1497 impl().layer_tree_host_impl->resource_provider()); | 1493 impl().layer_tree_host_impl->resource_provider()); |
1498 impl().current_resource_update_controller.reset(); | 1494 impl().current_resource_update_controller.reset(); |
1499 impl().layer_tree_host_impl->SetNeedsBeginImplFrame(false); | 1495 impl().layer_tree_host_impl->SetNeedsBeginFrame(false); |
1500 impl().scheduler.reset(); | 1496 impl().scheduler.reset(); |
1501 impl().layer_tree_host_impl.reset(); | 1497 impl().layer_tree_host_impl.reset(); |
1502 impl().weak_factory.InvalidateWeakPtrs(); | 1498 impl().weak_factory.InvalidateWeakPtrs(); |
1503 impl().contents_texture_manager = NULL; | 1499 impl().contents_texture_manager = NULL; |
1504 completion->Signal(); | 1500 completion->Signal(); |
1505 } | 1501 } |
1506 | 1502 |
1507 size_t ThreadProxy::MaxPartialTextureUpdates() const { | 1503 size_t ThreadProxy::MaxPartialTextureUpdates() const { |
1508 return ResourceUpdateController::MaxPartialTextureUpdates(); | 1504 return ResourceUpdateController::MaxPartialTextureUpdates(); |
1509 } | 1505 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 | 1690 |
1695 impl().timing_history.DidActivatePendingTree(); | 1691 impl().timing_history.DidActivatePendingTree(); |
1696 } | 1692 } |
1697 | 1693 |
1698 void ThreadProxy::DidManageTiles() { | 1694 void ThreadProxy::DidManageTiles() { |
1699 DCHECK(IsImplThread()); | 1695 DCHECK(IsImplThread()); |
1700 impl().scheduler->DidManageTiles(); | 1696 impl().scheduler->DidManageTiles(); |
1701 } | 1697 } |
1702 | 1698 |
1703 } // namespace cc | 1699 } // namespace cc |
OLD | NEW |