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

Side by Side Diff: cc/TiledLayerChromium.cpp

Issue 10914327: Make cc's use of WTF::HashMap robust to key/value change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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
« no previous file with comments | « cc/CCResourceProvider.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #if USE(ACCELERATED_COMPOSITING) 7 #if USE(ACCELERATED_COMPOSITING)
8 8
9 #include "TiledLayerChromium.h" 9 #include "TiledLayerChromium.h"
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 LayerChromium::pushPropertiesTo(layer); 196 LayerChromium::pushPropertiesTo(layer);
197 197
198 CCTiledLayerImpl* tiledLayer = static_cast<CCTiledLayerImpl*>(layer); 198 CCTiledLayerImpl* tiledLayer = static_cast<CCTiledLayerImpl*>(layer);
199 199
200 tiledLayer->setSkipsDraw(m_skipsDraw); 200 tiledLayer->setSkipsDraw(m_skipsDraw);
201 tiledLayer->setContentsSwizzled(m_sampledTexelFormat != LayerTextureUpdater: :SampledTexelFormatRGBA); 201 tiledLayer->setContentsSwizzled(m_sampledTexelFormat != LayerTextureUpdater: :SampledTexelFormatRGBA);
202 tiledLayer->setTilingData(*m_tiler); 202 tiledLayer->setTilingData(*m_tiler);
203 Vector<UpdatableTile*> invalidTiles; 203 Vector<UpdatableTile*> invalidTiles;
204 204
205 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi n(); iter != m_tiler->tiles().end(); ++iter) { 205 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi n(); iter != m_tiler->tiles().end(); ++iter) {
206 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE
207 int i = iter->key.first;
208 int j = iter->key.second;
209 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->value.get());
210 #else
206 int i = iter->first.first; 211 int i = iter->first.first;
207 int j = iter->first.second; 212 int j = iter->first.second;
208 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); 213 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get());
214 #endif
209 // FIXME: This should not ever be null. 215 // FIXME: This should not ever be null.
210 if (!tile) 216 if (!tile)
211 continue; 217 continue;
212 tile->isInUseOnImpl = false; 218 tile->isInUseOnImpl = false;
213 if (!tile->managedTexture()->haveBackingTexture()) { 219 if (!tile->managedTexture()->haveBackingTexture()) {
214 invalidTiles.append(tile); 220 invalidTiles.append(tile);
215 continue; 221 continue;
216 } 222 }
217 if (!tile->validForFrame) 223 if (!tile->validForFrame)
218 continue; 224 continue;
219 225
220 tiledLayer->pushTileProperties(i, j, tile->managedTexture()->resourceId( ), tile->opaqueRect()); 226 tiledLayer->pushTileProperties(i, j, tile->managedTexture()->resourceId( ), tile->opaqueRect());
221 tile->isInUseOnImpl = true; 227 tile->isInUseOnImpl = true;
222 } 228 }
223 for (Vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); ite r != invalidTiles.end(); ++iter) 229 for (Vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); ite r != invalidTiles.end(); ++iter)
224 m_tiler->takeTile((*iter)->i(), (*iter)->j()); 230 m_tiler->takeTile((*iter)->i(), (*iter)->j());
225 } 231 }
226 232
227 CCPrioritizedTextureManager* TiledLayerChromium::textureManager() const 233 CCPrioritizedTextureManager* TiledLayerChromium::textureManager() const
228 { 234 {
229 if (!layerTreeHost()) 235 if (!layerTreeHost())
230 return 0; 236 return 0;
231 return layerTreeHost()->contentsTextureManager(); 237 return layerTreeHost()->contentsTextureManager();
232 } 238 }
233 239
234 void TiledLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) 240 void TiledLayerChromium::setLayerTreeHost(CCLayerTreeHost* host)
235 { 241 {
236 if (host && host != layerTreeHost()) { 242 if (host && host != layerTreeHost()) {
237 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles(). begin(); iter != m_tiler->tiles().end(); ++iter) { 243 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles(). begin(); iter != m_tiler->tiles().end(); ++iter) {
244 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE
245 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->value.get()) ;
246 #else
238 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get() ); 247 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get() );
248 #endif
239 // FIXME: This should not ever be null. 249 // FIXME: This should not ever be null.
240 if (!tile) 250 if (!tile)
241 continue; 251 continue;
242 tile->managedTexture()->setTextureManager(host->contentsTextureManag er()); 252 tile->managedTexture()->setTextureManager(host->contentsTextureManag er());
243 } 253 }
244 } 254 }
245 LayerChromium::setLayerTreeHost(host); 255 LayerChromium::setLayerTreeHost(host);
246 } 256 }
247 257
248 UpdatableTile* TiledLayerChromium::tileAt(int i, int j) const 258 UpdatableTile* TiledLayerChromium::tileAt(int i, int j) const
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 setBorderTexelOption(borderTexelOption); 306 setBorderTexelOption(borderTexelOption);
297 } 307 }
298 308
299 void TiledLayerChromium::invalidateContentRect(const IntRect& contentRect) 309 void TiledLayerChromium::invalidateContentRect(const IntRect& contentRect)
300 { 310 {
301 updateBounds(); 311 updateBounds();
302 if (m_tiler->isEmpty() || contentRect.isEmpty() || m_skipsDraw) 312 if (m_tiler->isEmpty() || contentRect.isEmpty() || m_skipsDraw)
303 return; 313 return;
304 314
305 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi n(); iter != m_tiler->tiles().end(); ++iter) { 315 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi n(); iter != m_tiler->tiles().end(); ++iter) {
316 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE
317 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->value.get());
318 #else
306 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); 319 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get());
320 #endif
307 ASSERT(tile); 321 ASSERT(tile);
308 // FIXME: This should not ever be null. 322 // FIXME: This should not ever be null.
309 if (!tile) 323 if (!tile)
310 continue; 324 continue;
311 IntRect bound = m_tiler->tileRect(tile); 325 IntRect bound = m_tiler->tileRect(tile);
312 bound.intersect(contentRect); 326 bound.intersect(contentRect);
313 tile->dirtyRect.unite(bound); 327 tile->dirtyRect.unite(bound);
314 } 328 }
315 } 329 }
316 330
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 backBuffer->texture()->format()); 639 backBuffer->texture()->format());
626 // Swap backBuffer into frontBuffer and add it to delete after c ommit queue. 640 // Swap backBuffer into frontBuffer and add it to delete after c ommit queue.
627 backBuffer->swapTextureWith(frontBuffer); 641 backBuffer->swapTextureWith(frontBuffer);
628 layerTreeHost()->deleteTextureAfterCommit(frontBuffer.release()) ; 642 layerTreeHost()->deleteTextureAfterCommit(frontBuffer.release()) ;
629 } 643 }
630 } 644 }
631 } 645 }
632 646
633 // Now update priorities on all tiles we have in the layer, no matter where they are. 647 // Now update priorities on all tiles we have in the layer, no matter where they are.
634 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi n(); iter != m_tiler->tiles().end(); ++iter) { 648 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi n(); iter != m_tiler->tiles().end(); ++iter) {
649 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE
650 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->value.get());
651 #else
635 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); 652 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get());
653 #endif
636 // FIXME: This should not ever be null. 654 // FIXME: This should not ever be null.
637 if (!tile) 655 if (!tile)
638 continue; 656 continue;
639 IntRect tileRect = m_tiler->tileRect(tile); 657 IntRect tileRect = m_tiler->tileRect(tile);
640 setPriorityForTexture(visibleContentRect(), tileRect, drawsToRoot, small AnimatedLayer, tile->managedTexture()); 658 setPriorityForTexture(visibleContentRect(), tileRect, drawsToRoot, small AnimatedLayer, tile->managedTexture());
641 } 659 }
642 } 660 }
643 661
644 Region TiledLayerChromium::visibleContentOpaqueRegion() const 662 Region TiledLayerChromium::visibleContentOpaqueRegion() const
645 { 663 {
646 if (m_skipsDraw) 664 if (m_skipsDraw)
647 return Region(); 665 return Region();
648 if (opaque()) 666 if (opaque())
649 return visibleContentRect(); 667 return visibleContentRect();
650 return m_tiler->opaqueRegionInContentRect(visibleContentRect()); 668 return m_tiler->opaqueRegionInContentRect(visibleContentRect());
651 } 669 }
652 670
653 void TiledLayerChromium::resetUpdateState() 671 void TiledLayerChromium::resetUpdateState()
654 { 672 {
655 m_skipsDraw = false; 673 m_skipsDraw = false;
656 m_failedUpdate = false; 674 m_failedUpdate = false;
657 675
658 CCLayerTilingData::TileMap::const_iterator end = m_tiler->tiles().end(); 676 CCLayerTilingData::TileMap::const_iterator end = m_tiler->tiles().end();
659 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi n(); iter != end; ++iter) { 677 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi n(); iter != end; ++iter) {
678 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE
679 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->value.get());
680 #else
660 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); 681 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get());
682 #endif
661 // FIXME: This should not ever be null. 683 // FIXME: This should not ever be null.
662 if (!tile) 684 if (!tile)
663 continue; 685 continue;
664 tile->resetUpdateState(); 686 tile->resetUpdateState();
665 } 687 }
666 } 688 }
667 689
668 void TiledLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTr acker* occlusion, CCRenderingStats& stats) 690 void TiledLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusionTr acker* occlusion, CCRenderingStats& stats)
669 { 691 {
670 ASSERT(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped ? 692 ASSERT(!m_skipsDraw && !m_failedUpdate); // Did resetUpdateState get skipped ?
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 prepaintRect.inflateX(m_tiler->tileSize().width()); 802 prepaintRect.inflateX(m_tiler->tileSize().width());
781 prepaintRect.inflateY(m_tiler->tileSize().height() * 2); 803 prepaintRect.inflateY(m_tiler->tileSize().height() * 2);
782 IntRect contentRect(IntPoint::zero(), contentBounds()); 804 IntRect contentRect(IntPoint::zero(), contentBounds());
783 prepaintRect.intersect(contentRect); 805 prepaintRect.intersect(contentRect);
784 806
785 return prepaintRect; 807 return prepaintRect;
786 } 808 }
787 809
788 } 810 }
789 #endif // USE(ACCELERATED_COMPOSITING) 811 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « cc/CCResourceProvider.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698