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

Side by Side Diff: cc/CCLayerTreeHostImpl.cpp

Issue 11076013: [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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 671
672 if (layerImpl->scrollable()) 672 if (layerImpl->scrollable())
673 return layerImpl; 673 return layerImpl;
674 674
675 if (layerImpl->drawsContent() && layerImpl->parent() && layerImpl->parent()- >scrollable()) 675 if (layerImpl->drawsContent() && layerImpl->parent() && layerImpl->parent()- >scrollable())
676 return layerImpl->parent(); 676 return layerImpl->parent();
677 677
678 return 0; 678 return 0;
679 } 679 }
680 680
681 void CCLayerTreeHostImpl::setRootLayer(PassOwnPtr<CCLayerImpl> layer) 681 void CCLayerTreeHostImpl::setRootLayer(scoped_ptr<CCLayerImpl> layer)
682 { 682 {
683 m_rootLayerImpl = layer; 683 m_rootLayerImpl = layer.Pass();
684 m_rootScrollLayerImpl = findRootScrollLayer(m_rootLayerImpl.get()); 684 m_rootScrollLayerImpl = findRootScrollLayer(m_rootLayerImpl.get());
685 m_currentlyScrollingLayerImpl = 0; 685 m_currentlyScrollingLayerImpl = 0;
686 686
687 if (m_rootLayerImpl && m_scrollingLayerIdFromPreviousTree != -1) 687 if (m_rootLayerImpl && m_scrollingLayerIdFromPreviousTree != -1)
688 m_currentlyScrollingLayerImpl = CCLayerTreeHostCommon::findLayerInSubtre e(m_rootLayerImpl.get(), m_scrollingLayerIdFromPreviousTree); 688 m_currentlyScrollingLayerImpl = CCLayerTreeHostCommon::findLayerInSubtre e(m_rootLayerImpl.get(), m_scrollingLayerIdFromPreviousTree);
689 689
690 m_scrollingLayerIdFromPreviousTree = -1; 690 m_scrollingLayerIdFromPreviousTree = -1;
691 691
692 m_client->onCanDrawStateChanged(canDraw()); 692 m_client->onCanDrawStateChanged(canDraw());
693 } 693 }
694 694
695 PassOwnPtr<CCLayerImpl> CCLayerTreeHostImpl::detachLayerTree() 695 scoped_ptr<CCLayerImpl> CCLayerTreeHostImpl::detachLayerTree()
696 { 696 {
697 // Clear all data structures that have direct references to the layer tree. 697 // Clear all data structures that have direct references to the layer tree.
698 m_scrollingLayerIdFromPreviousTree = m_currentlyScrollingLayerImpl ? m_curre ntlyScrollingLayerImpl->id() : -1; 698 m_scrollingLayerIdFromPreviousTree = m_currentlyScrollingLayerImpl ? m_curre ntlyScrollingLayerImpl->id() : -1;
699 m_currentlyScrollingLayerImpl = 0; 699 m_currentlyScrollingLayerImpl = 0;
700 m_renderSurfaceLayerList.clear(); 700 m_renderSurfaceLayerList.clear();
701 701
702 return m_rootLayerImpl.release(); 702 return m_rootLayerImpl.Pass();
703 } 703 }
704 704
705 void CCLayerTreeHostImpl::setVisible(bool visible) 705 void CCLayerTreeHostImpl::setVisible(bool visible)
706 { 706 {
707 ASSERT(CCProxy::isImplThread()); 707 ASSERT(CCProxy::isImplThread());
708 708
709 if (m_visible == visible) 709 if (m_visible == visible)
710 return; 710 return;
711 m_visible = visible; 711 m_visible = visible;
712 didVisibilityChange(this, m_visible); 712 didVisibilityChange(this, m_visible);
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 1322
1323 CCScrollbarAnimationController* scrollbarController = layer->scrollbarAnimat ionController(); 1323 CCScrollbarAnimationController* scrollbarController = layer->scrollbarAnimat ionController();
1324 if (scrollbarController && scrollbarController->animate(monotonicTime)) 1324 if (scrollbarController && scrollbarController->animate(monotonicTime))
1325 m_client->setNeedsRedrawOnImplThread(); 1325 m_client->setNeedsRedrawOnImplThread();
1326 1326
1327 for (size_t i = 0; i < layer->children().size(); ++i) 1327 for (size_t i = 0; i < layer->children().size(); ++i)
1328 animateScrollbarsRecursive(layer->children()[i], monotonicTime); 1328 animateScrollbarsRecursive(layer->children()[i], monotonicTime);
1329 } 1329 }
1330 1330
1331 } // namespace cc 1331 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698