| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 void ThreadProxy::NotifyReadyToActivate() { | 388 void ThreadProxy::NotifyReadyToActivate() { |
| 389 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToActivate"); | 389 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToActivate"); |
| 390 impl().scheduler->NotifyReadyToActivate(); | 390 impl().scheduler->NotifyReadyToActivate(); |
| 391 } | 391 } |
| 392 | 392 |
| 393 void ThreadProxy::NotifyReadyToDraw() { | 393 void ThreadProxy::NotifyReadyToDraw() { |
| 394 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToDraw"); | 394 TRACE_EVENT0("cc", "ThreadProxy::NotifyReadyToDraw"); |
| 395 impl().scheduler->NotifyReadyToDraw(); | 395 impl().scheduler->NotifyReadyToDraw(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void ThreadProxy::SetRequiresHighResToDraw(bool required) { |
| 399 impl().scheduler->SetRequiresHighResToDraw(required); |
| 400 } |
| 401 |
| 398 void ThreadProxy::SetNeedsCommitOnImplThread() { | 402 void ThreadProxy::SetNeedsCommitOnImplThread() { |
| 399 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); | 403 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommitOnImplThread"); |
| 400 DCHECK(IsImplThread()); | 404 DCHECK(IsImplThread()); |
| 401 impl().scheduler->SetNeedsCommit(); | 405 impl().scheduler->SetNeedsCommit(); |
| 402 } | 406 } |
| 403 | 407 |
| 404 void ThreadProxy::SetVideoNeedsBeginFrames(bool needs_begin_frames) { | 408 void ThreadProxy::SetVideoNeedsBeginFrames(bool needs_begin_frames) { |
| 405 TRACE_EVENT1("cc", "ThreadProxy::SetVideoNeedsBeginFrames", | 409 TRACE_EVENT1("cc", "ThreadProxy::SetVideoNeedsBeginFrames", |
| 406 "needs_begin_frames", needs_begin_frames); | 410 "needs_begin_frames", needs_begin_frames); |
| 407 DCHECK(IsImplThread()); | 411 DCHECK(IsImplThread()); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 DCHECK(IsImplThread()); | 508 DCHECK(IsImplThread()); |
| 505 impl().scheduler->SetNeedsRedraw(); | 509 impl().scheduler->SetNeedsRedraw(); |
| 506 } | 510 } |
| 507 | 511 |
| 508 void ThreadProxy::SetNeedsAnimateOnImplThread() { | 512 void ThreadProxy::SetNeedsAnimateOnImplThread() { |
| 509 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimateOnImplThread"); | 513 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimateOnImplThread"); |
| 510 DCHECK(IsImplThread()); | 514 DCHECK(IsImplThread()); |
| 511 impl().scheduler->SetNeedsAnimate(); | 515 impl().scheduler->SetNeedsAnimate(); |
| 512 } | 516 } |
| 513 | 517 |
| 514 void ThreadProxy::SetNeedsPrepareTilesOnImplThread() { | 518 void ThreadProxy::SetNeedsPrepareTilesOnImplThread(bool for_commit) { |
| 515 DCHECK(IsImplThread()); | 519 DCHECK(IsImplThread()); |
| 516 impl().scheduler->SetNeedsPrepareTiles(); | 520 impl().scheduler->SetNeedsPrepareTiles(for_commit); |
| 517 } | 521 } |
| 518 | 522 |
| 519 void ThreadProxy::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) { | 523 void ThreadProxy::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) { |
| 520 DCHECK(IsImplThread()); | 524 DCHECK(IsImplThread()); |
| 521 impl().layer_tree_host_impl->SetViewportDamage(damage_rect); | 525 impl().layer_tree_host_impl->SetViewportDamage(damage_rect); |
| 522 SetNeedsRedrawOnImplThread(); | 526 SetNeedsRedrawOnImplThread(); |
| 523 } | 527 } |
| 524 | 528 |
| 525 void ThreadProxy::MainThreadHasStoppedFlinging() { | 529 void ThreadProxy::MainThreadHasStoppedFlinging() { |
| 526 DCHECK(IsMainThread()); | 530 DCHECK(IsMainThread()); |
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 | 1346 |
| 1343 // New content always takes priority when the active tree has | 1347 // New content always takes priority when the active tree has |
| 1344 // evicted resources or there is an invalid viewport size. | 1348 // evicted resources or there is an invalid viewport size. |
| 1345 if (impl().layer_tree_host_impl->active_tree()->ContentsTexturesPurged() || | 1349 if (impl().layer_tree_host_impl->active_tree()->ContentsTexturesPurged() || |
| 1346 impl().layer_tree_host_impl->active_tree()->ViewportSizeInvalid() || | 1350 impl().layer_tree_host_impl->active_tree()->ViewportSizeInvalid() || |
| 1347 impl().layer_tree_host_impl->EvictedUIResourcesExist() || | 1351 impl().layer_tree_host_impl->EvictedUIResourcesExist() || |
| 1348 impl().input_throttled_until_commit) { | 1352 impl().input_throttled_until_commit) { |
| 1349 // Once we enter NEW_CONTENTS_TAKES_PRIORITY mode, visible tiles on active | 1353 // Once we enter NEW_CONTENTS_TAKES_PRIORITY mode, visible tiles on active |
| 1350 // tree might be freed. We need to set RequiresHighResToDraw to ensure that | 1354 // tree might be freed. We need to set RequiresHighResToDraw to ensure that |
| 1351 // high res tiles will be required to activate pending tree. | 1355 // high res tiles will be required to activate pending tree. |
| 1352 impl().layer_tree_host_impl->SetRequiresHighResToDraw(); | 1356 impl().layer_tree_host_impl->SetRequiresHighResToDraw(true); |
| 1353 priority = NEW_CONTENT_TAKES_PRIORITY; | 1357 priority = NEW_CONTENT_TAKES_PRIORITY; |
| 1354 } | 1358 } |
| 1355 | 1359 |
| 1356 impl().layer_tree_host_impl->SetTreePriority(priority); | 1360 impl().layer_tree_host_impl->SetTreePriority(priority); |
| 1357 | 1361 |
| 1358 // Only put the scheduler in impl latency prioritization mode if we don't | 1362 // Only put the scheduler in impl latency prioritization mode if we don't |
| 1359 // have a scroll listener. This gives the scroll listener a better chance of | 1363 // have a scroll listener. This gives the scroll listener a better chance of |
| 1360 // handling scroll updates within the same frame. The tree itself is still | 1364 // handling scroll updates within the same frame. The tree itself is still |
| 1361 // kept in prefer smoothness mode to allow checkerboarding. | 1365 // kept in prefer smoothness mode to allow checkerboarding. |
| 1362 impl().scheduler->SetImplLatencyTakesPriority( | 1366 impl().scheduler->SetImplLatencyTakesPriority( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1389 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting); | 1393 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting); |
| 1390 impl().completion_event_for_commit_held_on_tree_activation->Signal(); | 1394 impl().completion_event_for_commit_held_on_tree_activation->Signal(); |
| 1391 impl().completion_event_for_commit_held_on_tree_activation = NULL; | 1395 impl().completion_event_for_commit_held_on_tree_activation = NULL; |
| 1392 } | 1396 } |
| 1393 | 1397 |
| 1394 impl().timing_history.DidActivateSyncTree(); | 1398 impl().timing_history.DidActivateSyncTree(); |
| 1395 impl().last_processed_begin_main_frame_args = | 1399 impl().last_processed_begin_main_frame_args = |
| 1396 impl().last_begin_main_frame_args; | 1400 impl().last_begin_main_frame_args; |
| 1397 } | 1401 } |
| 1398 | 1402 |
| 1399 void ThreadProxy::DidPrepareTiles() { | |
| 1400 DCHECK(IsImplThread()); | |
| 1401 impl().scheduler->DidPrepareTiles(); | |
| 1402 } | |
| 1403 | |
| 1404 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { | 1403 void ThreadProxy::DidCompletePageScaleAnimationOnImplThread() { |
| 1405 DCHECK(IsImplThread()); | 1404 DCHECK(IsImplThread()); |
| 1406 Proxy::MainThreadTaskRunner()->PostTask( | 1405 Proxy::MainThreadTaskRunner()->PostTask( |
| 1407 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation, | 1406 FROM_HERE, base::Bind(&ThreadProxy::DidCompletePageScaleAnimation, |
| 1408 main_thread_weak_ptr_)); | 1407 main_thread_weak_ptr_)); |
| 1409 } | 1408 } |
| 1410 | 1409 |
| 1411 void ThreadProxy::OnDrawForOutputSurface() { | 1410 void ThreadProxy::OnDrawForOutputSurface() { |
| 1412 DCHECK(IsImplThread()); | 1411 DCHECK(IsImplThread()); |
| 1413 impl().scheduler->OnDrawForOutputSurface(); | 1412 impl().scheduler->OnDrawForOutputSurface(); |
| 1414 } | 1413 } |
| 1415 | 1414 |
| 1416 } // namespace cc | 1415 } // namespace cc |
| OLD | NEW |