| 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 "CCLayerTreeHost.h" | 7 #include "CCLayerTreeHost.h" |
| 8 | 8 |
| 9 #include "CCFontAtlas.h" | 9 #include "CCFontAtlas.h" |
| 10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 return m_proxy->initializeContext(); | 128 return m_proxy->initializeContext(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 CCLayerTreeHost::~CCLayerTreeHost() | 131 CCLayerTreeHost::~CCLayerTreeHost() |
| 132 { | 132 { |
| 133 if (m_rootLayer) | 133 if (m_rootLayer) |
| 134 m_rootLayer->setLayerTreeHost(0); | 134 m_rootLayer->setLayerTreeHost(0); |
| 135 ASSERT(CCProxy::isMainThread()); | 135 ASSERT(CCProxy::isMainThread()); |
| 136 TRACE_EVENT0("cc", "CCLayerTreeHost::~CCLayerTreeHost"); | 136 TRACE_EVENT0("cc", "CCLayerTreeHost::~CCLayerTreeHost"); |
| 137 ASSERT(m_proxy); | 137 ASSERT(m_proxy.get()); |
| 138 m_proxy->stop(); | 138 m_proxy->stop(); |
| 139 m_proxy.clear(); | 139 m_proxy.reset(); |
| 140 numLayerTreeInstances--; | 140 numLayerTreeInstances--; |
| 141 RateLimiterMap::iterator it = m_rateLimiters.begin(); | 141 RateLimiterMap::iterator it = m_rateLimiters.begin(); |
| 142 if (it != m_rateLimiters.end()) | 142 if (it != m_rateLimiters.end()) |
| 143 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 143 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
| 144 it->value->stop(); | 144 it->value->stop(); |
| 145 #else | 145 #else |
| 146 it->second->stop(); | 146 it->second->stop(); |
| 147 #endif | 147 #endif |
| 148 } | 148 } |
| 149 | 149 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 m_proxy->setNeedsRedraw(); | 373 m_proxy->setNeedsRedraw(); |
| 374 if (!CCThreadProxy::implThread()) | 374 if (!CCThreadProxy::implThread()) |
| 375 m_client->scheduleComposite(); | 375 m_client->scheduleComposite(); |
| 376 } | 376 } |
| 377 | 377 |
| 378 bool CCLayerTreeHost::commitRequested() const | 378 bool CCLayerTreeHost::commitRequested() const |
| 379 { | 379 { |
| 380 return m_proxy->commitRequested(); | 380 return m_proxy->commitRequested(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 void CCLayerTreeHost::setAnimationEvents(PassOwnPtr<CCAnimationEventsVector> eve
nts, double wallClockTime) | 383 void CCLayerTreeHost::setAnimationEvents(scoped_ptr<CCAnimationEventsVector> eve
nts, double wallClockTime) |
| 384 { | 384 { |
| 385 ASSERT(CCThreadProxy::isMainThread()); | 385 ASSERT(CCThreadProxy::isMainThread()); |
| 386 setAnimationEventsRecursive(*events, m_rootLayer.get(), wallClockTime); | 386 setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime)
; |
| 387 } | 387 } |
| 388 | 388 |
| 389 void CCLayerTreeHost::didAddAnimation() | 389 void CCLayerTreeHost::didAddAnimation() |
| 390 { | 390 { |
| 391 m_needsAnimateLayers = true; | 391 m_needsAnimateLayers = true; |
| 392 m_proxy->didAddAnimation(); | 392 m_proxy->didAddAnimation(); |
| 393 } | 393 } |
| 394 | 394 |
| 395 void CCLayerTreeHost::setRootLayer(scoped_refptr<LayerChromium> rootLayer) | 395 void CCLayerTreeHost::setRootLayer(scoped_refptr<LayerChromium> rootLayer) |
| 396 { | 396 { |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 | 751 |
| 752 ASSERT(context); | 752 ASSERT(context); |
| 753 RateLimiterMap::iterator it = m_rateLimiters.find(context); | 753 RateLimiterMap::iterator it = m_rateLimiters.find(context); |
| 754 if (it != m_rateLimiters.end()) | 754 if (it != m_rateLimiters.end()) |
| 755 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 755 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
| 756 it->value->start(); | 756 it->value->start(); |
| 757 #else | 757 #else |
| 758 it->second->start(); | 758 it->second->start(); |
| 759 #endif | 759 #endif |
| 760 else { | 760 else { |
| 761 RefPtr<RateLimiter> rateLimiter = RateLimiter::create(context, this); | 761 scoped_refptr<RateLimiter> rateLimiter = RateLimiter::create(context, th
is); |
| 762 m_rateLimiters.set(context, rateLimiter); | 762 m_rateLimiters[context] = rateLimiter; |
| 763 rateLimiter->start(); | 763 rateLimiter->start(); |
| 764 } | 764 } |
| 765 } | 765 } |
| 766 | 766 |
| 767 void CCLayerTreeHost::stopRateLimiter(WebKit::WebGraphicsContext3D* context) | 767 void CCLayerTreeHost::stopRateLimiter(WebKit::WebGraphicsContext3D* context) |
| 768 { | 768 { |
| 769 RateLimiterMap::iterator it = m_rateLimiters.find(context); | 769 RateLimiterMap::iterator it = m_rateLimiters.find(context); |
| 770 if (it != m_rateLimiters.end()) { | 770 if (it != m_rateLimiters.end()) { |
| 771 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 771 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
| 772 it->value->stop(); | 772 it->value->stop(); |
| 773 #else | 773 #else |
| 774 it->second->stop(); | 774 it->second->stop(); |
| 775 #endif | 775 #endif |
| 776 m_rateLimiters.remove(it); | 776 m_rateLimiters.erase(it); |
| 777 } | 777 } |
| 778 } | 778 } |
| 779 | 779 |
| 780 void CCLayerTreeHost::rateLimit() | 780 void CCLayerTreeHost::rateLimit() |
| 781 { | 781 { |
| 782 // Force a no-op command on the compositor context, so that any ratelimiting
commands will wait for the compositing | 782 // Force a no-op command on the compositor context, so that any ratelimiting
commands will wait for the compositing |
| 783 // context, and therefore for the SwapBuffers. | 783 // context, and therefore for the SwapBuffers. |
| 784 m_proxy->forceSerializeOnSwapBuffers(); | 784 m_proxy->forceSerializeOnSwapBuffers(); |
| 785 } | 785 } |
| 786 | 786 |
| 787 bool CCLayerTreeHost::bufferedUpdates() | 787 bool CCLayerTreeHost::bufferedUpdates() |
| 788 { | 788 { |
| 789 return m_settings.maxPartialTextureUpdates != numeric_limits<size_t>::max(); | 789 return m_settings.maxPartialTextureUpdates != numeric_limits<size_t>::max(); |
| 790 } | 790 } |
| 791 | 791 |
| 792 bool CCLayerTreeHost::requestPartialTextureUpdate() | 792 bool CCLayerTreeHost::requestPartialTextureUpdate() |
| 793 { | 793 { |
| 794 if (m_partialTextureUpdateRequests >= m_settings.maxPartialTextureUpdates) | 794 if (m_partialTextureUpdateRequests >= m_settings.maxPartialTextureUpdates) |
| 795 return false; | 795 return false; |
| 796 | 796 |
| 797 m_partialTextureUpdateRequests++; | 797 m_partialTextureUpdateRequests++; |
| 798 return true; | 798 return true; |
| 799 } | 799 } |
| 800 | 800 |
| 801 void CCLayerTreeHost::deleteTextureAfterCommit(PassOwnPtr<CCPrioritizedTexture>
texture) | 801 void CCLayerTreeHost::deleteTextureAfterCommit(scoped_ptr<CCPrioritizedTexture>
texture) |
| 802 { | 802 { |
| 803 m_deleteTextureAfterCommitList.append(texture); | 803 m_deleteTextureAfterCommitList.append(texture.Pass()); |
| 804 } | 804 } |
| 805 | 805 |
| 806 void CCLayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) | 806 void CCLayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) |
| 807 { | 807 { |
| 808 if (deviceScaleFactor == m_deviceScaleFactor) | 808 if (deviceScaleFactor == m_deviceScaleFactor) |
| 809 return; | 809 return; |
| 810 m_deviceScaleFactor = deviceScaleFactor; | 810 m_deviceScaleFactor = deviceScaleFactor; |
| 811 | 811 |
| 812 setNeedsCommit(); | 812 setNeedsCommit(); |
| 813 } | 813 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 else | 854 else |
| 855 layer->notifyAnimationFinished(wallClockTime); | 855 layer->notifyAnimationFinished(wallClockTime); |
| 856 } | 856 } |
| 857 } | 857 } |
| 858 | 858 |
| 859 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 859 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 860 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 860 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 861 } | 861 } |
| 862 | 862 |
| 863 } // namespace cc | 863 } // namespace cc |
| OLD | NEW |