diff options
27 files changed, 94 insertions, 133 deletions
diff --git a/cc/bitmap_canvas_layer_texture_updater.cc b/cc/bitmap_canvas_layer_texture_updater.cc index 6afc8a3..ae1fea9 100644 --- a/cc/bitmap_canvas_layer_texture_updater.cc +++ b/cc/bitmap_canvas_layer_texture_updater.cc @@ -29,13 +29,13 @@ void BitmapCanvasLayerTextureUpdater::Texture::update(CCTextureUpdateQueue& queu textureUpdater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate); } -PassRefPtr<BitmapCanvasLayerTextureUpdater> BitmapCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter) +PassRefPtr<BitmapCanvasLayerTextureUpdater> BitmapCanvasLayerTextureUpdater::create(scoped_ptr<LayerPainterChromium> painter) { - return adoptRef(new BitmapCanvasLayerTextureUpdater(painter)); + return adoptRef(new BitmapCanvasLayerTextureUpdater(painter.Pass())); } -BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter) - : CanvasLayerTextureUpdater(painter) +BitmapCanvasLayerTextureUpdater::BitmapCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium> painter) + : CanvasLayerTextureUpdater(painter.Pass()) , m_opaque(false) { } diff --git a/cc/bitmap_canvas_layer_texture_updater.h b/cc/bitmap_canvas_layer_texture_updater.h index 97564d6..8d7939a 100644 --- a/cc/bitmap_canvas_layer_texture_updater.h +++ b/cc/bitmap_canvas_layer_texture_updater.h @@ -32,7 +32,7 @@ public: BitmapCanvasLayerTextureUpdater* m_textureUpdater; }; - static PassRefPtr<BitmapCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>); + static PassRefPtr<BitmapCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainterChromium>); virtual ~BitmapCanvasLayerTextureUpdater(); virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; @@ -43,12 +43,13 @@ public: virtual void setOpaque(bool) OVERRIDE; protected: - explicit BitmapCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); + explicit BitmapCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>); OwnPtr<SkCanvas> m_canvas; IntSize m_canvasSize; bool m_opaque; }; -} // namespace cc -#endif // BitmapCanvasLayerTextureUpdater_h +} // namespace cc + +#endif // BitmapCanvasLayerTextureUpdater_h diff --git a/cc/bitmap_skpicture_canvas_layer_texture_updater.cc b/cc/bitmap_skpicture_canvas_layer_texture_updater.cc index d6a2862..4469380 100644 --- a/cc/bitmap_skpicture_canvas_layer_texture_updater.cc +++ b/cc/bitmap_skpicture_canvas_layer_texture_updater.cc @@ -41,13 +41,13 @@ void BitmapSkPictureCanvasLayerTextureUpdater::Texture::update(CCTextureUpdateQu queue.appendFullUpload(upload); } -PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter) +PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerTextureUpdater::create(scoped_ptr<LayerPainterChromium> painter) { - return adoptRef(new BitmapSkPictureCanvasLayerTextureUpdater(painter)); + return adoptRef(new BitmapSkPictureCanvasLayerTextureUpdater(painter.Pass())); } -BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter) - : SkPictureCanvasLayerTextureUpdater(painter) +BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium> painter) + : SkPictureCanvasLayerTextureUpdater(painter.Pass()) { } diff --git a/cc/bitmap_skpicture_canvas_layer_texture_updater.h b/cc/bitmap_skpicture_canvas_layer_texture_updater.h index a4d62d1..aaa187b 100644 --- a/cc/bitmap_skpicture_canvas_layer_texture_updater.h +++ b/cc/bitmap_skpicture_canvas_layer_texture_updater.h @@ -28,7 +28,7 @@ public: BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater; }; - static PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>); + static PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainterChromium>); virtual ~BitmapSkPictureCanvasLayerTextureUpdater(); virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; @@ -36,7 +36,9 @@ public: void paintContentsRect(SkCanvas*, const IntRect& sourceRect, CCRenderingStats&); private: - explicit BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); + explicit BitmapSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>); }; -} // namespace cc -#endif // BitmapSkPictureCanvasLayerTextureUpdater_h + +} // namespace cc + +#endif // BitmapSkPictureCanvasLayerTextureUpdater_h diff --git a/cc/caching_bitmap_canvas_layer_texture_updater.cc b/cc/caching_bitmap_canvas_layer_texture_updater.cc index 7d2c85f..9225f47 100644 --- a/cc/caching_bitmap_canvas_layer_texture_updater.cc +++ b/cc/caching_bitmap_canvas_layer_texture_updater.cc @@ -13,13 +13,13 @@ namespace cc { PassRefPtr<CachingBitmapCanvasLayerTextureUpdater> CachingBitmapCanvasLayerTextureUpdater::Create( - PassOwnPtr<LayerPainterChromium> painter) { - return adoptRef(new CachingBitmapCanvasLayerTextureUpdater(painter)); + scoped_ptr<LayerPainterChromium> painter) { + return adoptRef(new CachingBitmapCanvasLayerTextureUpdater(painter.Pass())); } CachingBitmapCanvasLayerTextureUpdater::CachingBitmapCanvasLayerTextureUpdater( - PassOwnPtr<LayerPainterChromium> painter) - : BitmapCanvasLayerTextureUpdater(painter), + scoped_ptr<LayerPainterChromium> painter) + : BitmapCanvasLayerTextureUpdater(painter.Pass()), pixels_did_change_(false) { } diff --git a/cc/caching_bitmap_canvas_layer_texture_updater.h b/cc/caching_bitmap_canvas_layer_texture_updater.h index 9a6e6dd..8b16915 100644 --- a/cc/caching_bitmap_canvas_layer_texture_updater.h +++ b/cc/caching_bitmap_canvas_layer_texture_updater.h @@ -14,7 +14,7 @@ class CachingBitmapCanvasLayerTextureUpdater : public BitmapCanvasLayerTextureUpdater { public: static PassRefPtr<CachingBitmapCanvasLayerTextureUpdater> Create( - PassOwnPtr<LayerPainterChromium>); + scoped_ptr<LayerPainterChromium>); virtual void prepareToUpdate(const IntRect& content_rect, const IntSize& tile_size, @@ -27,7 +27,7 @@ class CachingBitmapCanvasLayerTextureUpdater private: explicit CachingBitmapCanvasLayerTextureUpdater( - PassOwnPtr<LayerPainterChromium> painter); + scoped_ptr<LayerPainterChromium> painter); bool pixels_did_change_; SkBitmap cached_bitmap_; diff --git a/cc/canvas_layer_texture_updater.cc b/cc/canvas_layer_texture_updater.cc index 29d4a2b..46e5843 100644 --- a/cc/canvas_layer_texture_updater.cc +++ b/cc/canvas_layer_texture_updater.cc @@ -19,8 +19,8 @@ namespace cc { -CanvasLayerTextureUpdater::CanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter) - : m_painter(painter) +CanvasLayerTextureUpdater::CanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium> painter) + : m_painter(painter.Pass()) { } diff --git a/cc/canvas_layer_texture_updater.h b/cc/canvas_layer_texture_updater.h index 056d716..0e79bed 100644 --- a/cc/canvas_layer_texture_updater.h +++ b/cc/canvas_layer_texture_updater.h @@ -22,15 +22,16 @@ public: virtual ~CanvasLayerTextureUpdater(); protected: - explicit CanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); + explicit CanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>); void paintContents(SkCanvas*, const IntRect& contentRect, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&); const IntRect& contentRect() const { return m_contentRect; } private: IntRect m_contentRect; - OwnPtr<LayerPainterChromium> m_painter; + scoped_ptr<LayerPainterChromium> m_painter; }; -} // namespace cc -#endif // CanvasLayerTextureUpdater_h +} // namespace cc + +#endif // CanvasLayerTextureUpdater_h diff --git a/cc/content_layer.cc b/cc/content_layer.cc index 03e268b..5c915f9 100644 --- a/cc/content_layer.cc +++ b/cc/content_layer.cc @@ -23,9 +23,9 @@ ContentLayerPainter::ContentLayerPainter(ContentLayerChromiumClient* client) { } -PassOwnPtr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerChromiumClient* client) +scoped_ptr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerChromiumClient* client) { - return adoptPtr(new ContentLayerPainter(client)); + return make_scoped_ptr(new ContentLayerPainter(client)); } void ContentLayerPainter::paint(SkCanvas* canvas, const IntRect& contentRect, FloatRect& opaque) @@ -87,12 +87,13 @@ void ContentLayerChromium::createTextureUpdaterIfNeeded() { if (m_textureUpdater) return; + scoped_ptr<LayerPainterChromium> painter = ContentLayerPainter::create(m_client).PassAs<LayerPainterChromium>(); if (layerTreeHost()->settings().acceleratePainting) - m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_client)); + m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(painter.Pass()); else if (CCSettings::perTilePaintingEnabled()) - m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_client)); + m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(painter.Pass()); else - m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_client)); + m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(painter.Pass()); m_textureUpdater->setOpaque(contentsOpaque()); GC3Denum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; diff --git a/cc/content_layer.h b/cc/content_layer.h index 1a1134b..add4b66 100644 --- a/cc/content_layer.h +++ b/cc/content_layer.h @@ -21,7 +21,7 @@ class LayerTextureUpdater; class ContentLayerPainter : public LayerPainterChromium { public: - static PassOwnPtr<ContentLayerPainter> create(ContentLayerChromiumClient*); + static scoped_ptr<ContentLayerPainter> create(ContentLayerChromiumClient*); virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect& opaque) OVERRIDE; diff --git a/cc/content_layer_unittest.cc b/cc/content_layer_unittest.cc index 8e6e7e6..dc84df7 100644 --- a/cc/content_layer_unittest.cc +++ b/cc/content_layer_unittest.cc @@ -14,8 +14,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include <public/WebFloatRect.h> #include <public/WebRect.h> -#include <wtf/OwnPtr.h> -#include <wtf/RefPtr.h> using namespace cc; using namespace WebKit; @@ -45,9 +43,8 @@ TEST(ContentLayerChromiumTest, ContentLayerPainterWithDeviceScale) IntRect opaqueRectInLayerSpace(5, 5, 20, 20); IntRect opaqueRectInContentSpace = opaqueRectInLayerSpace; opaqueRectInContentSpace.scale(contentsScale); - OwnPtr<SkCanvas> canvas = adoptPtr(skia::CreateBitmapCanvas(contentRect.width(), contentRect.height(), false)); MockContentLayerChromiumClient client(opaqueRectInLayerSpace); - RefPtr<BitmapCanvasLayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(&client)); + RefPtr<BitmapCanvasLayerTextureUpdater> updater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(&client).PassAs<LayerPainterChromium>()); IntRect resultingOpaqueRect; CCRenderingStats stats; diff --git a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc index 7c38103..3089cc8 100644 --- a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc +++ b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.cc @@ -26,13 +26,13 @@ void FrameBufferSkPictureCanvasLayerTextureUpdater::Texture::update(CCTextureUpd textureUpdater()->updateTexture(queue, texture(), sourceRect, destOffset, partialUpdate); } -PassRefPtr<FrameBufferSkPictureCanvasLayerTextureUpdater> FrameBufferSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter) +PassRefPtr<FrameBufferSkPictureCanvasLayerTextureUpdater> FrameBufferSkPictureCanvasLayerTextureUpdater::create(scoped_ptr<LayerPainterChromium> painter) { - return adoptRef(new FrameBufferSkPictureCanvasLayerTextureUpdater(painter)); + return adoptRef(new FrameBufferSkPictureCanvasLayerTextureUpdater(painter.Pass())); } -FrameBufferSkPictureCanvasLayerTextureUpdater::FrameBufferSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter) - : SkPictureCanvasLayerTextureUpdater(painter) +FrameBufferSkPictureCanvasLayerTextureUpdater::FrameBufferSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium> painter) + : SkPictureCanvasLayerTextureUpdater(painter.Pass()) { } diff --git a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h index 3a3376d..35d2d6a 100644 --- a/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h +++ b/cc/frame_buffer_skpicture_canvas_layer_texture_updater.h @@ -28,14 +28,14 @@ public: FrameBufferSkPictureCanvasLayerTextureUpdater* m_textureUpdater; }; - static PassRefPtr<FrameBufferSkPictureCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>); + static PassRefPtr<FrameBufferSkPictureCanvasLayerTextureUpdater> create(scoped_ptr<LayerPainterChromium>); virtual ~FrameBufferSkPictureCanvasLayerTextureUpdater(); virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(CCPrioritizedTextureManager*) OVERRIDE; virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat) OVERRIDE; private: - explicit FrameBufferSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); + explicit FrameBufferSkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>); }; } // namespace cc #endif // FrameBufferSkPictureCanvasLayerTextureUpdater_h diff --git a/cc/layer_tiling_data.cc b/cc/layer_tiling_data.cc index 331589c..2e6eaab 100644 --- a/cc/layer_tiling_data.cc +++ b/cc/layer_tiling_data.cc @@ -11,9 +11,9 @@ using namespace std; namespace cc { -PassOwnPtr<CCLayerTilingData> CCLayerTilingData::create(const IntSize& tileSize, BorderTexelOption border) +scoped_ptr<CCLayerTilingData> CCLayerTilingData::create(const IntSize& tileSize, BorderTexelOption border) { - return adoptPtr(new CCLayerTilingData(tileSize, border)); + return make_scoped_ptr(new CCLayerTilingData(tileSize, border)); } CCLayerTilingData::CCLayerTilingData(const IntSize& tileSize, BorderTexelOption border) @@ -58,16 +58,16 @@ const CCLayerTilingData& CCLayerTilingData::operator=(const CCLayerTilingData& t return *this; } -void CCLayerTilingData::addTile(PassOwnPtr<Tile> tile, int i, int j) +void CCLayerTilingData::addTile(scoped_ptr<Tile> tile, int i, int j) { ASSERT(!tileAt(i, j)); tile->moveTo(i, j); - m_tiles.add(make_pair(i, j), tile); + m_tiles.add(make_pair(i, j), tile.Pass()); } -PassOwnPtr<CCLayerTilingData::Tile> CCLayerTilingData::takeTile(int i, int j) +scoped_ptr<CCLayerTilingData::Tile> CCLayerTilingData::takeTile(int i, int j) { - return m_tiles.take(make_pair(i, j)); + return m_tiles.take_and_erase(make_pair(i, j)); } CCLayerTilingData::Tile* CCLayerTilingData::tileAt(int i, int j) const @@ -134,16 +134,11 @@ void CCLayerTilingData::setBounds(const IntSize& size) contentRectToTileIndices(IntRect(IntPoint(), size), left, top, right, bottom); Vector<TileMapKey> invalidTileKeys; for (TileMap::const_iterator it = m_tiles.begin(); it != m_tiles.end(); ++it) { -#if WTF_NEW_HASHMAP_ITERATORS_INTERFACE - if (it->key.first > right || it->key.second > bottom) - invalidTileKeys.append(it->key); -#else if (it->first.first > right || it->first.second > bottom) invalidTileKeys.append(it->first); -#endif } for (size_t i = 0; i < invalidTileKeys.size(); ++i) - m_tiles.remove(invalidTileKeys[i]); + m_tiles.erase(invalidTileKeys[i]); } IntSize CCLayerTilingData::bounds() const diff --git a/cc/layer_tiling_data.h b/cc/layer_tiling_data.h index 19921d0..2be7b4c 100644 --- a/cc/layer_tiling_data.h +++ b/cc/layer_tiling_data.h @@ -7,12 +7,12 @@ #define CCLayerTilingData_h #include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" +#include "cc/hash_pair.h" +#include "cc/scoped_ptr_hash_map.h" #include "IntRect.h" #include "Region.h" #include "TilingData.h" -#include <wtf/HashMap.h> -#include <wtf/HashTraits.h> -#include <wtf/PassOwnPtr.h> namespace cc { @@ -22,7 +22,7 @@ public: ~CCLayerTilingData(); - static PassOwnPtr<CCLayerTilingData> create(const IntSize& tileSize, BorderTexelOption); + static scoped_ptr<CCLayerTilingData> create(const IntSize& tileSize, BorderTexelOption); bool hasEmptyBounds() const { return m_tilingData.hasEmptyBounds(); } int numTilesX() const { return m_tilingData.numTilesX(); } @@ -58,20 +58,11 @@ public: IntRect m_opaqueRect; DISALLOW_COPY_AND_ASSIGN(Tile); }; - // Default hash key traits for integers disallow 0 and -1 as a key, so - // use a custom hash trait which disallows -1 and -2 instead. typedef std::pair<int, int> TileMapKey; - struct TileMapKeyTraits : HashTraits<TileMapKey> { - static const bool emptyValueIsZero = false; - static const bool needsDestruction = false; - static TileMapKey emptyValue() { return std::make_pair(-1, -1); } - static void constructDeletedValue(TileMapKey& slot) { slot = std::make_pair(-2, -2); } - static bool isDeletedValue(TileMapKey value) { return value.first == -2 && value.second == -2; } - }; - typedef HashMap<TileMapKey, OwnPtr<Tile>, DefaultHash<TileMapKey>::Hash, TileMapKeyTraits> TileMap; + typedef ScopedPtrHashMap<TileMapKey, Tile> TileMap; - void addTile(PassOwnPtr<Tile>, int, int); - PassOwnPtr<Tile> takeTile(int, int); + void addTile(scoped_ptr<Tile>, int, int); + scoped_ptr<Tile> takeTile(int, int); Tile* tileAt(int, int) const; const TileMap& tiles() const { return m_tiles; } diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc index e2dda54..0427663 100644 --- a/cc/layer_tree_host_impl_unittest.cc +++ b/cc/layer_tree_host_impl_unittest.cc @@ -813,7 +813,7 @@ protected: setSkipsDraw(false); setVisibleContentRect(IntRect(0, 0, 10, 10)); - OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::HasBorderTexels); + scoped_ptr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::HasBorderTexels); tiler->setBounds(contentBounds()); setTilingData(*tiler.get()); } @@ -945,7 +945,7 @@ private: explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDraw, bool animating, CCResourceProvider* resourceProvider) : DidDrawCheckLayer(id) { - OwnPtr<CCLayerTilingData> tilingData = CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::NoBorderTexels); + scoped_ptr<CCLayerTilingData> tilingData = CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::NoBorderTexels); tilingData->setBounds(bounds()); setTilingData(*tilingData.get()); setSkipsDraw(skipsDraw); @@ -2648,7 +2648,7 @@ TEST_P(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext) tileLayer->setContentBounds(IntSize(10, 10)); tileLayer->setDrawsContent(true); tileLayer->setSkipsDraw(false); - OwnPtr<CCLayerTilingData> tilingData(CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::NoBorderTexels)); + scoped_ptr<CCLayerTilingData> tilingData(CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::NoBorderTexels)); tilingData->setBounds(IntSize(10, 10)); tileLayer->setTilingData(*tilingData); tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10)); @@ -2833,7 +2833,7 @@ TEST_P(CCLayerTreeHostImplTest, layersFreeTextures) tileLayer->setContentBounds(IntSize(10, 10)); tileLayer->setDrawsContent(true); tileLayer->setSkipsDraw(false); - OwnPtr<CCLayerTilingData> tilingData(CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::NoBorderTexels)); + scoped_ptr<CCLayerTilingData> tilingData(CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::NoBorderTexels)); tilingData->setBounds(IntSize(10, 10)); tileLayer->setTilingData(*tilingData); tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10)); @@ -3629,7 +3629,7 @@ TEST_P(CCLayerTreeHostImplTest, textureCachingWithScissor) child->setSkipsDraw(false); // child layer has 10x10 tiles. - OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::HasBorderTexels); + scoped_ptr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(10, 10), CCLayerTilingData::HasBorderTexels); tiler->setBounds(child->contentBounds()); child->setTilingData(*tiler.get()); diff --git a/cc/quad_culler_unittest.cc b/cc/quad_culler_unittest.cc index 3c43355..27a3881 100644 --- a/cc/quad_culler_unittest.cc +++ b/cc/quad_culler_unittest.cc @@ -43,7 +43,7 @@ typedef CCLayerIterator<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurface, static scoped_ptr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, std::vector<CCLayerImpl*>& surfaceLayerList) { scoped_ptr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(1); - OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::NoBorderTexels); + scoped_ptr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::NoBorderTexels); tiler->setBounds(layerRect.size()); layer->setTilingData(*tiler); layer->setSkipsDraw(false); diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc index bbf980f..2aac77e 100644 --- a/cc/scrollbar_layer.cc +++ b/cc/scrollbar_layer.cc @@ -75,9 +75,9 @@ ScrollbarLayerChromium* ScrollbarLayerChromium::toScrollbarLayerChromium() class ScrollbarBackgroundPainter : public LayerPainterChromium { public: - static PassOwnPtr<ScrollbarBackgroundPainter> create(WebKit::WebScrollbar* scrollbar, WebKit::WebScrollbarThemePainter painter, WebKit::WebScrollbarThemeGeometry* geometry, WebKit::WebScrollbar::ScrollbarPart trackPart) + static scoped_ptr<ScrollbarBackgroundPainter> create(WebKit::WebScrollbar* scrollbar, WebKit::WebScrollbarThemePainter painter, WebKit::WebScrollbarThemeGeometry* geometry, WebKit::WebScrollbar::ScrollbarPart trackPart) { - return adoptPtr(new ScrollbarBackgroundPainter(scrollbar, painter, geometry, trackPart)); + return make_scoped_ptr(new ScrollbarBackgroundPainter(scrollbar, painter, geometry, trackPart)); } virtual void paint(SkCanvas* skCanvas, const IntRect& contentRect, FloatRect&) OVERRIDE @@ -143,9 +143,9 @@ IntSize ScrollbarLayerChromium::contentBounds() const class ScrollbarThumbPainter : public LayerPainterChromium { public: - static PassOwnPtr<ScrollbarThumbPainter> create(WebKit::WebScrollbar* scrollbar, WebKit::WebScrollbarThemePainter painter, WebKit::WebScrollbarThemeGeometry* geometry) + static scoped_ptr<ScrollbarThumbPainter> create(WebKit::WebScrollbar* scrollbar, WebKit::WebScrollbarThemePainter painter, WebKit::WebScrollbarThemeGeometry* geometry) { - return adoptPtr(new ScrollbarThumbPainter(scrollbar, painter, geometry)); + return make_scoped_ptr(new ScrollbarThumbPainter(scrollbar, painter, geometry)); } virtual void paint(SkCanvas* skCanvas, const IntRect& contentRect, FloatRect& opaque) OVERRIDE @@ -191,20 +191,20 @@ void ScrollbarLayerChromium::createTextureUpdaterIfNeeded() m_textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat; if (!m_backTrackUpdater) - m_backTrackUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::BackTrackPart)); + m_backTrackUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::BackTrackPart).PassAs<LayerPainterChromium>()); if (!m_backTrack) m_backTrack = m_backTrackUpdater->createTexture(layerTreeHost()->contentsTextureManager()); // Only create two-part track if we think the two parts could be different in appearance. if (m_scrollbar->isCustomScrollbar()) { if (!m_foreTrackUpdater) - m_foreTrackUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::ForwardTrackPart)); + m_foreTrackUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::ForwardTrackPart).PassAs<LayerPainterChromium>()); if (!m_foreTrack) m_foreTrack = m_foreTrackUpdater->createTexture(layerTreeHost()->contentsTextureManager()); } if (!m_thumbUpdater) - m_thumbUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarThumbPainter::create(m_scrollbar.get(), m_painter, m_geometry.get())); + m_thumbUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarThumbPainter::create(m_scrollbar.get(), m_painter, m_geometry.get()).PassAs<LayerPainterChromium>()); if (!m_thumb) m_thumb = m_thumbUpdater->createTexture(layerTreeHost()->contentsTextureManager()); } diff --git a/cc/skpicture_canvas_layer_texture_updater.cc b/cc/skpicture_canvas_layer_texture_updater.cc index f1489ce..7dd1bf2 100644 --- a/cc/skpicture_canvas_layer_texture_updater.cc +++ b/cc/skpicture_canvas_layer_texture_updater.cc @@ -14,8 +14,8 @@ namespace cc { -SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter) - : CanvasLayerTextureUpdater(painter) +SkPictureCanvasLayerTextureUpdater::SkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium> painter) + : CanvasLayerTextureUpdater(painter.Pass()) , m_layerIsOpaque(false) { } diff --git a/cc/skpicture_canvas_layer_texture_updater.h b/cc/skpicture_canvas_layer_texture_updater.h index 611ce21..78a5d02 100644 --- a/cc/skpicture_canvas_layer_texture_updater.h +++ b/cc/skpicture_canvas_layer_texture_updater.h @@ -27,7 +27,7 @@ public: virtual void setOpaque(bool) OVERRIDE; protected: - explicit SkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); + explicit SkPictureCanvasLayerTextureUpdater(scoped_ptr<LayerPainterChromium>); virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, float contentsWidthScale, float contentsHeightScale, IntRect& resultingOpaqueRect, CCRenderingStats&) OVERRIDE; void drawPicture(SkCanvas*); diff --git a/cc/texture_layer.cc b/cc/texture_layer.cc index 00b81f8..bb449f3 100644 --- a/cc/texture_layer.cc +++ b/cc/texture_layer.cc @@ -8,9 +8,7 @@ #include "CCLayerTreeHost.h" #include "CCTextureLayerImpl.h" -#include "GraphicsContext3D.h" #include "TextureLayerChromiumClient.h" -#include <public/WebGraphicsContext3D.h> namespace cc { diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc index cfec536..6e268927 100644 --- a/cc/tiled_layer.cc +++ b/cc/tiled_layer.cc @@ -12,10 +12,7 @@ #include "CCOverdrawMetrics.h" #include "CCTextureUpdateQueue.h" #include "CCTiledLayerImpl.h" -#include "GraphicsContext3D.h" #include "Region.h" -#include <wtf/CurrentTime.h> -#include <wtf/MathExtras.h> using namespace std; using WebKit::WebTransformationMatrix; @@ -24,9 +21,9 @@ namespace cc { class UpdatableTile : public CCLayerTilingData::Tile { public: - static PassOwnPtr<UpdatableTile> create(PassOwnPtr<LayerTextureUpdater::Texture> texture) + static scoped_ptr<UpdatableTile> create(PassOwnPtr<LayerTextureUpdater::Texture> texture) { - return adoptPtr(new UpdatableTile(texture)); + return make_scoped_ptr(new UpdatableTile(texture)); } LayerTextureUpdater::Texture* texture() { return m_texture.get(); } @@ -203,15 +200,9 @@ void TiledLayerChromium::pushPropertiesTo(CCLayerImpl* layer) Vector<UpdatableTile*> invalidTiles; for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { -#if WTF_NEW_HASHMAP_ITERATORS_INTERFACE - int i = iter->key.first; - int j = iter->key.second; - UpdatableTile* tile = static_cast<UpdatableTile*>(iter->value.get()); -#else int i = iter->first.first; int j = iter->first.second; - UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); -#endif + UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); // FIXME: This should not ever be null. if (!tile) continue; @@ -248,11 +239,7 @@ void TiledLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) { if (host && host != layerTreeHost()) { for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { -#if WTF_NEW_HASHMAP_ITERATORS_INTERFACE - UpdatableTile* tile = static_cast<UpdatableTile*>(iter->value.get()); -#else - UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); -#endif + UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); // FIXME: This should not ever be null. if (!tile) continue; @@ -271,11 +258,11 @@ UpdatableTile* TiledLayerChromium::createTile(int i, int j) { createTextureUpdaterIfNeeded(); - OwnPtr<UpdatableTile> tile(UpdatableTile::create(textureUpdater()->createTexture(textureManager()))); + scoped_ptr<UpdatableTile> tile(UpdatableTile::create(textureUpdater()->createTexture(textureManager()))); tile->managedTexture()->setDimensions(m_tiler->tileSize(), m_textureFormat); UpdatableTile* addedTile = tile.get(); - m_tiler->addTile(tile.release(), i, j); + m_tiler->addTile(tile.PassAs<CCLayerTilingData::Tile>(), i, j); addedTile->dirtyRect = m_tiler->tileRect(addedTile); @@ -320,11 +307,7 @@ void TiledLayerChromium::invalidateContentRect(const IntRect& contentRect) return; for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { -#if WTF_NEW_HASHMAP_ITERATORS_INTERFACE - UpdatableTile* tile = static_cast<UpdatableTile*>(iter->value.get()); -#else - UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); -#endif + UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); ASSERT(tile); // FIXME: This should not ever be null. if (!tile) @@ -648,11 +631,7 @@ void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priori // Now update priorities on all tiles we have in the layer, no matter where they are. for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { -#if WTF_NEW_HASHMAP_ITERATORS_INTERFACE - UpdatableTile* tile = static_cast<UpdatableTile*>(iter->value.get()); -#else - UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); -#endif + UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); // FIXME: This should not ever be null. if (!tile) continue; @@ -677,11 +656,7 @@ void TiledLayerChromium::resetUpdateState() CCLayerTilingData::TileMap::const_iterator end = m_tiler->tiles().end(); for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != end; ++iter) { -#if WTF_NEW_HASHMAP_ITERATORS_INTERFACE - UpdatableTile* tile = static_cast<UpdatableTile*>(iter->value.get()); -#else - UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); -#endif + UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); // FIXME: This should not ever be null. if (!tile) continue; diff --git a/cc/tiled_layer.h b/cc/tiled_layer.h index adf8903..aa57819 100644 --- a/cc/tiled_layer.h +++ b/cc/tiled_layer.h @@ -94,7 +94,7 @@ private: LayerTextureUpdater::SampledTexelFormat m_sampledTexelFormat; TilingOption m_tilingOption; - OwnPtr<CCLayerTilingData> m_tiler; + scoped_ptr<CCLayerTilingData> m_tiler; }; } diff --git a/cc/tiled_layer_impl.cc b/cc/tiled_layer_impl.cc index 96dc09a..511ca95 100644 --- a/cc/tiled_layer_impl.cc +++ b/cc/tiled_layer_impl.cc @@ -46,7 +46,7 @@ static const int debugTileInvalidatedCheckerboardColorBlue = 245; class DrawableTile : public CCLayerTilingData::Tile { public: - static PassOwnPtr<DrawableTile> create() { return adoptPtr(new DrawableTile()); } + static scoped_ptr<DrawableTile> create() { return make_scoped_ptr(new DrawableTile()); } CCResourceProvider::ResourceId resourceId() const { return m_resourceId; } void setResourceId(CCResourceProvider::ResourceId resourceId) { m_resourceId = resourceId; } @@ -106,9 +106,9 @@ DrawableTile* CCTiledLayerImpl::tileAt(int i, int j) const DrawableTile* CCTiledLayerImpl::createTile(int i, int j) { - OwnPtr<DrawableTile> tile(DrawableTile::create()); + scoped_ptr<DrawableTile> tile(DrawableTile::create()); DrawableTile* addedTile = tile.get(); - m_tiler->addTile(tile.release(), i, j); + m_tiler->addTile(tile.PassAs<CCLayerTilingData::Tile>(), i, j); return addedTile; } diff --git a/cc/tiled_layer_impl.h b/cc/tiled_layer_impl.h index 2d6803d..aedcb18 100644 --- a/cc/tiled_layer_impl.h +++ b/cc/tiled_layer_impl.h @@ -54,7 +54,7 @@ private: bool m_skipsDraw; bool m_contentsSwizzled; - OwnPtr<CCLayerTilingData> m_tiler; + scoped_ptr<CCLayerTilingData> m_tiler; }; } diff --git a/cc/tiled_layer_impl_unittest.cc b/cc/tiled_layer_impl_unittest.cc index cb58ed2..ff5ef9e 100644 --- a/cc/tiled_layer_impl_unittest.cc +++ b/cc/tiled_layer_impl_unittest.cc @@ -25,7 +25,7 @@ namespace { static scoped_ptr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexels) { scoped_ptr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(1); - OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(tileSize, borderTexels); + scoped_ptr<CCLayerTilingData> tiler = CCLayerTilingData::create(tileSize, borderTexels); tiler->setBounds(layerSize); layer->setTilingData(*tiler); layer->setSkipsDraw(false); diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc index a1b28c0..172dafb 100644 --- a/cc/tiled_layer_unittest.cc +++ b/cc/tiled_layer_unittest.cc @@ -1457,7 +1457,7 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca class TrackingLayerPainter : public LayerPainterChromium { public: - static PassOwnPtr<TrackingLayerPainter> create() { return adoptPtr(new TrackingLayerPainter()); } + static scoped_ptr<TrackingLayerPainter> create() { return make_scoped_ptr(new TrackingLayerPainter()); } virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect&) OVERRIDE { @@ -1478,9 +1478,9 @@ public: explicit UpdateTrackingTiledLayerChromium(CCPrioritizedTextureManager* manager) : FakeTiledLayerChromium(manager) { - OwnPtr<TrackingLayerPainter> trackingLayerPainter(TrackingLayerPainter::create()); + scoped_ptr<TrackingLayerPainter> trackingLayerPainter(TrackingLayerPainter::create()); m_trackingLayerPainter = trackingLayerPainter.get(); - m_layerTextureUpdater = BitmapCanvasLayerTextureUpdater::create(trackingLayerPainter.release()); + m_layerTextureUpdater = BitmapCanvasLayerTextureUpdater::create(trackingLayerPainter.PassAs<LayerPainterChromium>()); } TrackingLayerPainter* trackingLayerPainter() const { return m_trackingLayerPainter; } |