Chromium Code Reviews| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread"); | 426 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread"); |
| 427 DCHECK(IsImplThread()); | 427 DCHECK(IsImplThread()); |
| 428 if (!impl().layer_tree_host_impl->IsContextLost()) | 428 if (!impl().layer_tree_host_impl->IsContextLost()) |
| 429 return; | 429 return; |
| 430 if (ContextProvider* offscreen_contexts = | 430 if (ContextProvider* offscreen_contexts = |
| 431 impl().layer_tree_host_impl->offscreen_context_provider()) | 431 impl().layer_tree_host_impl->offscreen_context_provider()) |
| 432 offscreen_contexts->VerifyContexts(); | 432 offscreen_contexts->VerifyContexts(); |
| 433 impl().scheduler->DidLoseOutputSurface(); | 433 impl().scheduler->DidLoseOutputSurface(); |
| 434 } | 434 } |
| 435 | 435 |
| 436 void ThreadProxy::OnSwapBuffersCompleteOnImplThread() { | 436 void ThreadProxy::SetMaxSwapsPendingOnImplThread(int max) { |
|
danakj
2014/04/17 15:05:39
+enne FYI: STP will need to do this also.
| |
| 437 TRACE_EVENT0("cc", "ThreadProxy::OnSwapBuffersCompleteOnImplThread"); | 437 impl().scheduler->SetMaxSwapsPending(max); |
| 438 } | |
| 439 | |
| 440 void ThreadProxy::DidSwapBuffersOnImplThread() { | |
| 441 impl().scheduler->DidSwapBuffers(); | |
| 442 } | |
| 443 | |
| 444 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { | |
| 445 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); | |
| 438 DCHECK(IsImplThread()); | 446 DCHECK(IsImplThread()); |
| 447 impl().scheduler->DidSwapBuffersComplete(); | |
| 439 Proxy::MainThreadTaskRunner()->PostTask( | 448 Proxy::MainThreadTaskRunner()->PostTask( |
| 440 FROM_HERE, | 449 FROM_HERE, |
| 441 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); | 450 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); |
| 442 } | 451 } |
| 443 | 452 |
| 444 void ThreadProxy::SetNeedsBeginFrame(bool enable) { | 453 void ThreadProxy::SetNeedsBeginFrame(bool enable) { |
| 445 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrame", "enable", enable); | 454 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrame", "enable", enable); |
| 446 impl().layer_tree_host_impl->SetNeedsBeginFrame(enable); | 455 impl().layer_tree_host_impl->SetNeedsBeginFrame(enable); |
| 447 UpdateBackgroundAnimateTicking(); | 456 UpdateBackgroundAnimateTicking(); |
| 448 } | 457 } |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1230 result.did_readback = true; | 1239 result.did_readback = true; |
| 1231 } else { | 1240 } else { |
| 1232 result.draw_result = DrawSwapReadbackResult::DRAW_ABORTED_CONTEXT_LOST; | 1241 result.draw_result = DrawSwapReadbackResult::DRAW_ABORTED_CONTEXT_LOST; |
| 1233 } | 1242 } |
| 1234 } | 1243 } |
| 1235 impl().readback_request->success = result.did_readback; | 1244 impl().readback_request->success = result.did_readback; |
| 1236 impl().readback_request->completion.Signal(); | 1245 impl().readback_request->completion.Signal(); |
| 1237 impl().readback_request = NULL; | 1246 impl().readback_request = NULL; |
| 1238 } else if (draw_frame) { | 1247 } else if (draw_frame) { |
| 1239 DCHECK(swap_requested); | 1248 DCHECK(swap_requested); |
| 1240 result.did_swap = impl().layer_tree_host_impl->SwapBuffers(frame); | 1249 result.did_request_swap = impl().layer_tree_host_impl->SwapBuffers(frame); |
| 1241 | 1250 |
| 1242 // We don't know if we have incomplete tiles if we didn't actually swap. | 1251 // We don't know if we have incomplete tiles if we didn't actually swap. |
| 1243 if (result.did_swap) { | 1252 if (result.did_request_swap) { |
| 1244 DCHECK(!frame.has_no_damage); | 1253 DCHECK(!frame.has_no_damage); |
| 1245 SetSwapUsedIncompleteTileOnImplThread(frame.contains_incomplete_tile); | 1254 SetSwapUsedIncompleteTileOnImplThread(frame.contains_incomplete_tile); |
| 1246 } | 1255 } |
| 1247 } | 1256 } |
| 1248 | 1257 |
| 1249 // Tell the main thread that the the newly-commited frame was drawn. | 1258 // Tell the main thread that the the newly-commited frame was drawn. |
| 1250 if (impl().next_frame_is_newly_committed_frame) { | 1259 if (impl().next_frame_is_newly_committed_frame) { |
| 1251 impl().next_frame_is_newly_committed_frame = false; | 1260 impl().next_frame_is_newly_committed_frame = false; |
| 1252 Proxy::MainThreadTaskRunner()->PostTask( | 1261 Proxy::MainThreadTaskRunner()->PostTask( |
| 1253 FROM_HERE, | 1262 FROM_HERE, |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1687 | 1696 |
| 1688 impl().timing_history.DidActivatePendingTree(); | 1697 impl().timing_history.DidActivatePendingTree(); |
| 1689 } | 1698 } |
| 1690 | 1699 |
| 1691 void ThreadProxy::DidManageTiles() { | 1700 void ThreadProxy::DidManageTiles() { |
| 1692 DCHECK(IsImplThread()); | 1701 DCHECK(IsImplThread()); |
| 1693 impl().scheduler->DidManageTiles(); | 1702 impl().scheduler->DidManageTiles(); |
| 1694 } | 1703 } |
| 1695 | 1704 |
| 1696 } // namespace cc | 1705 } // namespace cc |
| OLD | NEW |