| 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 427 |
| 428 // The texture upload queue may reference textures that were just purged, | 428 // The texture upload queue may reference textures that were just purged, |
| 429 // clear them from the queue. | 429 // clear them from the queue. |
| 430 if (impl().current_resource_update_controller) { | 430 if (impl().current_resource_update_controller) { |
| 431 impl() | 431 impl() |
| 432 .current_resource_update_controller->DiscardUploadsToEvictedResources(); | 432 .current_resource_update_controller->DiscardUploadsToEvictedResources(); |
| 433 } | 433 } |
| 434 return true; | 434 return true; |
| 435 } | 435 } |
| 436 | 436 |
| 437 void ThreadProxy::SendManagedMemoryStats() { | |
| 438 DCHECK(IsImplThread()); | |
| 439 if (!impl().layer_tree_host_impl) | |
| 440 return; | |
| 441 if (!impl().contents_texture_manager) | |
| 442 return; | |
| 443 | |
| 444 // If we are using impl-side painting, then SendManagedMemoryStats is called | |
| 445 // directly after the tile manager's manage function, and doesn't need to | |
| 446 // interact with main thread's layer tree. | |
| 447 if (impl().layer_tree_host_impl->settings().impl_side_painting) | |
| 448 return; | |
| 449 | |
| 450 impl().layer_tree_host_impl->SendManagedMemoryStats( | |
| 451 impl().contents_texture_manager->MemoryVisibleBytes(), | |
| 452 impl().contents_texture_manager->MemoryVisibleAndNearbyBytes(), | |
| 453 impl().contents_texture_manager->MemoryUseBytes()); | |
| 454 } | |
| 455 | |
| 456 bool ThreadProxy::IsInsideDraw() { return impl().inside_draw; } | 437 bool ThreadProxy::IsInsideDraw() { return impl().inside_draw; } |
| 457 | 438 |
| 458 void ThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { | 439 void ThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { |
| 459 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedraw"); | 440 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsRedraw"); |
| 460 DCHECK(IsMainThread()); | 441 DCHECK(IsMainThread()); |
| 461 Proxy::ImplThreadTaskRunner()->PostTask( | 442 Proxy::ImplThreadTaskRunner()->PostTask( |
| 462 FROM_HERE, | 443 FROM_HERE, |
| 463 base::Bind(&ThreadProxy::SetNeedsRedrawRectOnImplThread, | 444 base::Bind(&ThreadProxy::SetNeedsRedrawRectOnImplThread, |
| 464 impl_thread_weak_ptr_, | 445 impl_thread_weak_ptr_, |
| 465 damage_rect)); | 446 damage_rect)); |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 | 1436 |
| 1456 impl().timing_history.DidActivatePendingTree(); | 1437 impl().timing_history.DidActivatePendingTree(); |
| 1457 } | 1438 } |
| 1458 | 1439 |
| 1459 void ThreadProxy::DidManageTiles() { | 1440 void ThreadProxy::DidManageTiles() { |
| 1460 DCHECK(IsImplThread()); | 1441 DCHECK(IsImplThread()); |
| 1461 impl().scheduler->DidManageTiles(); | 1442 impl().scheduler->DidManageTiles(); |
| 1462 } | 1443 } |
| 1463 | 1444 |
| 1464 } // namespace cc | 1445 } // namespace cc |
| OLD | NEW |