diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-29 01:12:27 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-29 01:12:27 +0000 |
commit | 787465c591d96bb78dfc632dfef12fe5911255a5 (patch) | |
tree | 2cd1cd933405c2f5694b4f8432da3b6a6deaf2be /cc | |
parent | 0f24e53eb19d7662374fa84e2df1ebda4a2ae64e (diff) | |
download | chromium_src-787465c591d96bb78dfc632dfef12fe5911255a5.zip chromium_src-787465c591d96bb78dfc632dfef12fe5911255a5.tar.gz chromium_src-787465c591d96bb78dfc632dfef12fe5911255a5.tar.bz2 |
cc: Convert more usages from Vector to std::vector.
This patch converted the entries found by the following command line:
$ g grep -n "Vector<" cc/ | grep -v ScopedPtrVector | grep -v WebVector | grep -v "Vector<WebCore::IntRect"
BUG=154451
TEST=cc_unittests
R=enne@chromium.org,jamesr@chromium.org
Review URL: https://codereview.chromium.org/11343003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164582 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/layer_sorter.cc | 10 | ||||
-rw-r--r-- | cc/layer_tiling_data.cc | 4 | ||||
-rw-r--r-- | cc/layer_tree_host_common.h | 2 | ||||
-rw-r--r-- | cc/layer_tree_host_impl.cc | 4 | ||||
-rw-r--r-- | cc/layer_tree_host_impl_unittest.cc | 8 | ||||
-rw-r--r-- | cc/test/layer_tree_test_common.cc | 11 | ||||
-rw-r--r-- | cc/test/layer_tree_test_common.h | 2 | ||||
-rw-r--r-- | cc/tiled_layer.cc | 6 |
8 files changed, 22 insertions, 25 deletions
diff --git a/cc/layer_sorter.cc b/cc/layer_sorter.cc index f8783bb..ef347dbe 100644 --- a/cc/layer_sorter.cc +++ b/cc/layer_sorter.cc @@ -88,14 +88,14 @@ LayerSorter::ABCompareResult LayerSorter::checkOverlap(LayerShape* a, LayerShape FloatPoint bPoints[4] = {b->projectedQuad.p1(), b->projectedQuad.p2(), b->projectedQuad.p3(), b->projectedQuad.p4() }; // Make a list of points that inside both layer quad projections. - Vector<FloatPoint> overlapPoints; + std::vector<FloatPoint> overlapPoints; // Check all four corners of one layer against the other layer's quad. for (int i = 0; i < 4; ++i) { if (a->projectedQuad.containsPoint(bPoints[i])) - overlapPoints.append(bPoints[i]); + overlapPoints.push_back(bPoints[i]); if (b->projectedQuad.containsPoint(aPoints[i])) - overlapPoints.append(aPoints[i]); + overlapPoints.push_back(aPoints[i]); } // Check all the edges of one layer for intersection with the other layer's edges. @@ -105,9 +105,9 @@ LayerSorter::ABCompareResult LayerSorter::checkOverlap(LayerShape* a, LayerShape if (edgeEdgeTest(aPoints[ea], aPoints[(ea + 1) % 4], bPoints[eb], bPoints[(eb + 1) % 4], r)) - overlapPoints.append(r); + overlapPoints.push_back(r); - if (!overlapPoints.size()) + if (overlapPoints.empty()) return None; // Check the corresponding layer depth value for all overlap points to determine diff --git a/cc/layer_tiling_data.cc b/cc/layer_tiling_data.cc index c85a13b..a38d8eb 100644 --- a/cc/layer_tiling_data.cc +++ b/cc/layer_tiling_data.cc @@ -134,10 +134,10 @@ void LayerTilingData::setBounds(const IntSize& size) // Any tiles completely outside our new bounds are invalid and should be dropped. int left, top, right, bottom; contentRectToTileIndices(IntRect(IntPoint(), size), left, top, right, bottom); - Vector<TileMapKey> invalidTileKeys; + std::vector<TileMapKey> invalidTileKeys; for (TileMap::const_iterator it = m_tiles.begin(); it != m_tiles.end(); ++it) { if (it->first.first > right || it->first.second > bottom) - invalidTileKeys.append(it->first); + invalidTileKeys.push_back(it->first); } for (size_t i = 0; i < invalidTileKeys.size(); ++i) m_tiles.erase(invalidTileKeys[i]); diff --git a/cc/layer_tree_host_common.h b/cc/layer_tree_host_common.h index 5822ea1..1349629 100644 --- a/cc/layer_tree_host_common.h +++ b/cc/layer_tree_host_common.h @@ -53,7 +53,7 @@ struct ScrollAndScaleSet { ScrollAndScaleSet(); ~ScrollAndScaleSet(); - Vector<LayerTreeHostCommon::ScrollUpdateInfo> scrolls; + std::vector<LayerTreeHostCommon::ScrollUpdateInfo> scrolls; float pageScaleDelta; }; diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc index 272112c..e09fbf6 100644 --- a/cc/layer_tree_host_impl.cc +++ b/cc/layer_tree_host_impl.cc @@ -1308,7 +1308,7 @@ void LayerTreeHostImpl::makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, con LayerTreeHostCommon::ScrollUpdateInfo scroll; scroll.layerId = m_rootScrollLayerImpl->id(); scroll.scrollDelta = scrollOffset - toSize(m_rootScrollLayerImpl->scrollPosition()); - scrollInfo->scrolls.append(scroll); + scrollInfo->scrolls.push_back(scroll); m_rootScrollLayerImpl->setSentScrollDelta(scroll.scrollDelta); scrollInfo->pageScaleDelta = pageScale / m_pinchZoomViewport.pageScaleFactor(); m_pinchZoomViewport.setSentPageScaleDelta(scrollInfo->pageScaleDelta); @@ -1324,7 +1324,7 @@ static void collectScrollDeltas(ScrollAndScaleSet* scrollInfo, LayerImpl* layerI LayerTreeHostCommon::ScrollUpdateInfo scroll; scroll.layerId = layerImpl->id(); scroll.scrollDelta = scrollDelta; - scrollInfo->scrolls.append(scroll); + scrollInfo->scrolls.push_back(scroll); layerImpl->setSentScrollDelta(scrollDelta); } diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc index 999c63a..64cec3b 100644 --- a/cc/layer_tree_host_impl_unittest.cc +++ b/cc/layer_tree_host_impl_unittest.cc @@ -601,7 +601,7 @@ TEST_P(LayerTreeHostImplTest, pinchGesture) // Pushed to (0,0) via clamping against contents layer size. expectContains(*scrollInfo, scrollLayer->id(), IntSize(-50, -50)); } else { - EXPECT_TRUE(scrollInfo->scrolls.isEmpty()); + EXPECT_TRUE(scrollInfo->scrolls.empty()); } } @@ -709,7 +709,7 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZooming) if (!Settings::pageScalePinchZoomEnabled()) { expectContains(*scrollInfo, scrollLayer->id(), IntSize(25, 25)); } else { - EXPECT_TRUE(scrollInfo->scrolls.isEmpty()); + EXPECT_TRUE(scrollInfo->scrolls.empty()); } } @@ -729,7 +729,7 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZooming) expectContains(*scrollInfo, scrollLayer->id(), IntSize(0, 0)); } else { EXPECT_EQ(scrollInfo->pageScaleDelta, 1); - EXPECT_TRUE(scrollInfo->scrolls.isEmpty()); + EXPECT_TRUE(scrollInfo->scrolls.empty()); } // Once the gesture ends, we get the final scroll and page scale values. @@ -775,7 +775,7 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPage expectContains(*scrollInfo, scrollLayer->id(), IntSize(25, 25)); } else { EXPECT_EQ(scrollInfo->pageScaleDelta, 1); - EXPECT_TRUE(scrollInfo->scrolls.isEmpty()); + EXPECT_TRUE(scrollInfo->scrolls.empty()); } // Scrolling during the animation is ignored. diff --git a/cc/test/layer_tree_test_common.cc b/cc/test/layer_tree_test_common.cc index 60b3fb4..2bb5d41 100644 --- a/cc/test/layer_tree_test_common.cc +++ b/cc/test/layer_tree_test_common.cc @@ -45,18 +45,15 @@ scoped_ptr<CompositorFakeWebGraphicsContext3DWithTextureTracking> CompositorFake WebGLId CompositorFakeWebGraphicsContext3DWithTextureTracking::createTexture() { WebGLId texture = m_textures.size() + 1; - m_textures.append(texture); + m_textures.push_back(texture); return texture; } void CompositorFakeWebGraphicsContext3DWithTextureTracking::deleteTexture(WebGLId texture) { - for (size_t i = 0; i < m_textures.size(); i++) { - if (m_textures[i] == texture) { - m_textures.remove(i); - break; - } - } + std::vector<WebGLId>::iterator i(std::find(m_textures.begin(), m_textures.end(), texture)); + if (i != m_textures.end()) + m_textures.erase(i); } void CompositorFakeWebGraphicsContext3DWithTextureTracking::bindTexture(WGC3Denum /* target */, WebGLId texture) diff --git a/cc/test/layer_tree_test_common.h b/cc/test/layer_tree_test_common.h index ea82b05..3688c71 100644 --- a/cc/test/layer_tree_test_common.h +++ b/cc/test/layer_tree_test_common.h @@ -189,7 +189,7 @@ public: private: explicit CompositorFakeWebGraphicsContext3DWithTextureTracking(Attributes attrs); - Vector<WebKit::WebGLId> m_textures; + std::vector<WebKit::WebGLId> m_textures; base::hash_set<WebKit::WebGLId> m_usedTextures; }; diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc index df4a985..6c71c5b9 100644 --- a/cc/tiled_layer.cc +++ b/cc/tiled_layer.cc @@ -204,7 +204,7 @@ void TiledLayer::pushPropertiesTo(LayerImpl* layer) tiledLayer->setSkipsDraw(m_skipsDraw); tiledLayer->setTilingData(*m_tiler); - Vector<UpdatableTile*> invalidTiles; + std::vector<UpdatableTile*> invalidTiles; for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { int i = iter->first.first; @@ -216,7 +216,7 @@ void TiledLayer::pushPropertiesTo(LayerImpl* layer) if (!tile->managedTexture()->haveBackingTexture()) { // Evicted tiles get deleted from both layers - invalidTiles.append(tile); + invalidTiles.push_back(tile); continue; } @@ -228,7 +228,7 @@ void TiledLayer::pushPropertiesTo(LayerImpl* layer) tiledLayer->pushTileProperties(i, j, tile->managedTexture()->resourceId(), tile->opaqueRect(), tile->managedTexture()->contentsSwizzled()); } - for (Vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); iter != invalidTiles.end(); ++iter) + for (std::vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); iter != invalidTiles.end(); ++iter) m_tiler->takeTile((*iter)->i(), (*iter)->j()); } |