| 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 | |
| 144 it->value->stop(); | |
| 145 #else | |
| 146 it->second->stop(); | 143 it->second->stop(); |
| 147 #endif | |
| 148 } | 144 } |
| 149 | 145 |
| 150 void CCLayerTreeHost::setSurfaceReady() | 146 void CCLayerTreeHost::setSurfaceReady() |
| 151 { | 147 { |
| 152 m_proxy->setSurfaceReady(); | 148 m_proxy->setSurfaceReady(); |
| 153 } | 149 } |
| 154 | 150 |
| 155 void CCLayerTreeHost::initializeRenderer() | 151 void CCLayerTreeHost::initializeRenderer() |
| 156 { | 152 { |
| 157 TRACE_EVENT0("cc", "CCLayerTreeHost::initializeRenderer"); | 153 TRACE_EVENT0("cc", "CCLayerTreeHost::initializeRenderer"); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 m_proxy->setNeedsRedraw(); | 369 m_proxy->setNeedsRedraw(); |
| 374 if (!CCThreadProxy::implThread()) | 370 if (!CCThreadProxy::implThread()) |
| 375 m_client->scheduleComposite(); | 371 m_client->scheduleComposite(); |
| 376 } | 372 } |
| 377 | 373 |
| 378 bool CCLayerTreeHost::commitRequested() const | 374 bool CCLayerTreeHost::commitRequested() const |
| 379 { | 375 { |
| 380 return m_proxy->commitRequested(); | 376 return m_proxy->commitRequested(); |
| 381 } | 377 } |
| 382 | 378 |
| 383 void CCLayerTreeHost::setAnimationEvents(PassOwnPtr<CCAnimationEventsVector> eve
nts, double wallClockTime) | 379 void CCLayerTreeHost::setAnimationEvents(scoped_ptr<CCAnimationEventsVector> eve
nts, double wallClockTime) |
| 384 { | 380 { |
| 385 ASSERT(CCThreadProxy::isMainThread()); | 381 ASSERT(CCThreadProxy::isMainThread()); |
| 386 setAnimationEventsRecursive(*events, m_rootLayer.get(), wallClockTime); | 382 setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime)
; |
| 387 } | 383 } |
| 388 | 384 |
| 389 void CCLayerTreeHost::didAddAnimation() | 385 void CCLayerTreeHost::didAddAnimation() |
| 390 { | 386 { |
| 391 m_needsAnimateLayers = true; | 387 m_needsAnimateLayers = true; |
| 392 m_proxy->didAddAnimation(); | 388 m_proxy->didAddAnimation(); |
| 393 } | 389 } |
| 394 | 390 |
| 395 void CCLayerTreeHost::setRootLayer(scoped_refptr<LayerChromium> rootLayer) | 391 void CCLayerTreeHost::setRootLayer(scoped_refptr<LayerChromium> rootLayer) |
| 396 { | 392 { |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 } | 751 } |
| 756 | 752 |
| 757 void CCLayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) | 753 void CCLayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) |
| 758 { | 754 { |
| 759 if (m_animating) | 755 if (m_animating) |
| 760 return; | 756 return; |
| 761 | 757 |
| 762 ASSERT(context); | 758 ASSERT(context); |
| 763 RateLimiterMap::iterator it = m_rateLimiters.find(context); | 759 RateLimiterMap::iterator it = m_rateLimiters.find(context); |
| 764 if (it != m_rateLimiters.end()) | 760 if (it != m_rateLimiters.end()) |
| 765 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | |
| 766 it->value->start(); | |
| 767 #else | |
| 768 it->second->start(); | 761 it->second->start(); |
| 769 #endif | |
| 770 else { | 762 else { |
| 771 RefPtr<RateLimiter> rateLimiter = RateLimiter::create(context, this); | 763 scoped_refptr<RateLimiter> rateLimiter = RateLimiter::create(context, th
is); |
| 772 m_rateLimiters.set(context, rateLimiter); | 764 m_rateLimiters[context] = rateLimiter; |
| 773 rateLimiter->start(); | 765 rateLimiter->start(); |
| 774 } | 766 } |
| 775 } | 767 } |
| 776 | 768 |
| 777 void CCLayerTreeHost::stopRateLimiter(WebKit::WebGraphicsContext3D* context) | 769 void CCLayerTreeHost::stopRateLimiter(WebKit::WebGraphicsContext3D* context) |
| 778 { | 770 { |
| 779 RateLimiterMap::iterator it = m_rateLimiters.find(context); | 771 RateLimiterMap::iterator it = m_rateLimiters.find(context); |
| 780 if (it != m_rateLimiters.end()) { | 772 if (it != m_rateLimiters.end()) { |
| 781 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | |
| 782 it->value->stop(); | |
| 783 #else | |
| 784 it->second->stop(); | 773 it->second->stop(); |
| 785 #endif | 774 m_rateLimiters.erase(it); |
| 786 m_rateLimiters.remove(it); | |
| 787 } | 775 } |
| 788 } | 776 } |
| 789 | 777 |
| 790 void CCLayerTreeHost::rateLimit() | 778 void CCLayerTreeHost::rateLimit() |
| 791 { | 779 { |
| 792 // Force a no-op command on the compositor context, so that any ratelimiting
commands will wait for the compositing | 780 // Force a no-op command on the compositor context, so that any ratelimiting
commands will wait for the compositing |
| 793 // context, and therefore for the SwapBuffers. | 781 // context, and therefore for the SwapBuffers. |
| 794 m_proxy->forceSerializeOnSwapBuffers(); | 782 m_proxy->forceSerializeOnSwapBuffers(); |
| 795 } | 783 } |
| 796 | 784 |
| 797 bool CCLayerTreeHost::bufferedUpdates() | 785 bool CCLayerTreeHost::bufferedUpdates() |
| 798 { | 786 { |
| 799 return m_settings.maxPartialTextureUpdates != numeric_limits<size_t>::max(); | 787 return m_settings.maxPartialTextureUpdates != numeric_limits<size_t>::max(); |
| 800 } | 788 } |
| 801 | 789 |
| 802 bool CCLayerTreeHost::requestPartialTextureUpdate() | 790 bool CCLayerTreeHost::requestPartialTextureUpdate() |
| 803 { | 791 { |
| 804 if (m_partialTextureUpdateRequests >= m_settings.maxPartialTextureUpdates) | 792 if (m_partialTextureUpdateRequests >= m_settings.maxPartialTextureUpdates) |
| 805 return false; | 793 return false; |
| 806 | 794 |
| 807 m_partialTextureUpdateRequests++; | 795 m_partialTextureUpdateRequests++; |
| 808 return true; | 796 return true; |
| 809 } | 797 } |
| 810 | 798 |
| 811 void CCLayerTreeHost::deleteTextureAfterCommit(PassOwnPtr<CCPrioritizedTexture>
texture) | 799 void CCLayerTreeHost::deleteTextureAfterCommit(scoped_ptr<CCPrioritizedTexture>
texture) |
| 812 { | 800 { |
| 813 m_deleteTextureAfterCommitList.append(texture); | 801 m_deleteTextureAfterCommitList.append(texture.Pass()); |
| 814 } | 802 } |
| 815 | 803 |
| 816 void CCLayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) | 804 void CCLayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) |
| 817 { | 805 { |
| 818 if (deviceScaleFactor == m_deviceScaleFactor) | 806 if (deviceScaleFactor == m_deviceScaleFactor) |
| 819 return; | 807 return; |
| 820 m_deviceScaleFactor = deviceScaleFactor; | 808 m_deviceScaleFactor = deviceScaleFactor; |
| 821 | 809 |
| 822 setNeedsCommit(); | 810 setNeedsCommit(); |
| 823 } | 811 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 else | 852 else |
| 865 layer->notifyAnimationFinished(wallClockTime); | 853 layer->notifyAnimationFinished(wallClockTime); |
| 866 } | 854 } |
| 867 } | 855 } |
| 868 | 856 |
| 869 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 857 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 870 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 858 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 871 } | 859 } |
| 872 | 860 |
| 873 } // namespace cc | 861 } // namespace cc |
| OLD | NEW |