Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: cc/CCLayerTreeHostImpl.cpp

Issue 11099040: [cc] Store CCLayerImpls as scoped_ptrs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "CCLayerTreeHostImpl.h" 7 #include "CCLayerTreeHostImpl.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "CCAppendQuadsData.h" 10 #include "CCAppendQuadsData.h"
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 778
779 if (layerImpl->scrollable()) 779 if (layerImpl->scrollable())
780 return layerImpl; 780 return layerImpl;
781 781
782 if (layerImpl->drawsContent() && layerImpl->parent() && layerImpl->parent()- >scrollable()) 782 if (layerImpl->drawsContent() && layerImpl->parent() && layerImpl->parent()- >scrollable())
783 return layerImpl->parent(); 783 return layerImpl->parent();
784 784
785 return 0; 785 return 0;
786 } 786 }
787 787
788 void CCLayerTreeHostImpl::setRootLayer(PassOwnPtr<CCLayerImpl> layer) 788 void CCLayerTreeHostImpl::setRootLayer(scoped_ptr<CCLayerImpl> layer)
789 { 789 {
790 m_rootLayerImpl = layer; 790 m_rootLayerImpl = layer.Pass();
791 m_rootScrollLayerImpl = findRootScrollLayer(m_rootLayerImpl.get()); 791 m_rootScrollLayerImpl = findRootScrollLayer(m_rootLayerImpl.get());
792 m_currentlyScrollingLayerImpl = 0; 792 m_currentlyScrollingLayerImpl = 0;
793 793
794 if (m_rootLayerImpl && m_scrollingLayerIdFromPreviousTree != -1) 794 if (m_rootLayerImpl && m_scrollingLayerIdFromPreviousTree != -1)
795 m_currentlyScrollingLayerImpl = CCLayerTreeHostCommon::findLayerInSubtre e(m_rootLayerImpl.get(), m_scrollingLayerIdFromPreviousTree); 795 m_currentlyScrollingLayerImpl = CCLayerTreeHostCommon::findLayerInSubtre e(m_rootLayerImpl.get(), m_scrollingLayerIdFromPreviousTree);
796 796
797 m_scrollingLayerIdFromPreviousTree = -1; 797 m_scrollingLayerIdFromPreviousTree = -1;
798 798
799 m_client->onCanDrawStateChanged(canDraw()); 799 m_client->onCanDrawStateChanged(canDraw());
800 } 800 }
801 801
802 PassOwnPtr<CCLayerImpl> CCLayerTreeHostImpl::detachLayerTree() 802 scoped_ptr<CCLayerImpl> CCLayerTreeHostImpl::detachLayerTree()
803 { 803 {
804 // Clear all data structures that have direct references to the layer tree. 804 // Clear all data structures that have direct references to the layer tree.
805 m_scrollingLayerIdFromPreviousTree = m_currentlyScrollingLayerImpl ? m_curre ntlyScrollingLayerImpl->id() : -1; 805 m_scrollingLayerIdFromPreviousTree = m_currentlyScrollingLayerImpl ? m_curre ntlyScrollingLayerImpl->id() : -1;
806 m_currentlyScrollingLayerImpl = 0; 806 m_currentlyScrollingLayerImpl = 0;
807 m_renderSurfaceLayerList.clear(); 807 m_renderSurfaceLayerList.clear();
808 808
809 return m_rootLayerImpl.release(); 809 return m_rootLayerImpl.Pass();
810 } 810 }
811 811
812 void CCLayerTreeHostImpl::setVisible(bool visible) 812 void CCLayerTreeHostImpl::setVisible(bool visible)
813 { 813 {
814 ASSERT(CCProxy::isImplThread()); 814 ASSERT(CCProxy::isImplThread());
815 815
816 if (m_visible == visible) 816 if (m_visible == visible)
817 return; 817 return;
818 m_visible = visible; 818 m_visible = visible;
819 didVisibilityChange(this, m_visible); 819 didVisibilityChange(this, m_visible);
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 1453
1454 CCScrollbarAnimationController* scrollbarController = layer->scrollbarAnimat ionController(); 1454 CCScrollbarAnimationController* scrollbarController = layer->scrollbarAnimat ionController();
1455 if (scrollbarController && scrollbarController->animate(monotonicTime)) 1455 if (scrollbarController && scrollbarController->animate(monotonicTime))
1456 m_client->setNeedsRedrawOnImplThread(); 1456 m_client->setNeedsRedrawOnImplThread();
1457 1457
1458 for (size_t i = 0; i < layer->children().size(); ++i) 1458 for (size_t i = 0; i < layer->children().size(); ++i)
1459 animateScrollbarsRecursive(layer->children()[i], monotonicTime); 1459 animateScrollbarsRecursive(layer->children()[i], monotonicTime);
1460 } 1460 }
1461 1461
1462 } // namespace cc 1462 } // namespace cc
OLDNEW
« cc/CCLayerImpl.h ('K') | « cc/CCLayerTreeHostImpl.h ('k') | cc/CCLayerTreeHostImplTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698