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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 // to produce a frame, as the calling site on main thread is blocked until its | 1043 // to produce a frame, as the calling site on main thread is blocked until its |
1044 // request completes, and we signal completion here. If CanDraw() is false, we | 1044 // request completes, and we signal completion here. If CanDraw() is false, we |
1045 // will indicate success=false to the caller, but we must still signal | 1045 // will indicate success=false to the caller, but we must still signal |
1046 // completion to avoid deadlock. | 1046 // completion to avoid deadlock. |
1047 | 1047 |
1048 // We guard PrepareToDraw() with CanDraw() because it always returns a valid | 1048 // We guard PrepareToDraw() with CanDraw() because it always returns a valid |
1049 // frame, so can only be used when such a frame is possible. Since | 1049 // frame, so can only be used when such a frame is possible. Since |
1050 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on | 1050 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on |
1051 // CanDraw() as well. | 1051 // CanDraw() as well. |
1052 | 1052 |
1053 LayerTreeHostImpl::FrameData frame; | 1053 FrameData frame; |
1054 bool draw_frame = false; | 1054 bool draw_frame = false; |
1055 | 1055 |
1056 if (impl().layer_tree_host_impl->CanDraw()) { | 1056 if (impl().layer_tree_host_impl->CanDraw()) { |
1057 result = impl().layer_tree_host_impl->PrepareToDraw(&frame); | 1057 result = impl().layer_tree_host_impl->PrepareToDraw(&frame); |
1058 draw_frame = forced_draw || result == DRAW_SUCCESS; | 1058 draw_frame = forced_draw || result == DRAW_SUCCESS; |
1059 } else { | 1059 } else { |
1060 result = DRAW_ABORTED_CANT_DRAW; | 1060 result = DRAW_ABORTED_CANT_DRAW; |
1061 } | 1061 } |
1062 | 1062 |
1063 if (draw_frame) { | 1063 if (draw_frame) { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 } | 1363 } |
1364 | 1364 |
1365 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { | 1365 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { |
1366 DCHECK(IsImplThread()); | 1366 DCHECK(IsImplThread()); |
1367 Proxy::MainThreadTaskRunner()->PostTask( | 1367 Proxy::MainThreadTaskRunner()->PostTask( |
1368 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation, | 1368 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation, |
1369 main_thread_weak_ptr_)); | 1369 main_thread_weak_ptr_)); |
1370 } | 1370 } |
1371 | 1371 |
1372 } // namespace cc | 1372 } // namespace cc |
OLD | NEW |