| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/proxy_impl.h" | 5 #include "cc/trees/proxy_impl.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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 } | 539 } |
| 540 | 540 |
| 541 DrawResult ProxyImpl::DrawInternal(bool forced_draw) { | 541 DrawResult ProxyImpl::DrawInternal(bool forced_draw) { |
| 542 TRACE_EVENT_SYNTHETIC_DELAY("cc.Draw"); | 542 TRACE_EVENT_SYNTHETIC_DELAY("cc.Draw"); |
| 543 | 543 |
| 544 DCHECK(IsImplThread()); | 544 DCHECK(IsImplThread()); |
| 545 DCHECK(layer_tree_host_impl_.get()); | 545 DCHECK(layer_tree_host_impl_.get()); |
| 546 | 546 |
| 547 base::AutoReset<bool> mark_inside(&inside_draw_, true); | 547 base::AutoReset<bool> mark_inside(&inside_draw_, true); |
| 548 | 548 |
| 549 if (layer_tree_host_impl_->pending_tree()) { | |
| 550 bool update_lcd_text = false; | |
| 551 layer_tree_host_impl_->pending_tree()->UpdateDrawProperties( | |
| 552 update_lcd_text); | |
| 553 } | |
| 554 | |
| 555 // This method is called on a forced draw, regardless of whether we are able | 549 // This method is called on a forced draw, regardless of whether we are able |
| 556 // to produce a frame, as the calling site on main thread is blocked until its | 550 // to produce a frame, as the calling site on main thread is blocked until its |
| 557 // request completes, and we signal completion here. If CanDraw() is false, we | 551 // request completes, and we signal completion here. If CanDraw() is false, we |
| 558 // will indicate success=false to the caller, but we must still signal | 552 // will indicate success=false to the caller, but we must still signal |
| 559 // completion to avoid deadlock. | 553 // completion to avoid deadlock. |
| 560 | 554 |
| 561 // We guard PrepareToDraw() with CanDraw() because it always returns a valid | 555 // We guard PrepareToDraw() with CanDraw() because it always returns a valid |
| 562 // frame, so can only be used when such a frame is possible. Since | 556 // frame, so can only be used when such a frame is possible. Since |
| 563 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on | 557 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on |
| 564 // CanDraw() as well. | 558 // CanDraw() as well. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 587 | 581 |
| 588 bool start_ready_animations = draw_frame; | 582 bool start_ready_animations = draw_frame; |
| 589 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); | 583 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); |
| 590 | 584 |
| 591 // Tell the main thread that the the newly-commited frame was drawn. | 585 // Tell the main thread that the the newly-commited frame was drawn. |
| 592 if (next_frame_is_newly_committed_frame_) { | 586 if (next_frame_is_newly_committed_frame_) { |
| 593 next_frame_is_newly_committed_frame_ = false; | 587 next_frame_is_newly_committed_frame_ = false; |
| 594 channel_impl_->DidCommitAndDrawFrame(); | 588 channel_impl_->DidCommitAndDrawFrame(); |
| 595 } | 589 } |
| 596 | 590 |
| 591 if (layer_tree_host_impl_->pending_tree()) { |
| 592 bool update_lcd_text = false; |
| 593 layer_tree_host_impl_->pending_tree()->UpdateDrawProperties( |
| 594 update_lcd_text); |
| 595 } |
| 596 |
| 597 DCHECK_NE(INVALID_RESULT, result); | 597 DCHECK_NE(INVALID_RESULT, result); |
| 598 return result; | 598 return result; |
| 599 } | 599 } |
| 600 | 600 |
| 601 bool ProxyImpl::IsImplThread() const { | 601 bool ProxyImpl::IsImplThread() const { |
| 602 return task_runner_provider_->IsImplThread(); | 602 return task_runner_provider_->IsImplThread(); |
| 603 } | 603 } |
| 604 | 604 |
| 605 bool ProxyImpl::IsMainThreadBlocked() const { | 605 bool ProxyImpl::IsMainThreadBlocked() const { |
| 606 return task_runner_provider_->IsMainThreadBlocked(); | 606 return task_runner_provider_->IsMainThreadBlocked(); |
| 607 } | 607 } |
| 608 | 608 |
| 609 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { | 609 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { |
| 610 DCHECK(IsMainThreadBlocked() && commit_completion_event_); | 610 DCHECK(IsMainThreadBlocked() && commit_completion_event_); |
| 611 return main_thread_blocked_commit_vars_unsafe_; | 611 return main_thread_blocked_commit_vars_unsafe_; |
| 612 } | 612 } |
| 613 | 613 |
| 614 } // namespace cc | 614 } // namespace cc |
| OLD | NEW |