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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 } | 436 } |
437 | 437 |
438 void ThreadProxy::OnSwapBuffersCompleteOnImplThread() { | 438 void ThreadProxy::OnSwapBuffersCompleteOnImplThread() { |
439 TRACE_EVENT0("cc", "ThreadProxy::OnSwapBuffersCompleteOnImplThread"); | 439 TRACE_EVENT0("cc", "ThreadProxy::OnSwapBuffersCompleteOnImplThread"); |
440 DCHECK(IsImplThread()); | 440 DCHECK(IsImplThread()); |
441 Proxy::MainThreadTaskRunner()->PostTask( | 441 Proxy::MainThreadTaskRunner()->PostTask( |
442 FROM_HERE, | 442 FROM_HERE, |
443 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); | 443 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); |
444 } | 444 } |
445 | 445 |
446 void ThreadProxy::SetNeedsBeginImplFrame(bool enable) { | 446 void ThreadProxy::SetNeedsBeginFrame(bool enable) { |
447 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginImplFrame", "enable", enable); | 447 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrame", "enable", enable); |
448 DCHECK(IsImplThread()); | 448 impl().layer_tree_host_impl->SetNeedsBeginFrame(enable); |
449 impl().layer_tree_host_impl->SetNeedsBeginImplFrame(enable); | |
450 UpdateBackgroundAnimateTicking(); | 449 UpdateBackgroundAnimateTicking(); |
451 } | 450 } |
452 | 451 |
453 void ThreadProxy::BeginImplFrame(const BeginFrameArgs& args) { | 452 void ThreadProxy::BeginFrame(const BeginFrameArgs& args) { |
454 TRACE_EVENT0("cc", "ThreadProxy::BeginImplFrame"); | 453 impl().scheduler->BeginFrame(args); |
455 DCHECK(IsImplThread()); | 454 } |
456 | 455 |
457 // Sample the frame time now. This time will be used for updating animations | 456 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { |
458 // when we draw. | 457 impl().layer_tree_host_impl->WillBeginImplFrame(args); |
459 impl().layer_tree_host_impl->UpdateCurrentFrameTime(); | |
460 | |
461 impl().scheduler->BeginImplFrame(args); | |
462 } | 458 } |
463 | 459 |
464 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 460 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
465 TRACE_EVENT1( | 461 TRACE_EVENT1( |
466 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 462 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
467 DCHECK(IsImplThread()); | 463 DCHECK(IsImplThread()); |
468 impl().scheduler->SetCanDraw(can_draw); | 464 impl().scheduler->SetCanDraw(can_draw); |
469 UpdateBackgroundAnimateTicking(); | 465 UpdateBackgroundAnimateTicking(); |
470 } | 466 } |
471 | 467 |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 impl().layer_tree_host_impl->resource_provider()->Finish(); | 1532 impl().layer_tree_host_impl->resource_provider()->Finish(); |
1537 completion->Signal(); | 1533 completion->Signal(); |
1538 } | 1534 } |
1539 | 1535 |
1540 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { | 1536 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { |
1541 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); | 1537 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); |
1542 DCHECK(IsImplThread()); | 1538 DCHECK(IsImplThread()); |
1543 layer_tree_host()->DeleteContentsTexturesOnImplThread( | 1539 layer_tree_host()->DeleteContentsTexturesOnImplThread( |
1544 impl().layer_tree_host_impl->resource_provider()); | 1540 impl().layer_tree_host_impl->resource_provider()); |
1545 impl().current_resource_update_controller.reset(); | 1541 impl().current_resource_update_controller.reset(); |
1546 impl().layer_tree_host_impl->SetNeedsBeginImplFrame(false); | 1542 impl().layer_tree_host_impl->SetNeedsBeginFrame(false); |
1547 impl().scheduler.reset(); | 1543 impl().scheduler.reset(); |
1548 impl().layer_tree_host_impl.reset(); | 1544 impl().layer_tree_host_impl.reset(); |
1549 impl().weak_factory.InvalidateWeakPtrs(); | 1545 impl().weak_factory.InvalidateWeakPtrs(); |
1550 impl().contents_texture_manager = NULL; | 1546 impl().contents_texture_manager = NULL; |
1551 completion->Signal(); | 1547 completion->Signal(); |
1552 } | 1548 } |
1553 | 1549 |
1554 size_t ThreadProxy::MaxPartialTextureUpdates() const { | 1550 size_t ThreadProxy::MaxPartialTextureUpdates() const { |
1555 return ResourceUpdateController::MaxPartialTextureUpdates(); | 1551 return ResourceUpdateController::MaxPartialTextureUpdates(); |
1556 } | 1552 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 | 1737 |
1742 impl().timing_history.DidActivatePendingTree(); | 1738 impl().timing_history.DidActivatePendingTree(); |
1743 } | 1739 } |
1744 | 1740 |
1745 void ThreadProxy::DidManageTiles() { | 1741 void ThreadProxy::DidManageTiles() { |
1746 DCHECK(IsImplThread()); | 1742 DCHECK(IsImplThread()); |
1747 impl().scheduler->DidManageTiles(); | 1743 impl().scheduler->DidManageTiles(); |
1748 } | 1744 } |
1749 | 1745 |
1750 } // namespace cc | 1746 } // namespace cc |
OLD | NEW |