Changeset 137293 in webkit
- Timestamp:
- Dec 11, 2012 4:53:55 AM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r137278 r137293 1 2012-12-11 Christophe Dumez <christophe.dumez@intel.com> 2 3 [CoordinatedGraphics] Use unsigned integers for UpdateAtlas IDs 4 https://bugs.webkit.org/show_bug.cgi?id=104654 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 UpdateAtlas currently uses *signed* integer type for its identifier. 9 Due to the way we generate those IDs, it is safer to use *unsigned* 10 integers. This is because the generated ID will overflow at some 11 point and the C and C++ language standards say that overflow of a 12 signed value is undefined behaviour. 13 14 This patch switches to unsigned integer type for UpdateAtlas IDs 15 since unsigned integers are guaranteed to wrap around on overflow. 16 17 * Shared/SurfaceUpdateInfo.h: 18 (SurfaceUpdateInfo): 19 * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp: 20 (WebKit::LayerTreeCoordinatorProxy::createUpdateAtlas): 21 (WebKit::LayerTreeCoordinatorProxy::removeUpdateAtlas): 22 * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h: 23 (LayerTreeCoordinatorProxy): 24 * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in: 25 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp: 26 (WebCore::CoordinatedGraphicsLayer::beginContentUpdate): 27 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h: 28 (CoordinatedGraphicsLayerClient): 29 (CoordinatedGraphicsLayer): 30 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.h: 31 (CoordinatedTileClient): 32 * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp: 33 (WebKit::LayerTreeCoordinator::createUpdateAtlas): 34 (WebKit::LayerTreeCoordinator::removeUpdateAtlas): 35 (WebKit::LayerTreeCoordinator::beginContentUpdate): 36 * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h: 37 (LayerTreeCoordinator): 38 * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp: 39 (WebKit::UpdateAtlas::UpdateAtlas): 40 (WebKit::UpdateAtlas::~UpdateAtlas): 41 (WebKit::UpdateAtlas::beginPaintingOnAvailableBuffer): 42 * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h: 43 (UpdateAtlasClient): 44 (UpdateAtlas): 45 1 46 2012-12-11 Jinwoo Song <jinwoo7.song@samsung.com> 2 47 -
trunk/Source/WebKit2/Shared/SurfaceUpdateInfo.h
r133270 r137293 47 47 48 48 // The id of the update atlas including the shareable bitmap containing the updates. 49 int atlasID;49 uint32_t atlasID; 50 50 51 51 // The offset in the bitmap where the rendered contents are. -
trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp
r137117 r137293 79 79 } 80 80 81 void LayerTreeCoordinatorProxy::createUpdateAtlas( int atlasID, const WebCoordinatedSurface::Handle& handle)81 void LayerTreeCoordinatorProxy::createUpdateAtlas(uint32_t atlasID, const WebCoordinatedSurface::Handle& handle) 82 82 { 83 83 ASSERT(!m_surfaces.contains(atlasID)); … … 85 85 } 86 86 87 void LayerTreeCoordinatorProxy::removeUpdateAtlas( int atlasID)87 void LayerTreeCoordinatorProxy::removeUpdateAtlas(uint32_t atlasID) 88 88 { 89 89 ASSERT(m_surfaces.contains(atlasID)); -
trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h
r137117 r137293 70 70 void updateTileForLayer(CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&); 71 71 void removeTileForLayer(CoordinatedLayerID, uint32_t tileID); 72 void createUpdateAtlas( int atlasID, const WebCoordinatedSurface::Handle&);73 void removeUpdateAtlas( int atlasID);72 void createUpdateAtlas(uint32_t atlasID, const WebCoordinatedSurface::Handle&); 73 void removeUpdateAtlas(uint32_t atlasID); 74 74 void createImageBacking(CoordinatedImageBackingID); 75 75 void updateImageBacking(CoordinatedImageBackingID, const WebCoordinatedSurface::Handle&); … … 103 103 float m_lastSentScale; 104 104 WebCore::FloatPoint m_lastSentTrajectoryVector; 105 typedef HashMap< int /* atlasID */, RefPtr<CoordinatedSurface> > SurfaceMap;105 typedef HashMap<uint32_t /* atlasID */, RefPtr<CoordinatedSurface> > SurfaceMap; 106 106 SurfaceMap m_surfaces; 107 107 }; -
trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in
r137117 r137293 34 34 UpdateTileForLayer(uint32_t layerID, uint32_t tileID, WebCore::IntRect tileRect, WebKit::SurfaceUpdateInfo updateInfo) 35 35 RemoveTileForLayer(uint32_t layerID, uint32_t tileID) 36 CreateUpdateAtlas( int atlasID, WebKit::WebCoordinatedSurface::Handle handle)37 RemoveUpdateAtlas( int atlasID)36 CreateUpdateAtlas(uint32_t atlasID, WebKit::WebCoordinatedSurface::Handle handle) 37 RemoveUpdateAtlas(uint32_t atlasID) 38 38 CreateImageBacking(uint64_t imageID) 39 39 UpdateImageBacking(uint64_t imageID, WebKit::WebCoordinatedSurface::Handle handle) -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp
r137117 r137293 736 736 } 737 737 738 PassOwnPtr<GraphicsContext> CoordinatedGraphicsLayer::beginContentUpdate(const IntSize& size, int& atlas, IntPoint& offset)738 PassOwnPtr<GraphicsContext> CoordinatedGraphicsLayer::beginContentUpdate(const IntSize& size, uint32_t& atlas, IntPoint& offset) 739 739 { 740 740 if (!m_coordinator) -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h
r137117 r137293 75 75 virtual void detachLayer(WebCore::CoordinatedGraphicsLayer*) = 0; 76 76 virtual void syncFixedLayers() = 0; 77 virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, CoordinatedSurface::Flags, int& atlasID, WebCore::IntPoint&) = 0;77 virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, CoordinatedSurface::Flags, uint32_t& atlasID, WebCore::IntPoint&) = 0; 78 78 }; 79 79 } … … 159 159 virtual void updateTile(uint32_t tileID, const WebKit::SurfaceUpdateInfo&, const IntRect&) OVERRIDE; 160 160 virtual void removeTile(uint32_t tileID) OVERRIDE; 161 virtual PassOwnPtr<GraphicsContext> beginContentUpdate(const IntSize&, int& atlasID, IntPoint&) OVERRIDE;161 virtual PassOwnPtr<GraphicsContext> beginContentUpdate(const IntSize&, uint32_t& atlasID, IntPoint&) OVERRIDE; 162 162 163 163 void setCoordinator(WebKit::CoordinatedGraphicsLayerClient*); -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.h
r136658 r137293 79 79 virtual void updateTile(uint32_t tileID, const SurfaceUpdateInfo&, const WebCore::IntRect&) = 0; 80 80 virtual void removeTile(uint32_t tileID) = 0; 81 virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, int& atlasID, WebCore::IntPoint&) = 0;81 virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, uint32_t& atlasID, WebCore::IntPoint&) = 0; 82 82 }; 83 83 -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp
r137117 r137293 667 667 } 668 668 669 void LayerTreeCoordinator::createUpdateAtlas( int atlasID, const WebCoordinatedSurface::Handle& handle)669 void LayerTreeCoordinator::createUpdateAtlas(uint32_t atlasID, const WebCoordinatedSurface::Handle& handle) 670 670 { 671 671 m_webPage->send(Messages::LayerTreeCoordinatorProxy::CreateUpdateAtlas(atlasID, handle)); 672 672 } 673 673 674 void LayerTreeCoordinator::removeUpdateAtlas( int atlasID)674 void LayerTreeCoordinator::removeUpdateAtlas(uint32_t atlasID) 675 675 { 676 676 if (m_isPurging) … … 777 777 } 778 778 779 PassOwnPtr<GraphicsContext> LayerTreeCoordinator::beginContentUpdate(const IntSize& size, CoordinatedSurface::Flags flags, int& atlasID, IntPoint& offset)779 PassOwnPtr<GraphicsContext> LayerTreeCoordinator::beginContentUpdate(const IntSize& size, CoordinatedSurface::Flags flags, uint32_t& atlasID, IntPoint& offset) 780 780 { 781 781 OwnPtr<GraphicsContext> graphicsContext; -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h
r137117 r137293 105 105 virtual void syncFixedLayers(); 106 106 107 virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, CoordinatedSurface::Flags, int& atlasID, WebCore::IntPoint&);107 virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, CoordinatedSurface::Flags, uint32_t& atlasID, WebCore::IntPoint&); 108 108 109 109 // UpdateAtlasClient 110 virtual void createUpdateAtlas( int atlasID, const WebCoordinatedSurface::Handle&);111 virtual void removeUpdateAtlas( int atlasID);110 virtual void createUpdateAtlas(uint32_t atlasID, const WebCoordinatedSurface::Handle&); 111 virtual void removeUpdateAtlas(uint32_t atlasID); 112 112 113 113 #if ENABLE(REQUEST_ANIMATION_FRAME) -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp
r137117 r137293 36 36 , m_flags(flags) 37 37 , m_inactivityInSeconds(0) 38 , m_isVa ild(true)38 , m_isValid(true) 39 39 { 40 static int nextID = 0;40 static uint32_t nextID = 0; 41 41 m_ID = ++nextID; 42 42 IntSize size = nextPowerOfTwo(IntSize(dimension, dimension)); … … 44 44 45 45 if (!static_cast<WebCoordinatedSurface*>(m_surface.get())->createHandle(m_handle)) { 46 m_isVa ild = false;46 m_isValid = false; 47 47 return; 48 48 } … … 52 52 UpdateAtlas::~UpdateAtlas() 53 53 { 54 if (m_isVa ild)54 if (m_isValid) 55 55 m_client->removeUpdateAtlas(m_ID); 56 56 } … … 69 69 } 70 70 71 PassOwnPtr<GraphicsContext> UpdateAtlas::beginPaintingOnAvailableBuffer( int& atlasID, const WebCore::IntSize& size, IntPoint& offset)71 PassOwnPtr<GraphicsContext> UpdateAtlas::beginPaintingOnAvailableBuffer(uint32_t& atlasID, const WebCore::IntSize& size, IntPoint& offset) 72 72 { 73 73 m_inactivityInSeconds = 0; … … 79 79 return PassOwnPtr<GraphicsContext>(); 80 80 81 if (!m_isVa ild)81 if (!m_isValid) 82 82 return PassOwnPtr<GraphicsContext>(); 83 83 -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h
r137117 r137293 36 36 class UpdateAtlasClient { 37 37 public: 38 virtual void createUpdateAtlas( int atlasID, const WebCoordinatedSurface::Handle&) = 0;39 virtual void removeUpdateAtlas( int atlasID) = 0;38 virtual void createUpdateAtlas(uint32_t atlasID, const WebCoordinatedSurface::Handle&) = 0; 39 virtual void removeUpdateAtlas(uint32_t atlasID) = 0; 40 40 }; 41 41 … … 49 49 50 50 // Returns a null pointer of there is no available buffer. 51 PassOwnPtr<WebCore::GraphicsContext> beginPaintingOnAvailableBuffer( int& atlasID, const WebCore::IntSize&, WebCore::IntPoint& offset);51 PassOwnPtr<WebCore::GraphicsContext> beginPaintingOnAvailableBuffer(uint32_t& atlasID, const WebCore::IntSize&, WebCore::IntPoint& offset); 52 52 void didSwapBuffers(); 53 53 bool supportsAlpha() const { return m_surface->supportsAlpha(); } … … 75 75 WebCoordinatedSurface::Handle m_handle; 76 76 double m_inactivityInSeconds; 77 int m_ID;78 bool m_isVa ild;77 uint32_t m_ID; 78 bool m_isValid; 79 79 }; 80 80
Note: See TracChangeset
for help on using the changeset viewer.