| 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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 // request completes, and we signal completion here. If CanDraw() is false, we | 585 // request completes, and we signal completion here. If CanDraw() is false, we |
| 586 // will indicate success=false to the caller, but we must still signal | 586 // will indicate success=false to the caller, but we must still signal |
| 587 // completion to avoid deadlock. | 587 // completion to avoid deadlock. |
| 588 | 588 |
| 589 // We guard PrepareToDraw() with CanDraw() because it always returns a valid | 589 // We guard PrepareToDraw() with CanDraw() because it always returns a valid |
| 590 // frame, so can only be used when such a frame is possible. Since | 590 // frame, so can only be used when such a frame is possible. Since |
| 591 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on | 591 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on |
| 592 // CanDraw() as well. | 592 // CanDraw() as well. |
| 593 | 593 |
| 594 LayerTreeHostImpl::FrameData frame; | 594 LayerTreeHostImpl::FrameData frame; |
| 595 frame.begin_frame_ack = scheduler_->CurrentBeginFrameAckForActiveTree(); |
| 595 bool draw_frame = false; | 596 bool draw_frame = false; |
| 596 | 597 |
| 597 DrawResult result; | 598 DrawResult result; |
| 598 if (layer_tree_host_impl_->CanDraw()) { | 599 if (layer_tree_host_impl_->CanDraw()) { |
| 599 result = layer_tree_host_impl_->PrepareToDraw(&frame); | 600 result = layer_tree_host_impl_->PrepareToDraw(&frame); |
| 600 draw_frame = forced_draw || result == DRAW_SUCCESS; | 601 draw_frame = forced_draw || result == DRAW_SUCCESS; |
| 601 } else { | 602 } else { |
| 602 result = DRAW_ABORTED_CANT_DRAW; | 603 result = DRAW_ABORTED_CANT_DRAW; |
| 603 } | 604 } |
| 604 | 605 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { | 640 ProxyImpl::BlockedMainCommitOnly& ProxyImpl::blocked_main_commit() { |
| 640 DCHECK(IsMainThreadBlocked() && commit_completion_event_); | 641 DCHECK(IsMainThreadBlocked() && commit_completion_event_); |
| 641 return main_thread_blocked_commit_vars_unsafe_; | 642 return main_thread_blocked_commit_vars_unsafe_; |
| 642 } | 643 } |
| 643 | 644 |
| 644 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() { | 645 base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() { |
| 645 return task_runner_provider_->MainThreadTaskRunner(); | 646 return task_runner_provider_->MainThreadTaskRunner(); |
| 646 } | 647 } |
| 647 | 648 |
| 648 } // namespace cc | 649 } // namespace cc |
| OLD | NEW |