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

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: Fix cc unit tests 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
« no previous file with comments | « cc/CCLayerTreeHostImpl.h ('k') | cc/CCLayerTreeHostImplTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 779
780 if (layerImpl->scrollable()) 780 if (layerImpl->scrollable())
781 return layerImpl; 781 return layerImpl;
782 782
783 if (layerImpl->drawsContent() && layerImpl->parent() && layerImpl->parent()- >scrollable()) 783 if (layerImpl->drawsContent() && layerImpl->parent() && layerImpl->parent()- >scrollable())
784 return layerImpl->parent(); 784 return layerImpl->parent();
785 785
786 return 0; 786 return 0;
787 } 787 }
788 788
789 void CCLayerTreeHostImpl::setRootLayer(PassOwnPtr<CCLayerImpl> layer) 789 void CCLayerTreeHostImpl::setRootLayer(scoped_ptr<CCLayerImpl> layer)
790 { 790 {
791 m_rootLayerImpl = layer; 791 m_rootLayerImpl = layer.Pass();
792 m_rootScrollLayerImpl = findRootScrollLayer(m_rootLayerImpl.get()); 792 m_rootScrollLayerImpl = findRootScrollLayer(m_rootLayerImpl.get());
793 m_currentlyScrollingLayerImpl = 0; 793 m_currentlyScrollingLayerImpl = 0;
794 794
795 if (m_rootLayerImpl && m_scrollingLayerIdFromPreviousTree != -1) 795 if (m_rootLayerImpl && m_scrollingLayerIdFromPreviousTree != -1)
796 m_currentlyScrollingLayerImpl = CCLayerTreeHostCommon::findLayerInSubtre e(m_rootLayerImpl.get(), m_scrollingLayerIdFromPreviousTree); 796 m_currentlyScrollingLayerImpl = CCLayerTreeHostCommon::findLayerInSubtre e(m_rootLayerImpl.get(), m_scrollingLayerIdFromPreviousTree);
797 797
798 m_scrollingLayerIdFromPreviousTree = -1; 798 m_scrollingLayerIdFromPreviousTree = -1;
799 799
800 m_client->onCanDrawStateChanged(canDraw()); 800 m_client->onCanDrawStateChanged(canDraw());
801 } 801 }
802 802
803 PassOwnPtr<CCLayerImpl> CCLayerTreeHostImpl::detachLayerTree() 803 scoped_ptr<CCLayerImpl> CCLayerTreeHostImpl::detachLayerTree()
804 { 804 {
805 // Clear all data structures that have direct references to the layer tree. 805 // Clear all data structures that have direct references to the layer tree.
806 m_scrollingLayerIdFromPreviousTree = m_currentlyScrollingLayerImpl ? m_curre ntlyScrollingLayerImpl->id() : -1; 806 m_scrollingLayerIdFromPreviousTree = m_currentlyScrollingLayerImpl ? m_curre ntlyScrollingLayerImpl->id() : -1;
807 m_currentlyScrollingLayerImpl = 0; 807 m_currentlyScrollingLayerImpl = 0;
808 m_renderSurfaceLayerList.clear(); 808 m_renderSurfaceLayerList.clear();
809 809
810 return m_rootLayerImpl.release(); 810 return m_rootLayerImpl.Pass();
811 } 811 }
812 812
813 void CCLayerTreeHostImpl::setVisible(bool visible) 813 void CCLayerTreeHostImpl::setVisible(bool visible)
814 { 814 {
815 ASSERT(CCProxy::isImplThread()); 815 ASSERT(CCProxy::isImplThread());
816 816
817 if (m_visible == visible) 817 if (m_visible == visible)
818 return; 818 return;
819 m_visible = visible; 819 m_visible = visible;
820 didVisibilityChange(this, m_visible); 820 didVisibilityChange(this, m_visible);
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 1454
1455 CCScrollbarAnimationController* scrollbarController = layer->scrollbarAnimat ionController(); 1455 CCScrollbarAnimationController* scrollbarController = layer->scrollbarAnimat ionController();
1456 if (scrollbarController && scrollbarController->animate(monotonicTime)) 1456 if (scrollbarController && scrollbarController->animate(monotonicTime))
1457 m_client->setNeedsRedrawOnImplThread(); 1457 m_client->setNeedsRedrawOnImplThread();
1458 1458
1459 for (size_t i = 0; i < layer->children().size(); ++i) 1459 for (size_t i = 0; i < layer->children().size(); ++i)
1460 animateScrollbarsRecursive(layer->children()[i], monotonicTime); 1460 animateScrollbarsRecursive(layer->children()[i], monotonicTime);
1461 } 1461 }
1462 1462
1463 } // namespace cc 1463 } // namespace cc
OLDNEW
« no previous file with comments | « cc/CCLayerTreeHostImpl.h ('k') | cc/CCLayerTreeHostImplTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698