| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/layer_tree_host.h" | 7 #include "cc/layer_tree_host.h" |
| 8 | 8 |
| 9 #include "Region.h" | 9 #include "Region.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/message_loop.h" |
| 11 #include "cc/font_atlas.h" | 12 #include "cc/font_atlas.h" |
| 12 #include "cc/graphics_context.h" | 13 #include "cc/graphics_context.h" |
| 13 #include "cc/heads_up_display_layer.h" | 14 #include "cc/heads_up_display_layer.h" |
| 14 #include "cc/heads_up_display_layer_impl.h" | 15 #include "cc/heads_up_display_layer_impl.h" |
| 15 #include "cc/layer.h" | 16 #include "cc/layer.h" |
| 16 #include "cc/layer_animation_controller.h" | 17 #include "cc/layer_animation_controller.h" |
| 17 #include "cc/layer_iterator.h" | 18 #include "cc/layer_iterator.h" |
| 18 #include "cc/layer_tree_host_client.h" | 19 #include "cc/layer_tree_host_client.h" |
| 19 #include "cc/layer_tree_host_common.h" | 20 #include "cc/layer_tree_host_common.h" |
| 20 #include "cc/layer_tree_host_impl.h" | 21 #include "cc/layer_tree_host_impl.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 358 } |
| 358 | 359 |
| 359 void LayerTreeHost::setNeedsAnimate() | 360 void LayerTreeHost::setNeedsAnimate() |
| 360 { | 361 { |
| 361 DCHECK(Proxy::hasImplThread()); | 362 DCHECK(Proxy::hasImplThread()); |
| 362 m_proxy->setNeedsAnimate(); | 363 m_proxy->setNeedsAnimate(); |
| 363 } | 364 } |
| 364 | 365 |
| 365 void LayerTreeHost::setNeedsCommit() | 366 void LayerTreeHost::setNeedsCommit() |
| 366 { | 367 { |
| 368 if (!m_prepaintCallback.IsCancelled()) { |
| 369 TRACE_EVENT_INSTANT0("cc", "LayerTreeHost::setNeedsCommit::cancel prepai
nt"); |
| 370 m_prepaintCallback.Cancel(); |
| 371 } |
| 367 m_proxy->setNeedsCommit(); | 372 m_proxy->setNeedsCommit(); |
| 368 } | 373 } |
| 369 | 374 |
| 370 void LayerTreeHost::setNeedsRedraw() | 375 void LayerTreeHost::setNeedsRedraw() |
| 371 { | 376 { |
| 372 m_proxy->setNeedsRedraw(); | 377 m_proxy->setNeedsRedraw(); |
| 373 if (!ThreadProxy::implThread()) | 378 if (!ThreadProxy::implThread()) |
| 374 m_client->scheduleComposite(); | 379 m_client->scheduleComposite(); |
| 375 } | 380 } |
| 376 | 381 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 } | 533 } |
| 529 | 534 |
| 530 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc"); | 535 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc"); |
| 531 LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSi
ze(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextureS
ize, updateList); | 536 LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSi
ze(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextureS
ize, updateList); |
| 532 } | 537 } |
| 533 | 538 |
| 534 // Reset partial texture update requests. | 539 // Reset partial texture update requests. |
| 535 m_partialTextureUpdateRequests = 0; | 540 m_partialTextureUpdateRequests = 0; |
| 536 | 541 |
| 537 bool needMoreUpdates = paintLayerContents(updateList, queue); | 542 bool needMoreUpdates = paintLayerContents(updateList, queue); |
| 538 if (m_triggerIdleUpdates && needMoreUpdates) | 543 if (m_triggerIdleUpdates && needMoreUpdates) { |
| 539 setNeedsCommit(); | 544 TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::posting prepaint task")
; |
| 545 m_prepaintCallback.Reset(base::Bind(&LayerTreeHost::triggerPrepaint, bas
e::Unretained(this))); |
| 546 static base::TimeDelta prepaintDelay = base::TimeDelta::FromMilliseconds
(100); |
| 547 MessageLoop::current()->PostDelayedTask(FROM_HERE, m_prepaintCallback.ca
llback(), prepaintDelay); |
| 548 } |
| 540 | 549 |
| 541 for (size_t i = 0; i < updateList.size(); ++i) | 550 for (size_t i = 0; i < updateList.size(); ++i) |
| 542 updateList[i]->clearRenderSurface(); | 551 updateList[i]->clearRenderSurface(); |
| 543 } | 552 } |
| 544 | 553 |
| 554 void LayerTreeHost::triggerPrepaint() |
| 555 { |
| 556 m_prepaintCallback.Cancel(); |
| 557 TRACE_EVENT0("cc", "LayerTreeHost::triggerPrepaint"); |
| 558 setNeedsCommit(); |
| 559 } |
| 560 |
| 545 void LayerTreeHost::setPrioritiesForSurfaces(size_t surfaceMemoryBytes) | 561 void LayerTreeHost::setPrioritiesForSurfaces(size_t surfaceMemoryBytes) |
| 546 { | 562 { |
| 547 // Surfaces have a place holder for their memory since they are managed | 563 // Surfaces have a place holder for their memory since they are managed |
| 548 // independantly but should still be tracked and reduce other memory usage. | 564 // independantly but should still be tracked and reduce other memory usage. |
| 549 m_surfaceMemoryPlaceholder->setTextureManager(m_contentsTextureManager.get()
); | 565 m_surfaceMemoryPlaceholder->setTextureManager(m_contentsTextureManager.get()
); |
| 550 m_surfaceMemoryPlaceholder->setRequestPriority(PriorityCalculator::renderSur
facePriority()); | 566 m_surfaceMemoryPlaceholder->setRequestPriority(PriorityCalculator::renderSur
facePriority()); |
| 551 m_surfaceMemoryPlaceholder->setToSelfManagedMemoryPlaceholder(surfaceMemoryB
ytes); | 567 m_surfaceMemoryPlaceholder->setToSelfManagedMemoryPlaceholder(surfaceMemoryB
ytes); |
| 552 } | 568 } |
| 553 | 569 |
| 554 void LayerTreeHost::setPrioritiesForLayers(const LayerList& updateList) | 570 void LayerTreeHost::setPrioritiesForLayers(const LayerList& updateList) |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 else | 808 else |
| 793 layer->notifyAnimationFinished(wallClockTime); | 809 layer->notifyAnimationFinished(wallClockTime); |
| 794 } | 810 } |
| 795 } | 811 } |
| 796 | 812 |
| 797 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 813 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 798 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 814 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 799 } | 815 } |
| 800 | 816 |
| 801 } // namespace cc | 817 } // namespace cc |
| OLD | NEW |