diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-20 03:34:03 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-20 03:34:03 +0000 |
commit | 0920e24fdb8558f364926651828142d8a380e645 (patch) | |
tree | 850464d0f223985aaea40922e64f2c1ea9d6a59f /cc/CCLayerTreeHostCommon.h | |
parent | 7b5d438ccc3eb04f6a3d069052f9bfb06316726c (diff) | |
download | chromium_src-0920e24fdb8558f364926651828142d8a380e645.zip chromium_src-0920e24fdb8558f364926651828142d8a380e645.tar.gz chromium_src-0920e24fdb8558f364926651828142d8a380e645.tar.bz2 |
Add wrapper container for a vector of OwnPtr<T>
In cc we frequently use WTF::Vector<WTF::OwnPtr<T> > to store lists of single-ownership
objects. In WTF this works nicely using template specialization in the container
implementation. In chromium we use STL containers and can't modify the implementation,
so this adds a wrapper to do roughly the same thing.
BUG=
Review URL: https://chromiumcodereview.appspot.com/10940002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157699 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/CCLayerTreeHostCommon.h')
-rw-r--r-- | cc/CCLayerTreeHostCommon.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/cc/CCLayerTreeHostCommon.h b/cc/CCLayerTreeHostCommon.h index 117bb8b..55d137c 100644 --- a/cc/CCLayerTreeHostCommon.h +++ b/cc/CCLayerTreeHostCommon.h @@ -7,6 +7,7 @@ #include "IntRect.h" #include "IntSize.h" +#include "cc/own_ptr_vector.h" #include <public/WebTransformationMatrix.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> @@ -36,6 +37,16 @@ public: // from the given root layer (including mask and replica layers). template<typename LayerType> static LayerType* findLayerInSubtree(LayerType* rootLayer, int layerId); + static LayerChromium* getChildAsRawPtr(const Vector<RefPtr<LayerChromium> >& children, size_t index) + { + return children[index].get(); + } + + static CCLayerImpl* getChildAsRawPtr(const OwnPtrVector<CCLayerImpl>& children, size_t index) + { + return children[index]; + } + struct ScrollUpdateInfo { int layerId; IntSize scrollDelta; @@ -77,7 +88,7 @@ LayerType* CCLayerTreeHostCommon::findLayerInSubtree(LayerType* rootLayer, int l return rootLayer->replicaLayer(); for (size_t i = 0; i < rootLayer->children().size(); ++i) { - if (LayerType* found = findLayerInSubtree(rootLayer->children()[i].get(), layerId)) + if (LayerType* found = findLayerInSubtree(getChildAsRawPtr(rootLayer->children(), i), layerId)) return found; } return 0; |