| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 DCHECK(IsMainThread()); | 119 DCHECK(IsMainThread()); |
| 120 DCHECK(this->layer_tree_host()); | 120 DCHECK(this->layer_tree_host()); |
| 121 } | 121 } |
| 122 | 122 |
| 123 ThreadProxy::~ThreadProxy() { | 123 ThreadProxy::~ThreadProxy() { |
| 124 TRACE_EVENT0("cc", "ThreadProxy::~ThreadProxy"); | 124 TRACE_EVENT0("cc", "ThreadProxy::~ThreadProxy"); |
| 125 DCHECK(IsMainThread()); | 125 DCHECK(IsMainThread()); |
| 126 DCHECK(!started_); | 126 DCHECK(!started_); |
| 127 } | 127 } |
| 128 | 128 |
| 129 bool ThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { | 129 bool ThreadProxy::CompositeAndReadback(void* pixels, const gfx::Rect& rect) { |
| 130 TRACE_EVENT0("cc", "ThreadProxy::CompositeAndReadback"); | 130 TRACE_EVENT0("cc", "ThreadProxy::CompositeAndReadback"); |
| 131 DCHECK(IsMainThread()); | 131 DCHECK(IsMainThread()); |
| 132 DCHECK(layer_tree_host()); | 132 DCHECK(layer_tree_host()); |
| 133 | 133 |
| 134 if (defer_commits_) { | 134 if (defer_commits_) { |
| 135 TRACE_EVENT0("cc", "CompositeAndReadback_DeferCommit"); | 135 TRACE_EVENT0("cc", "CompositeAndReadback_DeferCommit"); |
| 136 return false; | 136 return false; |
| 137 } | 137 } |
| 138 | 138 |
| 139 if (!layer_tree_host()->InitializeOutputSurfaceIfNeeded()) { | 139 if (!layer_tree_host()->InitializeOutputSurfaceIfNeeded()) { |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 | 500 |
| 501 layer_tree_host_impl_->SendManagedMemoryStats( | 501 layer_tree_host_impl_->SendManagedMemoryStats( |
| 502 contents_texture_manager_on_impl_thread()->MemoryVisibleBytes(), | 502 contents_texture_manager_on_impl_thread()->MemoryVisibleBytes(), |
| 503 contents_texture_manager_on_impl_thread()-> | 503 contents_texture_manager_on_impl_thread()-> |
| 504 MemoryVisibleAndNearbyBytes(), | 504 MemoryVisibleAndNearbyBytes(), |
| 505 contents_texture_manager_on_impl_thread()->MemoryUseBytes()); | 505 contents_texture_manager_on_impl_thread()->MemoryUseBytes()); |
| 506 } | 506 } |
| 507 | 507 |
| 508 bool ThreadProxy::IsInsideDraw() { return inside_draw_; } | 508 bool ThreadProxy::IsInsideDraw() { return inside_draw_; } |
| 509 | 509 |
| 510 void ThreadProxy::SetNeedsRedraw(gfx::Rect damage_rect) { | 510 void ThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { |
| 511 DCHECK(IsMainThread()); | 511 DCHECK(IsMainThread()); |
| 512 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedraw"); | 512 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedraw"); |
| 513 Proxy::ImplThreadTaskRunner()->PostTask( | 513 Proxy::ImplThreadTaskRunner()->PostTask( |
| 514 FROM_HERE, | 514 FROM_HERE, |
| 515 base::Bind(&ThreadProxy::SetNeedsRedrawRectOnImplThread, | 515 base::Bind(&ThreadProxy::SetNeedsRedrawRectOnImplThread, |
| 516 impl_thread_weak_ptr_, | 516 impl_thread_weak_ptr_, |
| 517 damage_rect)); | 517 damage_rect)); |
| 518 } | 518 } |
| 519 | 519 |
| 520 void ThreadProxy::SetNextCommitWaitsForActivation() { | 520 void ThreadProxy::SetNextCommitWaitsForActivation() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 DCHECK(IsImplThread()); | 555 DCHECK(IsImplThread()); |
| 556 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedrawOnImplThread"); | 556 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedrawOnImplThread"); |
| 557 scheduler_on_impl_thread_->SetNeedsRedraw(); | 557 scheduler_on_impl_thread_->SetNeedsRedraw(); |
| 558 } | 558 } |
| 559 | 559 |
| 560 void ThreadProxy::SetNeedsManageTilesOnImplThread() { | 560 void ThreadProxy::SetNeedsManageTilesOnImplThread() { |
| 561 DCHECK(IsImplThread()); | 561 DCHECK(IsImplThread()); |
| 562 scheduler_on_impl_thread_->SetNeedsManageTiles(); | 562 scheduler_on_impl_thread_->SetNeedsManageTiles(); |
| 563 } | 563 } |
| 564 | 564 |
| 565 void ThreadProxy::SetNeedsRedrawRectOnImplThread(gfx::Rect damage_rect) { | 565 void ThreadProxy::SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) { |
| 566 DCHECK(IsImplThread()); | 566 DCHECK(IsImplThread()); |
| 567 layer_tree_host_impl_->SetViewportDamage(damage_rect); | 567 layer_tree_host_impl_->SetViewportDamage(damage_rect); |
| 568 SetNeedsRedrawOnImplThread(); | 568 SetNeedsRedrawOnImplThread(); |
| 569 } | 569 } |
| 570 | 570 |
| 571 void ThreadProxy::SetSwapUsedIncompleteTileOnImplThread( | 571 void ThreadProxy::SetSwapUsedIncompleteTileOnImplThread( |
| 572 bool used_incomplete_tile) { | 572 bool used_incomplete_tile) { |
| 573 DCHECK(IsImplThread()); | 573 DCHECK(IsImplThread()); |
| 574 if (used_incomplete_tile) { | 574 if (used_incomplete_tile) { |
| 575 TRACE_EVENT_INSTANT0( | 575 TRACE_EVENT_INSTANT0( |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 commit_to_activate_duration_history_.InsertSample( | 1642 commit_to_activate_duration_history_.InsertSample( |
| 1643 base::TimeTicks::HighResNow() - commit_complete_time_); | 1643 base::TimeTicks::HighResNow() - commit_complete_time_); |
| 1644 } | 1644 } |
| 1645 | 1645 |
| 1646 void ThreadProxy::DidManageTiles() { | 1646 void ThreadProxy::DidManageTiles() { |
| 1647 DCHECK(IsImplThread()); | 1647 DCHECK(IsImplThread()); |
| 1648 scheduler_on_impl_thread_->DidManageTiles(); | 1648 scheduler_on_impl_thread_->DidManageTiles(); |
| 1649 } | 1649 } |
| 1650 | 1650 |
| 1651 } // namespace cc | 1651 } // namespace cc |
| OLD | NEW |