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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 void ThreadProxy::NotifyReadyToActivate() { | 387 void ThreadProxy::NotifyReadyToActivate() { |
388 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToActivate"); | 388 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToActivate"); |
389 impl().scheduler->NotifyReadyToActivate(); | 389 impl().scheduler->NotifyReadyToActivate(); |
390 } | 390 } |
391 | 391 |
392 void ThreadProxy::NotifyReadyToDraw() { | 392 void ThreadProxy::NotifyReadyToDraw() { |
393 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToDraw"); | 393 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToDraw"); |
394 impl().scheduler->NotifyReadyToDraw(); | 394 impl().scheduler->NotifyReadyToDraw(); |
395 } | 395 } |
396 | 396 |
| 397 void ThreadProxy::SetRequiresHighResToDraw(bool required) { |
| 398 impl().scheduler->SetRequiresHighResToDraw(required); |
| 399 } |
| 400 |
397 void ThreadProxy::SetNeedsCommitOnImplThread() { | 401 void ThreadProxy::SetNeedsCommitOnImplThread() { |
398 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); | 402 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); |
399 DCHECK(IsImplThread()); | 403 DCHECK(IsImplThread()); |
400 impl().scheduler->SetNeedsCommit(); | 404 impl().scheduler->SetNeedsCommit(); |
401 } | 405 } |
402 | 406 |
403 void ThreadProxy::SetVideoNeedsBeginFrames(bool needs_begin_frames) { | 407 void ThreadProxy::SetVideoNeedsBeginFrames(bool needs_begin_frames) { |
404 TRACE_EVENT1("cc", "ThreadProxy::SetVideoNeedsBeginFrames", | 408 TRACE_EVENT1("cc", "ThreadProxy::SetVideoNeedsBeginFrames", |
405 "needs_begin_frames", needs_begin_frames); | 409 "needs_begin_frames", needs_begin_frames); |
406 DCHECK(IsImplThread()); | 410 DCHECK(IsImplThread()); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 DCHECK(IsImplThread()); | 507 DCHECK(IsImplThread()); |
504 impl().scheduler->SetNeedsRedraw(); | 508 impl().scheduler->SetNeedsRedraw(); |
505 } | 509 } |
506 | 510 |
507 void ThreadProxy::SetNeedsAnimateOnImplThread() { | 511 void ThreadProxy::SetNeedsAnimateOnImplThread() { |
508 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimateOnImplThread"); | 512 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimateOnImplThread"); |
509 DCHECK(IsImplThread()); | 513 DCHECK(IsImplThread()); |
510 impl().scheduler->SetNeedsAnimate(); | 514 impl().scheduler->SetNeedsAnimate(); |
511 } | 515 } |
512 | 516 |
513 void ThreadProxy::SetNeedsPrepareTilesOnImplThread() { | 517 void ThreadProxy::SetNeedsPrepareTilesOnImplThread(bool for_commit) { |
514 DCHECK(IsImplThread()); | 518 DCHECK(IsImplThread()); |
515 impl().scheduler->SetNeedsPrepareTiles(); | 519 impl().scheduler->SetNeedsPrepareTiles(for_commit); |
516 } | 520 } |
517 | 521 |
518 void ThreadProxy::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) { | 522 void ThreadProxy::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) { |
519 DCHECK(IsImplThread()); | 523 DCHECK(IsImplThread()); |
520 impl().layer_tree_host_impl->SetViewportDamage(damage_rect); | 524 impl().layer_tree_host_impl->SetViewportDamage(damage_rect); |
521 SetNeedsRedrawOnImplThread(); | 525 SetNeedsRedrawOnImplThread(); |
522 } | 526 } |
523 | 527 |
524 void ThreadProxy::MainThreadHasStoppedFlinging() { | 528 void ThreadProxy::MainThreadHasStoppedFlinging() { |
525 DCHECK(IsMainThread()); | 529 DCHECK(IsMainThread()); |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 DrawResult ThreadProxy::DrawSwapInternal(bool forced_draw) { | 1055 DrawResult ThreadProxy::DrawSwapInternal(bool forced_draw) { |
1052 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap"); | 1056 TRACE_EVENT_SYNTHETIC_DELAY("cc.DrawAndSwap"); |
1053 DrawResult result; | 1057 DrawResult result; |
1054 | 1058 |
1055 DCHECK(IsImplThread()); | 1059 DCHECK(IsImplThread()); |
1056 DCHECK(impl().layer_tree_host_impl.get()); | 1060 DCHECK(impl().layer_tree_host_impl.get()); |
1057 | 1061 |
1058 impl().timing_history.DidStartDrawing(); | 1062 impl().timing_history.DidStartDrawing(); |
1059 base::AutoReset<bool> mark_inside(&impl().inside_draw, true); | 1063 base::AutoReset<bool> mark_inside(&impl().inside_draw, true); |
1060 | 1064 |
1061 if (impl().layer_tree_host_impl->pending_tree()) { | |
1062 bool update_lcd_text = false; | |
1063 impl().layer_tree_host_impl->pending_tree()->UpdateDrawProperties( | |
1064 update_lcd_text); | |
1065 } | |
1066 | |
1067 // This method is called on a forced draw, regardless of whether we are able | 1065 // This method is called on a forced draw, regardless of whether we are able |
1068 // to produce a frame, as the calling site on main thread is blocked until its | 1066 // to produce a frame, as the calling site on main thread is blocked until its |
1069 // request completes, and we signal completion here. If CanDraw() is false, we | 1067 // request completes, and we signal completion here. If CanDraw() is false, we |
1070 // will indicate success=false to the caller, but we must still signal | 1068 // will indicate success=false to the caller, but we must still signal |
1071 // completion to avoid deadlock. | 1069 // completion to avoid deadlock. |
1072 | 1070 |
1073 // We guard PrepareToDraw() with CanDraw() because it always returns a valid | 1071 // We guard PrepareToDraw() with CanDraw() because it always returns a valid |
1074 // frame, so can only be used when such a frame is possible. Since | 1072 // frame, so can only be used when such a frame is possible. Since |
1075 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on | 1073 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on |
1076 // CanDraw() as well. | 1074 // CanDraw() as well. |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 | 1339 |
1342 // New content always takes priority when the active tree has | 1340 // New content always takes priority when the active tree has |
1343 // evicted resources or there is an invalid viewport size. | 1341 // evicted resources or there is an invalid viewport size. |
1344 if (impl().layer_tree_host_impl->active_tree()->ContentsTexturesPurged() || | 1342 if (impl().layer_tree_host_impl->active_tree()->ContentsTexturesPurged() || |
1345 impl().layer_tree_host_impl->active_tree()->ViewportSizeInvalid() || | 1343 impl().layer_tree_host_impl->active_tree()->ViewportSizeInvalid() || |
1346 impl().layer_tree_host_impl->EvictedUIResourcesExist() || | 1344 impl().layer_tree_host_impl->EvictedUIResourcesExist() || |
1347 impl().input_throttled_until_commit) { | 1345 impl().input_throttled_until_commit) { |
1348 // Once we enter NEW_CONTENTS_TAKES_PRIORITY mode, visible tiles on active | 1346 // Once we enter NEW_CONTENTS_TAKES_PRIORITY mode, visible tiles on active |
1349 // tree might be freed. We need to set RequiresHighResToDraw to ensure that | 1347 // tree might be freed. We need to set RequiresHighResToDraw to ensure that |
1350 // high res tiles will be required to activate pending tree. | 1348 // high res tiles will be required to activate pending tree. |
1351 impl().layer_tree_host_impl->SetRequiresHighResToDraw(); | 1349 impl().layer_tree_host_impl->SetRequiresHighResToDraw(true); |
1352 priority = NEW_CONTENT_TAKES_PRIORITY; | 1350 priority = NEW_CONTENT_TAKES_PRIORITY; |
1353 } | 1351 } |
1354 | 1352 |
1355 impl().layer_tree_host_impl->SetTreePriority(priority); | 1353 impl().layer_tree_host_impl->SetTreePriority(priority); |
1356 | 1354 |
1357 // Only put the scheduler in impl latency prioritization mode if we don't | 1355 // Only put the scheduler in impl latency prioritization mode if we don't |
1358 // have a scroll listener. This gives the scroll listener a better chance of | 1356 // have a scroll listener. This gives the scroll listener a better chance of |
1359 // handling scroll updates within the same frame. The tree itself is still | 1357 // handling scroll updates within the same frame. The tree itself is still |
1360 // kept in prefer smoothness mode to allow checkerboarding. | 1358 // kept in prefer smoothness mode to allow checkerboarding. |
1361 impl().scheduler->SetImplLatencyTakesPriority( | 1359 impl().scheduler->SetImplLatencyTakesPriority( |
(...skipping 26 matching lines...) Expand all Loading... |
1388 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting); | 1386 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting); |
1389 impl().completion_event_for_commit_held_on_tree_activation->Signal(); | 1387 impl().completion_event_for_commit_held_on_tree_activation->Signal(); |
1390 impl().completion_event_for_commit_held_on_tree_activation = NULL; | 1388 impl().completion_event_for_commit_held_on_tree_activation = NULL; |
1391 } | 1389 } |
1392 | 1390 |
1393 impl().timing_history.DidActivateSyncTree(); | 1391 impl().timing_history.DidActivateSyncTree(); |
1394 impl().last_processed_begin_main_frame_args = | 1392 impl().last_processed_begin_main_frame_args = |
1395 impl().last_begin_main_frame_args; | 1393 impl().last_begin_main_frame_args; |
1396 } | 1394 } |
1397 | 1395 |
1398 void ThreadProxy::DidPrepareTiles() { | |
1399 DCHECK(IsImplThread()); | |
1400 impl().scheduler->DidPrepareTiles(); | |
1401 } | |
1402 | |
1403 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { | 1396 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { |
1404 DCHECK(IsImplThread()); | 1397 DCHECK(IsImplThread()); |
1405 Proxy::MainThreadTaskRunner()->PostTask( | 1398 Proxy::MainThreadTaskRunner()->PostTask( |
1406 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation, | 1399 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation, |
1407 main_thread_weak_ptr_)); | 1400 main_thread_weak_ptr_)); |
1408 } | 1401 } |
1409 | 1402 |
1410 void ThreadProxy::OnDrawForOutputSurface() { | 1403 void ThreadProxy::OnDrawForOutputSurface() { |
1411 DCHECK(IsImplThread()); | 1404 DCHECK(IsImplThread()); |
1412 impl().scheduler->OnDrawForOutputSurface(); | 1405 impl().scheduler->OnDrawForOutputSurface(); |
1413 } | 1406 } |
1414 | 1407 |
1415 } // namespace cc | 1408 } // namespace cc |
OLD | NEW |