| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 DCHECK(this->layer_tree_host()); | 74 DCHECK(this->layer_tree_host()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 ThreadProxy::MainThreadOnly::MainThreadOnly(ThreadProxy* proxy, | 77 ThreadProxy::MainThreadOnly::MainThreadOnly(ThreadProxy* proxy, |
| 78 int layer_tree_host_id) | 78 int layer_tree_host_id) |
| 79 : layer_tree_host_id(layer_tree_host_id), | 79 : layer_tree_host_id(layer_tree_host_id), |
| 80 animate_requested(false), | 80 animate_requested(false), |
| 81 commit_requested(false), | 81 commit_requested(false), |
| 82 commit_request_sent_to_impl_thread(false), | 82 commit_request_sent_to_impl_thread(false), |
| 83 started(false), | 83 started(false), |
| 84 manage_tiles_pending(false), | 84 prepare_tiles_pending(false), |
| 85 can_cancel_commit(true), | 85 can_cancel_commit(true), |
| 86 defer_commits(false), | 86 defer_commits(false), |
| 87 weak_factory(proxy) {} | 87 weak_factory(proxy) { |
| 88 } |
| 88 | 89 |
| 89 ThreadProxy::MainThreadOnly::~MainThreadOnly() {} | 90 ThreadProxy::MainThreadOnly::~MainThreadOnly() {} |
| 90 | 91 |
| 91 ThreadProxy::MainThreadOrBlockedMainThread::MainThreadOrBlockedMainThread( | 92 ThreadProxy::MainThreadOrBlockedMainThread::MainThreadOrBlockedMainThread( |
| 92 LayerTreeHost* host) | 93 LayerTreeHost* host) |
| 93 : layer_tree_host(host), | 94 : layer_tree_host(host), |
| 94 commit_waits_for_activation(false), | 95 commit_waits_for_activation(false), |
| 95 main_thread_inside_commit(false) {} | 96 main_thread_inside_commit(false) {} |
| 96 | 97 |
| 97 ThreadProxy::MainThreadOrBlockedMainThread::~MainThreadOrBlockedMainThread() {} | 98 ThreadProxy::MainThreadOrBlockedMainThread::~MainThreadOrBlockedMainThread() {} |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 DCHECK(IsImplThread()); | 462 DCHECK(IsImplThread()); |
| 462 impl().scheduler->SetNeedsRedraw(); | 463 impl().scheduler->SetNeedsRedraw(); |
| 463 } | 464 } |
| 464 | 465 |
| 465 void ThreadProxy::SetNeedsAnimateOnImplThread() { | 466 void ThreadProxy::SetNeedsAnimateOnImplThread() { |
| 466 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimateOnImplThread"); | 467 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimateOnImplThread"); |
| 467 DCHECK(IsImplThread()); | 468 DCHECK(IsImplThread()); |
| 468 impl().scheduler->SetNeedsAnimate(); | 469 impl().scheduler->SetNeedsAnimate(); |
| 469 } | 470 } |
| 470 | 471 |
| 471 void ThreadProxy::SetNeedsManageTilesOnImplThread() { | 472 void ThreadProxy::SetNeedsPrepareTilesOnImplThread() { |
| 472 DCHECK(IsImplThread()); | 473 DCHECK(IsImplThread()); |
| 473 impl().scheduler->SetNeedsManageTiles(); | 474 impl().scheduler->SetNeedsPrepareTiles(); |
| 474 } | 475 } |
| 475 | 476 |
| 476 void ThreadProxy::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) { | 477 void ThreadProxy::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) { |
| 477 DCHECK(IsImplThread()); | 478 DCHECK(IsImplThread()); |
| 478 impl().layer_tree_host_impl->SetViewportDamage(damage_rect); | 479 impl().layer_tree_host_impl->SetViewportDamage(damage_rect); |
| 479 SetNeedsRedrawOnImplThread(); | 480 SetNeedsRedrawOnImplThread(); |
| 480 } | 481 } |
| 481 | 482 |
| 482 void ThreadProxy::MainThreadHasStoppedFlinging() { | 483 void ThreadProxy::MainThreadHasStoppedFlinging() { |
| 483 DCHECK(IsMainThread()); | 484 DCHECK(IsMainThread()); |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 base::Bind(&ThreadProxy::DidCommitAndDrawFrame, main_thread_weak_ptr_)); | 1044 base::Bind(&ThreadProxy::DidCommitAndDrawFrame, main_thread_weak_ptr_)); |
| 1044 } | 1045 } |
| 1045 | 1046 |
| 1046 if (result == DRAW_SUCCESS) | 1047 if (result == DRAW_SUCCESS) |
| 1047 impl().timing_history.DidFinishDrawing(); | 1048 impl().timing_history.DidFinishDrawing(); |
| 1048 | 1049 |
| 1049 DCHECK_NE(INVALID_RESULT, result); | 1050 DCHECK_NE(INVALID_RESULT, result); |
| 1050 return result; | 1051 return result; |
| 1051 } | 1052 } |
| 1052 | 1053 |
| 1053 void ThreadProxy::ScheduledActionManageTiles() { | 1054 void ThreadProxy::ScheduledActionPrepareTiles() { |
| 1054 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionManageTiles"); | 1055 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionPrepareTiles"); |
| 1055 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting); | 1056 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting); |
| 1056 impl().layer_tree_host_impl->ManageTiles(); | 1057 impl().layer_tree_host_impl->PrepareTiles(); |
| 1057 } | 1058 } |
| 1058 | 1059 |
| 1059 DrawResult ThreadProxy::ScheduledActionDrawAndSwapIfPossible() { | 1060 DrawResult ThreadProxy::ScheduledActionDrawAndSwapIfPossible() { |
| 1060 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionDrawAndSwap"); | 1061 TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionDrawAndSwap"); |
| 1061 | 1062 |
| 1062 // SchedulerStateMachine::DidDrawIfPossibleCompleted isn't set up to | 1063 // SchedulerStateMachine::DidDrawIfPossibleCompleted isn't set up to |
| 1063 // handle DRAW_ABORTED_CANT_DRAW. Moreover, the scheduler should | 1064 // handle DRAW_ABORTED_CANT_DRAW. Moreover, the scheduler should |
| 1064 // never generate this call when it can't draw. | 1065 // never generate this call when it can't draw. |
| 1065 DCHECK(impl().layer_tree_host_impl->CanDraw()); | 1066 DCHECK(impl().layer_tree_host_impl->CanDraw()); |
| 1066 | 1067 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 TRACE_EVENT_INSTANT0( | 1336 TRACE_EVENT_INSTANT0( |
| 1336 "cc", "ReleaseCommitbyActivation", TRACE_EVENT_SCOPE_THREAD); | 1337 "cc", "ReleaseCommitbyActivation", TRACE_EVENT_SCOPE_THREAD); |
| 1337 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting); | 1338 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting); |
| 1338 impl().completion_event_for_commit_held_on_tree_activation->Signal(); | 1339 impl().completion_event_for_commit_held_on_tree_activation->Signal(); |
| 1339 impl().completion_event_for_commit_held_on_tree_activation = NULL; | 1340 impl().completion_event_for_commit_held_on_tree_activation = NULL; |
| 1340 } | 1341 } |
| 1341 | 1342 |
| 1342 impl().timing_history.DidActivateSyncTree(); | 1343 impl().timing_history.DidActivateSyncTree(); |
| 1343 } | 1344 } |
| 1344 | 1345 |
| 1345 void ThreadProxy::DidManageTiles() { | 1346 void ThreadProxy::DidPrepareTiles() { |
| 1346 DCHECK(IsImplThread()); | 1347 DCHECK(IsImplThread()); |
| 1347 impl().scheduler->DidManageTiles(); | 1348 impl().scheduler->DidPrepareTiles(); |
| 1348 } | 1349 } |
| 1349 | 1350 |
| 1350 } // namespace cc | 1351 } // namespace cc |
| OLD | NEW |